//var product page
debut="";
hp = "";
prd = "";
cat = ""

//var diagnostics code
diagCode = "";

// popup for the checkout pages
function popcheckout(URL)
{ 
	newWin = window.open(URL,"popup","width=748,height=369,top=10,left=10,resizable=0,toolbar=0,scrollbars=0,status=0,menubar=0");
}

var newWindow

function openPopup(url, popupWidth, popupHeight) {
	if (newWindow && !newWindow.closed)	{
		newWindow.close()
	}	
		
	var winl = (screen.width - popupWidth) / 2;
	var wint = (screen.height - popupHeight) / 2;
		
	newWindow = open(url, 'popup', ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,top=" + wint + ",left=" + winl + ",width=" + popupWidth + ",height=" + popupHeight + "\""));
	newWindow.focus();
}

function openPopupPrint(url, popupWidth, popupHeight) {
	if(diagCode != '')
	{
		openPopup(url + '?catcode=' + diagCode, popupWidth, popupHeight);
	}
	else
	{
		openPopup(url, popupWidth, popupHeight);
	}
}


function openPopupScroll(url, popupWidth, popupHeight) {
	if (newWindow && !newWindow.closed)	{
		newWindow.close()
	}	
		
	var winl = (screen.width - popupWidth) / 2;
	var wint = (screen.height - popupHeight) / 2;
		
	newWindow = open(url, 'popup', ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,top=" + wint + ",left=" + winl + ",width=" + popupWidth + ",height=" + popupHeight + "\""));
	newWindow.focus();
}

function AutoPost(oSelect)
{
	if (oSelect.options[oSelect.selectedIndex].value != '')
	{
		document.location = "index.aspx?StateID=" + oSelect.options[oSelect.selectedIndex].value;
	}
}

function AddToBag(SKU)
{
	var mf = GetMainFormName();

	var quantitySelect = GetElement("quantity_" + SKU,mf); 
	var quantity = quantitySelect.options[quantitySelect.selectedIndex].text; 
	window.location = '../checkout/Purchase_from_url.aspx?q=' + quantity + '&prdcode=' + SKU;
}

function AddToBag_men(SKU)
{
	var mf = GetMainFormName();

	var quantitySelect = GetElement("quantity_" + SKU,mf); 
	var quantity = quantitySelect.options[quantitySelect.selectedIndex].text; 
	window.location = '../../checkout_men/Purchase_from_url.aspx?q=' + quantity + '&prdcode=' + SKU;
}


function AddToBag_man(SKU)
{
	var mf = GetMainFormName();

	var quantitySelect = GetElement("quantity_" + SKU,mf); 
	var quantity = quantitySelect.options[quantitySelect.selectedIndex].text; 
	window.location = '../checkout_men/Purchase_from_url.aspx?q=' + quantity + '&prdcode=' + SKU;
}

function AddToBag_club(SKU)
{
	var mf = GetMainFormName();

	var quantitySelect = GetElement("quantity_" + SKU,mf); 
	var quantity = quantitySelect.options[quantitySelect.selectedIndex].text; 
	window.location = '../../checkout/Purchase_from_url.aspx?q=' + quantity + '&prdcode=' + SKU;
}

function AddToBag_club_men(SKU)
{
	var mf = GetMainFormName();

	var quantitySelect = GetElement("quantity_" + SKU,mf); 
	var quantity = quantitySelect.options[quantitySelect.selectedIndex].text; 
	window.location = '../../../checkout_men/Purchase_from_url.aspx?q=' + quantity + '&prdcode=' + SKU;
}


function poplog()
{
	//var winl = (screen.width - 400) / 2;
	//var wint = (screen.height - 450) / 2;
	openPopup("../club/popup_login_product.aspx", 430,450);
}	
	
review_width  = 520
review_height = 550;	

function openPopup_Review(url) {
	openPopup(url, review_width, review_height);
}
	
function poplog_review()
{
	openPopup("../club/popup_login_review.aspx", 430,450);
	//var winl = (screen.width - review_width) / 2;
	//var wint = (screen.height - review_height) / 2;
	//window.open("../club/popup_login_review.aspx",'popup_login',"width="+review_width+",height="+review_height+",top=" + wint + ",left=" + winl + ",resizable=0,toolbar=0,scrollbars=0,status=0,menubar=0");
}

function position_review()
{
//	window.resizeTo(review_width,review_height);	
//	var winl = (screen.width - review_width) / 2;
//	var wint = (screen.height - review_height) / 2;	
//	window.moveTo(winl,wint);
}

var myimages=new Array()

function MM_preloadImages() { 
for (i=0;i<MM_preloadImages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=MM_preloadImages.arguments[i]
}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null)
{
document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
}
}


	function loadshade()
	{
		var mf = GetMainFormName();
		if (mf==null) return;
		// Get the Quantity Drop Down; if not found, exit
		var firstitem = GetElementName("varlist",mf);
		if (firstitem == null) return;
		// Get the hidden static size display			
		var labelName = GetElementName("staticSizeDisplay",mf)
		if (labelName== null) return;
		var labelForSize = document.forms[mf].elements[labelName];
		var ddlVarList = document.forms[mf].elements[firstitem];	
		// Set the text box appropriately
		labelForSize.value = ddlVarList.options[0].text;
		// change the display if the drop down only contains more than one element.
		if (ddlVarList.options.length > 1)
		{
			// Hide the label & show the drop down;
			labelForSize.className = 'A_meddrkgrey07R hidden';
			ddlVarList.className = 'A_meddrkgrey07R';
		}
		var first = ddlVarList.options[0].value;
		selectshade(first);
	}

	function selectshade(sku)
	{
		var mf = GetMainFormName();
		if (mf==null) return;
		if (sku==null || sku=="") return;
		if (sku.indexOf("#") != -1){
			sku=sku.slice(0,sku.indexOf("#"));
		}
		var x = GetElementName("varlist",mf);
		if (x != null) {
			for (var i=0; i< document.forms[mf].elements[x].options.length; i++)	{
				str = document.forms[mf].elements[x].options[i].value
				str = str.slice(0,str.indexOf("#"));
				if (str==sku) {
					document.forms[mf].elements[x].selectedIndex=i;
					strprice = document.forms[mf].elements[x].options[i].value
					var start = strprice.indexOf("#");
					strprice = strprice.slice(start+1);
					if (strprice != null) {
						// strip off any leading zeros.
						if (strprice.indexOf("0") == 0) strprice = strprice.slice(1);
						document.forms[mf].eanprice.value = "$" + strprice
					}
					return;
				}
			}
		}
	}

function GetSeal()
{
 document.write("<script src=https://seal.verisign.com/getseal?host_name=164.109.82.48:8080&size=S&use_flash=YES&use_transparent=YES&lang=en></script>") ;	
}




