function popupwindow(WindowName, URL) {
    var width = 750;
    var height = 580;

    window.open(URL,'_blank','menubar=no,toolbar=no,status=no,width='+width+',height='+height+',resizable=yes,scrollbars=yes');
    }

function newWindow(showbasket) {
	bookWindow = window.open(showbasket, 'bookWin', 'width=750,height=580,scrollbars=1')
	bookWindow.focus()
    }
// To resize the popup to fit the image; credit to Peter Todorov
function PopupPic(sPicURL) {
   window.open( "popup.htm?"+sPicURL, "",
   "resizable=1,HEIGHT=200,WIDTH=200,left=40,top=70");
    }
   
// These two functions are for the image-swapping on the gift pages
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }

function showImage(filename) {
	var obj = document.getElementById("productImage");
	obj.src = "images/" + filename;
    }
    
// This causes Adding to Cart feedback to appear when the user clicks "Add to Cart"
function addingToCart(obj) {
    obj.value = "Adding to Cart. . .";
    obj.style = "background: transparent; border: 0px; margin: 10px 0px 10px 0px;";
    }
		
function redirect(linkid) {
    var origin = window.opener;
    if (origin == null) { 
        var width = screen.width - 100;
        var height = screen.height - 170;
        self.resizeTo(width,height);
        window.location.href = linkid;
        }
    else {
	    opener.location.href = linkid;
	    window.close();
        }
	}
function closeAndReload(url) {
    var origin = window.opener;
    if (origin == null) {
        var width = screen.width - 100;
        var height = screen.height - 170;
        self.resizeTo(width,height);
        window.location.href = url;
        }
    else {
	    window.opener.location.reload();
	    window.close();
	    }
	}