﻿
// This runs on load of the ProductGenerator.  We make sure it opens in the full Master page "frame"
if ((top == self) && (getURLParameter("Print") != 'true'))
{
    //top.location.href = 'products.aspx' + '?Prod=' + getURLParameter("Prod"); // + self.location.pathname;

    var version = parseInt(navigator.appVersion);
    
    // replace is supported
    if (version >= 4 || window.location.replace)
    {
     /*   if (getURLParameter("Print") == 'true')
            window.location.replace('products.aspx' + '?Prod=' + getURLParameter("Prod")) + "&Print=true";
        else  */
            window.location.replace('products.aspx' + '?Prod=' + getURLParameter("Prod")) + "&one";
    }
    else
    {
      /*  if (getURLParameter("Print") == 'true')
            window.location.href = 'products.aspx' + '?Prod=' + getURLParameter("Prod") + "&Print=true";
        else  */
            window.location.href = 'products.aspx' + '?Prod=' + getURLParameter("Prod") + "&two";
    }
}

// JScript File
function changepic(curr_item, img_src, ImageCount) 
{
    //alert ("img_scr = '" + img_src + "'   ImageCount = '" + ImageCount + "'");
    if (document.getElementById)
    {
        Element = document.getElementById("MainImage");
        Element.src=img_src;
    }
    else
    {
        document['MainImage'].src=img_src;
    }
	
	//alert ("past document");
	for (i=1;i<=ImageCount;i++)
	{
		//alert ('|TN' + i+ '|');
		document['TN'+ i].border='1';
	}
	curr_item.border='2';
	//alert ("about to return");
}

function getURLParameter(name)
{  
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
    var regexS = "[\\?&]"+name+"=([^&#]*)";  
    var regex = new RegExp( regexS );  
    var results = regex.exec( window.location.href );  
    if( results == null )    
        return "";  
    else    
        return results[1];
}


