    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 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) {
 var parentWin = window.opener; var fbUrl = "http://www.hammacher.com/contact_us/main.asp";
 if ((parentWin == null) || (parentWin.location == null) || (parentWin.closed)) {
  var newMainWin = window.open(fbUrl,"main",""); newMainWin.focus();
 } else {parentWin.location = fbUrl; parentWin.focus();}
}

    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) {
        xmlStateInfo += stateInfo;
        if(arguments.length < 3)
            finalBlock = true;
        if(finalBlock) {
            if(type==1) {  //email to a friend
                window.open("","emailfriend","width=" + emailWindowWidth + ",height=" + emailWindowHeight + ",location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
                document.frmState.currentState.value=xmlStateInfo;
                xmlStateInfo = "";
                document.frmState.submit();
            }
        }
    }
        	
    function openPrivacy() {
        var html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"../Style_Sheets/standard.css\"></head><body><p class=\"text11\">We contract with Coremetrics, a service partner, to provide us with a data collection and reporting service. As a result of your accessing our site, Coremetrics may on our behalf collect information about you. For further information, including how to opt out, consult Coremetrics privacy policies at: <a href=\"javascript:window.open('http://www.coremetrics.com/info_eluminate2.html');window.close();\">http://www.coremetrics.com/info_eluminate2.html</a></p></body></html>";
        newWin = window.open("","privacy","width=275,height=150");
        newWin.document.write(html);
        newWin.document.close();
    }

    function resizeStage(w, h) {
            var elementId = 'ZoomMX';		//match the id attribute of the OBJECT element
            var isSafari = ((navigator.appName=='Safari') || (navigator.userAgent.toLowerCase().indexOf('safari')>-1));
            var elm = null;
            if (!isSafari) {
                    elm = document.embeds[elementId];
            }
            var checkElm = false;
            if (elm) {
                    checkElm = true;
            } else {
                    checkElm = false;
            }
            if (!isSafari && checkElm) {
                    elm.width = w;
                    elm.height= h;
            } else {
                    v = getElement(elementId);
                    if (document.getElementById)
                    {
                            v.width = w;
                            v.height = h;
                    }
                    else if (v.all)
                    {
                            v.posWidth = w;
                            v.posHeight = h;
                    }
                    else if (v.clip)
                    {
                            v.clip.width = w;
                            v.clip.height = h;
                    }
            }	
    }

    function getElement(name) {
            if (document.getElementById) 
                    return document.getElementById(name).style;
            if (document.all) 
                    return document.all[name].style;
            if (document.layers) 
                    return document[name];
    }

