//Function to activate images.
function imgOn(imgName) {
        if (document.images) {
			if(imgName == 'topnav7') {
	            document["topnav6"].src = eval(imgName + "on.src");
			} else{
	            document[imgName].src = eval(imgName + "on.src");
			}
        }
}
//Function to deactivate images.
function imgOff(imgName) {
        if (document.images) {
			if(imgName == 'topnav7') {
	            document["topnav6"].src = eval(imgName + "off.src");
			} else{
            document[imgName].src = eval(imgName + "off.src");
			}
        }
}

function popUp(URL){
window.open(URL,'popUp','toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=yes,width=300,height=400');
}

function newWindow(URL){
window.open(URL,'popUp','toolbar=yes,scrollbars=yes,location=yes,statusbar=yes,menubar=yes,resizable=yes,width=640,height=480');
}
//Function to activate popup.
function popUpAdv(URL, n, w, h, scrollYN, resizeYN){
window.open(URL, n,'toolbar=no,scrollbars=' + scrollYN + ',location=no,statusbar=no,menubar=no,resizable=' + resizeYN + ',width=' + w + ',height=' + h);
}



function AdvPopup(URL,w,h,s) {
	var sb = "yes";
	if (s == 0) { sb = "no"; }
	popupWindow=window.open(URL,'popup','toolbar=no,scrollbars=' + sb + ',location=no,statusbar=no,menubar=no,resizable=yes,width='+w+',height='+h); 
	popupWindow.focus();
}
function interstitialPopup(URL) {
		popupWindow=window.open(URL,'popup','toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=no,width=430,height=336'); 
		popupWindow.focus();
}
function storePopup(URL) {
		popupWindow=window.open(URL,'popup','width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0'); 
		popupWindow.focus();
}

function shopClubDollsPopup(URL) {
adwin=window.open(URL,'shoponline','width=800,height=600,toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,left=0,top=0');
adwin.focus();
}
function blankSpaces(obj) {
	while(''+obj.charAt(obj.length-1)==' ') {
		obj=obj.substring(0,obj.length-1);
	}
	return obj;
}

 function openZoom(URL, size) { //v2.0
 	var w;
 	if (size == "s") w = 490;
	else if (size == "v") w = 460;
	else w = 650;
     var args = "width=" + w + ",height=470,scrollbars=no,resizable=no";
	 zoomwin=window.open(URL,"appWindow", args);
     zoomwin.focus();

}

var daughterWin = null;
function openZoom360(sku) {
	if (daughterWin && !daughterWin.closed)
	{
		daughterWin.location = "/viewer/zoom360.aspx?sku=" + sku;
		daughterWin.focus();
	}
	else
	{
		var args;
		args = "width=461,height=471,scrollbars=no,resizable=no";
		daughterWin=window.open("/viewer/zoom360.aspx?sku=" + sku,"appWindow",args);
		daughterWin.focus(); 
	}
}

function openDaughter(name,imgX)
{ 
	if (daughterWin && !daughterWin.closed)
	{
		daughterWin.location = "http://zoom.barbiecollector.com/barbie/camzoom.html?" +name;
		daughterWin.focus();
	}
	else
	{
		var args;
		args = "width=" + imgX + ",height=470,scrollbars=no,resizable=no";
		daughterWin=window.open("http://zoom.barbiecollector.com/barbie/camzoom.html?"+name,"appWindow",args);
		daughterWin.focus(); 
	}
}
function closeDaughter()
{
	if (daughterWin && !daughterWin.closed)
	{
		daughterWin.close();
		daughterWin = null;
		return;
	}
}

function popUpCenter(URL, n, popW, popH, scrollYN, resizeYN){

//if (document.all || document.layers) {
   w = screen.availWidth;
   h = screen.availHeight;
//}

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

window.open(URL, n,'toolbar=no,scrollbars=' + scrollYN + ',location=no,statusbar=no,menubar=no,resizable=' + resizeYN + ',width=' + popW + ',height=' + popH + ',top ='+ topPos + 'left='+ leftPos);
}

