function New(page, pageName) {
    window.open(page, pageName, "toolbar=no,menubar=no,location=yes,scrollbars=yes,resizable=yes,height=450,width=800");
}
    
function popup(url,w,h) {
    newPopup = window.open (url, 'lbcpop', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+w+',height='+h);  newPopup.focus();
}
    
function getParams() {
    var idx = document.URL.indexOf('|');
    // insert default mcc code
    var mcc='XJS';
    if (idx != -1) {
        var mcc = document.URL.substring(idx+1, document.URL.length);
        //mcc = pairs[1];
    }
    mcc = '&MCC='+ mcc;
    return mcc;
}

function passMCC(url) {
    var mcc = getParams();
    url = url+mcc;
    document.location = url;
}


//this is the pop-up function used on ENT pages. i have included it here to take care of pages built for large.
function open_popup(page,x,y,s,r) {
    eval("page" + " = window.open(page, '"+"', 'toolbars=0,scrollbars=' + s + ',location=0,statusbars=0,menubars=0,resizable=' + r + ',width=' + x + ',height=' + y);");
    return false;
}

function partner_link(url)
{   
    if(confirm("You are leaving HP.com to visit a web site that is not maintained by HP and where the HP privacy policy does not apply.\n\nThis link is provided to you for convenience and does not serve as an endorsement by HP of any information or contacts that you may find on this non-HP site. Remember, when you need information about HP products or services, come back to our Web site. Thank you for visiting HP.com.\n\nClick OK to continue, or Cancel to stay on the HP.com site.")){
        window.open(url);
    }
}

/*
 *
 * Country drupdown select
 *
*/
if (typeof countrySelect_URLs == 'undefined'){
	window.onload = function(){
	document.countryForm.style.display = 'none';
	document.getElementById('ctryInd').innerHTML = 'United States-English';
	}
}

function jumpToURL() {
	url = countrySelect_URLs[document.countryForm.countrySelect.selectedIndex];
	if (url != "") {
         location.href=url;
    } // end if
} // end function


/*
 *
 * Print Window function
 *
*/
function printit(){
    if (window.print) {
        window.print();
    } else {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" />';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6,1);
        WebBrowser1.outerHTML = "";
    }
}

/*
 *
 *  Email To Friend Pop-up function
 *
*/
function STFpopup()  
{
    url = location.href;
    url = url.replace(/(http:\/\/)(.)+(\.com)/gi, '');
    if (url.match(/^[a-zA-Z0-9_#\-\.\/]*$/))
    {
      newPopup = window.open ('/cgi-bin/sbso/email-to-friend.cgi?referrer='+url+'', 'stfpop', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=375,height=370');
      newPopup.focus();
    } else {
      alert('Security Violation');
    }
}

//Procuct image switching for the index1 and index2 pages
	if (document.images && (location.pathname == '/sbso/index_evo.html'))
    {
     // Set width and height of all images
     var img_width=64;
     var img_height=64;

     // Set up "on" images (show up onmouseover)

     ipgmultion= new Image(img_width,img_height);
     ipgmultion.src="/sbso/evo/images/ipg2.jpg";

     ipgfaxon= new Image(img_width,img_height); 
     ipgfaxon.src="/sbso/evo/images/ipg3.jpg";

     ipgdigitalon= new Image(img_width,img_height);
     ipgdigitalon.src="/sbso/evo/images/laserjet-1022-64x64.jpg";

     ipgsupplieson= new Image(img_width,img_height); 
     ipgsupplieson.src="/sbso/evo/images/ipg6.jpg";

     pcworkon= new Image(img_width,img_height);
     pcworkon.src="/sbso/evo/images/pc2.jpg";

     pcnoteon= new Image(img_width,img_height);
     pcnoteon.src="/sbso/evo/images/pc3.jpg";

     pchandon= new Image(img_width,img_height);
     pchandon.src="/sbso/evo/images/pc4.jpg";

     pcmonitoron= new Image(img_width,img_height);
     pcmonitoron.src="/sbso/evo/images/pc5.jpg";

     serveron= new Image(img_width,img_height);
     serveron.src="/sbso/evo/images/server2.jpg";

     serverstoron= new Image(img_width,img_height);
     serverstoron.src="/sbso/evo/images/server3.jpg";

     serverneton= new Image(img_width,img_height);
     serverneton.src="/sbso/evo/images/server4.jpg";

     serverbladeon= new Image(img_width,img_height);
     serverbladeon.src="/sbso/evo/images/prod-blade-servers-64x64.jpg";

     // Set "off" images (onmouseout)    
     ipgoff= new Image(img_width,img_height);
     ipgoff.src="/sbso/evo/images/ipg2.jpg";

     pcoff= new Image(img_width,img_height);
     pcoff.src="/sbso/evo/images/pc3.jpg";

     serveroff= new Image(img_width,img_height);
     serveroff.src="/sbso/evo/images/server2.jpg";
    }

    // Change the image

    function changeImage(imgName,picobj)
    {
      if (document.images)
      { 
        document.images[imgName].src= picobj.src;
      }
    }

    /*
     * Function used to clean input box on EVO index page.
    */
    function removeInstructionalText() {
        if (document.emailForm.EMAIL.value == "Enter e-mail address") {
            document.emailForm.EMAIL.value = "";
        } // end if
    } // end function

    /*
     * Function used to validate input box on EVO index page.
    */
    function validateEmail() {
        if (document.emailForm.EMAIL.value != "" &&  document.emailForm.EMAIL.value != document.emailForm.EMAIL.defaultValue) {
            if (!checkEmail(document.emailForm.EMAIL.value)) {
                alert("Invalid email address");
                return false;
            } // end if
        } // end if
        return true;
    } // end function

    // this function decides whether or not to draw the "detect my products" button.
    // if the browser supports the button's back end functionality, this function
    // will draw the button.
    // NOTE: this function relies on hpweb_utlities.js browser sniffing to have occurred.
    function drawGMNButton()
    {

        //window.alert("agt is " + agt + " and version is " + navigator.appVersion + " and is_major is " + is_major + " and agt.indexOf(msie 5.0) is" + agt.indexOf("msie 5.0") + " and isie4 is " + is_ie4 + " and Iswin is " + is_win + " and isie5up is " + is_ie5up);
        // this conditional should test for browsers that support the automatic product
        // detection functionality (GMN)
        // NOTE: at the time of writing this, the variable is_ie5up was producing erroneous values.
        if(is_win && (is_ie5 || is_ie6 || is_ie7) && (!is_opera))
        {
            // the following elements will  be displayed if the OS/browser does support GMN:
            //
            // * the separator line above the GMN section
            // * the GMN heading
            // * the GMN button
            // * the GMN "about" link
            // * any spacers in the GMN section
            document.write('<div class="contentBlock centerAligned" style="border-top:1px solid #ccc;margin-top:15px;padding:15px 0 10px 0;">');
            document.write('<h3 class="bold">Or Automatically detect product names/numbers:</h3>');
            document.write('<div style="padding:10px 0;">');
            document.write('<form action="http://h20270.www2.hp.com/ediags/gmn/index.aspx" method="get" name="productDetect" id="productDetect" style="margin-bottom: 0;">');
            document.write('<input type="submit" name="detectProducts" class="primButton" value="Start Detection&nbsp;&raquo;">');
            document.write('</form>');
            document.write('</div>');
            document.write('<span class="small">&raquo;&nbsp;<a href="http://h20270.www2.hp.com/ediags/gmn/index.aspx?about=yes">About automatic product detection</a></span>');
            document.write('</div>');
        }
    }

    //---------------------------------------------------------------------------
    //
    // getVars()
    //
    // PURPOSE:
    //  this is a utility function that will check the query string for the
    //  current window's URL.  For each 'variable=value' pair in the query
    //  string, it will create a variable that contains the string equivalent
    //  of that value.  This makes these variables available to the code on the
    //  rest of the page.
    //
    //
    //---------------------------------------------------------------------------
    function getVars()
    {
       var varString = window.location.search.substring(1);
       var varArray = varString.split('&');
       var expression;
       var tempArray;
       for (i=0;i<varArray.length;i++)
       {
            if (varArray[i].indexOf("=") >= 1)
            {
                tempArray = varArray[i].split('=');
                expression = tempArray[0] + "='" + tempArray[1] + "'";
                eval(expression);
            }
       }
    }
    
    // This function will preset the radio.  You have to initialize "selectedValue" somewhere or it will not work.
    var selectedValue = "";
    function setRadio()
    {
    var myRadio = document.productQuery.h_pagetype;
        for (var i=0; i<myRadio.length; i++)
        {
            if (myRadio[i].value == selectedValue)
            {
                myRadio[i].checked = true;
                return;
            }
        }
    }

	//In open JavaScript (not inside a function), define the array
	var queryString = new Array();
	// and then pull the querystyring parameters from the URL.
	// The search property of the window location returns the query string.
	// The method substring(1) removes the first character (the question mark).
	// The split function then copies the parameters into an array called "parms"
	var parameters = window.location.search.substring(1).split('&');
	// For each element in the array, find the equal sign that separates the parameter
	// name from the parameter value.  If there is one, divide the expression into
	// the parameter name
	for (var i=0; i<parameters.length; i++) {
		var pos = parameters[i].indexOf('=');
		// If there is an equal sign, separate the parameter into the name and value,
		// and store it into the queryString array.
		if (pos > 0) {
			var paramname = parameters[i].substring(0,pos);
			var paramval = parameters[i].substring(pos+1);
			queryString[paramname] = unescape(paramval.replace(/\+/g,' '));
		} else {
			//special value when there is a querystring parameter with no value
			queryString[parameters[i]]="" 
		}
	}
	var printVersion = (queryString["printVersion"] == 'true')?true:false;
