    var fixUrl = true;
    function fixURL(product_url)
    {
      if(product_url.indexOf("http://") == -1 && product_url.indexOf("https://") == -1)
        product_url = "http://" + callBack + product_url;
        if(urlPassBack != "") {
            if(product_url.indexOf("?") == -1) {
                product_url += "?";
            } else {
                product_url += "&";
            }	
            product_url += urlPassBack;
        }
        return product_url;
    }

    function docWrite(line)
    {
        document.write(line);
    }

    function loadProduct(product_url)
    {
        loadProductPW(product_url);
    }

    function loadProductPW(product_url)
    {
        product_url = fixURL(product_url);
        var theParent = parent.window.opener;
        if ((theParent != null) && (theParent.location != null) && !theParent.closed) {
            theParent.location = product_url;
            theParent.focus();
        } else {
            fixUrl = false;
            loadProductNW(product_url,false);
            fixUrl = true;
        }
    }

    function loadProductCW(product_url)
    {
        product_url = fixURL(product_url);
        document.location = product_url;
    }

    function loadProductNW(product_url)
    {
	    if(fixUrl)
	    {
	        product_url = fixURL(product_url);
	    }
	    var new_window = window.open( product_url, windowName, windowFeatures);
	    new_window.focus();
    }
        
    function launchFeedback(currentFrame)
    {
        alert("feedback for frame " + currentFrame);
    }

    function reload(enlargeState, currentFrame)
    {
        document.location = document.location.pathname + "?" + reloadParams + "&el=" + enlargeState;
    }
        
    function onProductIconClick()
    {
            loadProductPW(productIconURL);
    }

    function onLogoClick()
    {		
        if(logoClickURL != '')
                loadProductPW(logoClickURL);
    }	

    var xmlStateInfo = "";
    function saveState(type,stateInfo,finalBlock)
    {
        var tmpSI = "";
        xmlStateInfo += stateInfo;
        if(arguments.length < 3)
            finalBlock = true;
        if(finalBlock) {
            if(type==1) {  //email to a friend
                tmpSI = xmlStateInfo;
                xmlStateInfo = "";
                window.open("","emailfriend","width=" + emailWindowWidth + ",height=" + emailWindowHeight + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
                document.frmState.currentState.value=tmpSI;
                xmlStateInfo = "";
            	//alert(tmpSI);
                document.frmState.submit();
            }
        }
    }
        	
    function openPrivacy()
    {
        var html = privacyCopy;
        newWin = window.open("","privacy","width=" + privacyWindowWidth + ",height=" + privacyWindowHeight);
        newWin.document.write(html);
        newWin.document.close();
    }


    function goToPage(page)
    {
        setFlashParam(instance,"currentFrame",page);
    }

	function setFlashParam(inId, inName, inVal)
	{ 
        var divcontainer = "flash_setvariables_" + inId;
        if (!document.getElementById(divcontainer))
        {
            var divholder = document.createElement("div");
            divholder.id = divcontainer;
            document.body.appendChild(divholder);
        }
        document.getElementById(divcontainer).innerHTML = "";
        var divinfo = "<embed src='http://s7ondemand7.scene7.com/is-viewers/flash/gateway.swf' FlashVars='lc=" + inId + "&fq="+escape(inName + "=" + inVal)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
        document.getElementById(divcontainer).innerHTML = divinfo;
	}


	function ParentOpener(url,parentname)
	{
	    if(self.opener && !self.opener.closed)
	        self.opener.location=url;
	    else
	        window.open(url,parentname);
	}
