if (document.images)
	{ 
top1on= new Image(65,80);
top1on.src=" http://site.babyoliverboutique.com/images/home-over.gif";
top2on= new Image(85,80);
top2on.src=" http://site.babyoliverboutique.com/images/cart-over.gif";
top3on= new Image(65,80);
top3on.src=" http://site.babyoliverboutique.com/images/info-over.gif";
top1off= new Image(65,80);
top1off.src=" http://site.babyoliverboutique.com/images/home-out.gif";
top2off= new Image(85,80);
top2off.src=" http://site.babyoliverboutique.com/images/cart-out.gif";
top3off= new Image(65,80);
top3off.src=" http://site.babyoliverboutique.com/images/info-out.gif";

	} 
 
function lightup(imgName) 
	{ 
		if (document.images) 
			{ imgOn=eval(imgName + "on.src"); document[imgName].src=imgOn;  
			}  
	} 
	
function turnoff(imgName) 
	{ 
		if (document.images) 
			{ 
				imgOff=eval(imgName + "off.src"); document[imgName].src=imgOff;  }  
	} 


function LargePics(img,title2){
  foto1= new Image();
  foto1.src=(img);
  LargePics2(img,title2);
}
function LargePics2(img,title2){
  if((foto1.width!=0)&&(foto1.height!=0)){
    LargePics3(img,title2);
  }
  else{
    funzione="LargePics2('"+img+"','"+title2+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function LargePics3(img,title2){
  largh=foto1.width+40;
  altez=foto1.height+200;
  stringa="width="+largh+",height="+altez;
  newWind=window.open("","",stringa);
		 output="<HTML><HEAD><title>"+title2+"</title></HEAD><BODY><CENTER>"
 		 output+="<FONT FACE='Arial' SIZE='+1' COLOR='black'><B>"+title2+"</B></FONT><BR>"
		 	output+="<TABLE BORDER='0'><TR><TD>"
		 output+="<IMG SRC='"+img+"'>"
		 	output+="</TD></TR></TABLE>"
		 output+="<FORM><TABLE BORDER='0' style='border-collapse: collapse;' bordercolor='#000000'><TR><TD><input src='http://site.babyoliverboutique.com/images/clicktoclose.gif' type='image' onClick='self.close()'>"
		 output+="</TD></TR></TABLE></FORM></CENTER></BODY></HTML>"
		 newWind.document.write(output);
		 newWind.document.close();
 		 newWind.focus();
}

function LargePics4(URL) { 
  window.open(URL,'','width=400,height=400');}



var bookmarkurl=location.href
var bookmarktitle=document.title

function addbookmark(){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
}

function openReturnPolicy(){
window.name = "popup";
var feature = window.open("http://www.babyoliverboutique.com/returnpolicy.html","feature",'toolbar=no,status=no,location=0,left=100,right=100,width=550,height=500,resize=no,scrollbars=yes,menubar=no');
}

function openShippingInfo(){
window.name = "popup";
var feature = window.open("http://www.babyoliverboutique.com/shipping.html","feature",'toolbar=no,status=no,location=0,left=100,right=100,width=600,height=500,resize=no,scrollbars=yes,menubar=no');
}

function openSecurityInfo(){
window.name = "popup";
var feature = window.open("http://www.babyoliverboutique.com/security-popup.html","feature",'toolbar=no,status=no,location=0,left=100,right=100,width=300,height=400,resize=no,scrollbars=yes,menubar=no');
}

function openOfferInfo(){
window.name = "popup";
var feature = window.open("http://www.babyoliverboutique.com/offer.html","feature",'toolbar=no,status=no,location=0,left=100,right=100,width=600,height=600,resize=no,scrollbars=yes,menubar=no');
}

function openGiftWrap(){
window.name = "popup";
var feature = window.open("http://www.babyoliverboutique.com/gift-wrap-description.html","feature",'toolbar=no,status=no,location=0,left=100,right=100,width=550,height=200,resize=no,scrollbars=yes,menubar=no');
}

//**********************************************************
//**************** UTILITY FUNCTIONS ***********************
//**********************************************************
function popIt(width, height, scrollbars){ 
	if(!width) width = "640";
	if(!height) height = "480";
	if(!scrollbars) scrollbars = 1;
	var windowString = 'width=' + width + ',height=' + height + ',resizable=1,status=0,toolbar=no,scrollbars=' + scrollbars + ',scrolling=auto';
	var popItWindow = window.open('',"popIt", windowString);
	return false;
}
function encodeOptions(input) {
	input = String(input).replace(/&/g, "!!amp!!");
	input = String(input).replace(/=/g, "!!eq!!");
	return input;
}

//**********************************************************
//**************** ADD TO FAVORITES BUTTON *****************
//**********************************************************
function addToFavorites(orderForm) {
	var optionString = '';
	var optionList = new Array();
	for(var i=0;i<orderForm.elements.length;i++) {
		if(orderForm.elements[i].type == "select-one" || String(orderForm.elements[i].name).indexOf("vw-inscription-") > -1) {
			var option = new Object();
			option.name = orderForm.elements[i].name;
			option.value = orderForm.elements[i].value;
			optionList.push(option);
		}
	}
	for (i = 0; i <= optionList.length - 1; i++) optionString += encodeOptions(optionList[i].name) + "=" + encodeOptions(optionList[i].value) + "&";
	optionString = optionString.substring(0, optionString.length - 1);	//*** TRIM TRAILING "&"
	popIt(394,400,0);
	var myInput = document.createElement("INPUT");
	myInput.type = "hidden";
	myInput.name = "product-option-list";
	myInput.value = optionString;
	orderForm.appendChild(myInput);
	var tempAction = orderForm.action;
	var copiedQueryString = "";
	var queryStringPosition = tempAction.indexOf("?");
	if(queryStringPosition > -1) copiedQueryString = tempAction.substring(queryStringPosition, tempAction.length);
	var tempTarget = orderForm.target;
	orderForm.action="http://myaccount.babyoliverboutique.com/favoritesAddItem.php" + copiedQueryString;
	orderForm.target="popIt";
	orderForm.submit();
	orderForm.action = tempAction;
	orderForm.target = tempTarget;
	orderForm.removeChild(myInput);
	return false;
}
//******************************************
//******* ADD TO REGISTRY BUTTON ***********
//******************************************
function addToRegistry(orderForm) {
	var optionString = '';
	var optionList = new Array();
	for(var i=0;i<orderForm.elements.length;i++) {
		if(orderForm.elements[i].type == "select-one" || String(orderForm.elements[i].name).indexOf("vw-inscription-") > -1) {
			var option = new Object();
			option.name = orderForm.elements[i].name;
			option.value = orderForm.elements[i].value;
			optionList.push(option);
		}
	}
	for (i = 0; i <= optionList.length - 1; i++) optionString += encodeOptions(optionList[i].name) + "=" + encodeOptions(optionList[i].value) + "&";
	optionString = optionString.substring(0, optionString.length - 1);	//*** TRIM TRAILING "&"
	popIt(394,400,0);
	var myInput = document.createElement("INPUT");
	myInput.type = "hidden";
	myInput.name = "product-option-list";
	myInput.value = optionString;
	orderForm.appendChild(myInput);
	var tempAction = orderForm.action;
	var copiedQueryString = "";
	var queryStringPosition = tempAction.indexOf("?");
	if(queryStringPosition > -1) copiedQueryString = tempAction.substring(queryStringPosition, tempAction.length);
	var tempTarget = orderForm.target;
	orderForm.action="http://registry.babyoliverboutique.com/addRegistryItem.php" + copiedQueryString;
	orderForm.target="popIt";
	orderForm.submit();
	orderForm.action = tempAction;
	orderForm.target = tempTarget;
	orderForm.removeChild(myInput);
	return false;
}

//**********************************************************
//****** COPY BILLING FROM SHIPPING ON REGISTRY FORM *******
//**********************************************************
function copyBillingInfo(form) {
	if (form.copy.checked) {
		//**********************************************************
		//********* SET SHIPPING FIELDS AS VARIABLES ***************
		//**********************************************************
		try {var billCompany = form.billCompany.value;} catch(e) {}
		var billFirstName = form.billFirstName.value;
		var billLastName = form.billLastName.value;
		var billAddress1 = form.billAddress1.value;
		var billAddress2 = form.billAddress2.value;
		var billCity = form.billCity.value;
		var billState = form.billState.value;
		var billZip = form.billZip.value;
		var billPhone = form.billPhone.value;

		//**********************************************************
		//****** POPULATE SHIPPING FIELDS WITH BILLING DATA ********
		//**********************************************************

		try {form.shipCompany.value = billCompany;} catch(e) {}
		form.shipFirstName.value = billFirstName;
		form.shipLastName.value = billLastName;
		form.shipAddress1.value = billAddress1;
		form.shipAddress2.value = billAddress2;
		form.shipCity.value = billCity;
		form.shipState.value = billState;
		form.shipZip.value = billZip;
		form.shipPhone.value = billPhone;

	}else {

		//**********************************************************
		//******************* RESET BILLING DATA *******************
		//**********************************************************
		try {form.shipCompany.value = "";} catch(e) {}
		form.shipFirstName.value = "";
		form.shipLastName.value = "";
		form.shipAddress1.value = "";
		form.shipAddress2.value = "";
		form.shipCity.value = "";
		form.shipState.value = "";       
		form.shipZip.value = "";
		form.shipPhone.value = "";
	   }
}
function setPromoCookie(c_name,value,expiredays){
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
