function popupwindow(WindowName, URL) {
var width = 640;
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=640,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;
    }
		
// These functions expand and contract the Shopping Cart
function makeInvisible() {
	var cartContent;
	cartContent = document.getElementById("expandable");
	cartContent.style.visibility = "collapse";
}

function expand() {
	var header;
	heading = document.getElementById("clickToExpand");
	var cartContent;
	cartContent = document.getElementById("expandable");
	
	if(heading.innerHTML.indexOf("View") === 0) {
	  heading.innerHTML = "Hide Cart Summary";
		cartContent.style.visibility = "visible";
	}
	else {
	  heading.innerHTML = "View Cart Summary";
		cartContent.style.visibility = "collapse";
	}
}


	  // This function is to add color options for the IKEA cup and saucer sets. 
		// The "prefix" needs to be unique for each product. This is so we can use getElementById
		// instead of ByName, because the return value is easier to work with. The optioncount
		// is the number of options (1_type_1, 1_type_2, etc.).
	  function selectOption(optionCount, prefix) {
			for (c = 1; c <= optionCount; c = c + 1) {
				optionid = prefix + "option";
				option = document.getElementById(optionid);
				option = option.value;
				
				selectionid = prefix + c;
				selection = document.getElementById(selectionid);
				selection = selection.value;
				selection = selection + option;
				
				document.getElementById(selectionid).value = selection;
			}
			return true;
		}