﻿var sku_mouseover = "";
var wndPopup = null;

function PopupZoom(sku, strProdCode) {
	wndPopup = window.open('/e/ptxwebstore_product/product_zoom.asp?sku=' + sku + '&prod_code=' + strProdCode, 'Popup', 'scrollbars=no,width=426,height=460,resizable=yes')
    wndPopup.moveTo(0, 0);
    wndPopup.focus();
}

function doTellFriendWindow(sku) {
	var urlStr;
	urlStr=window.location.href;
	while (urlStr.indexOf("&")>0) {
		urlStr=urlStr.replace(/&/,", ");
	}

	if (window.location.href.indexOf("ptxwebstore_TellFriendFrame.asp")<0) {
		window.location.replace('/e/ptxwebstore_TellFriendFrame.asp?check=0&url=' + urlStr+'?sku='+sku);
	}
}

function AskQuestionWindow(sku)
{
	window.open('/e/ptxwebstore_order_mgnt/siteletternew.asp?sendfrom=2&sku='+sku, 'PrintWin','toolbar=no,scrollbars=yes,resizable=yes,height=400,width=640');
}

function MemberpopWin(sku) {
	window.open("/e/ptxwebstore_product/product_comment.asp?sku="+sku, "_blank", "toolbar=no,scrollbars=yes,resizable=yes,height=400,width=640");
}  

function ShowColorImage(att_name,att_id,suk,typ,intRec)
{
	var hidd=document.all(suk);
	var text=document.getElementById("t"+suk);
	var img=document.getElementsByTagName("img"); 
	var i;
	
	if (text!=null)
	{
		text.innerText=att_name;
	}
	if(hidd!=null)
	{
		hidd.value=att_id;
	}
	
	for(i=0;i<img.length;i++){
		if(img[i].id.toString().indexOf("img"+typ+intRec+"_")!=-1)
		{
			if(img[i].id.toString()=="img"+typ+intRec+"_"+att_id)
			{
				img[i].style.padding="1px";
				img[i].style.border="1px solid #333";
			}
			else
			{
				img[i].style.border="0px";
			}
		}
	}
}

function ShowWhatIsHot(divname)
{
	var objdiv=document.getElementsByTagName("div");
	
	for(i=0;i<objdiv.length;i++){
		if(objdiv[i].id.toString().indexOf("Hot")!=-1 && objdiv[i].id.toString().indexOf("_")!=-1)
		{
			if(objdiv[i].id.toString()==divname)
			{
				objdiv[i].style.display="block";
			}
			else
			{
				objdiv[i].style.display="none";
			}
		}
	}
}

function ShowAdditionalImage(strName,imgSrc)
{
	var obj=document.getElementsByName(strName); 
	for(var i=0;i<obj.length;i++)
	{
		if(obj[i].style.display!='none') 
			obj[i].src=imgSrc;
	}
}

function ChangeLanguage(lang,url)
{
	document.cookie = "uLanguage="+lang;
	window.location.href=url;
}

function HideMenu(id)
{
	var objDiv=document.getElementById("div"+id);
	var objImg=document.getElementById("img"+id);
	if(objDiv)
	{
		if(objDiv.style.display!="none")
		{
			objDiv.style.display="none";
			objImg.src="/e/ptxwebstore_product/images/bgSideNav_02.gif";
		}
		else
		{
			objDiv.style.display="block";
			objImg.src="/e/ptxwebstore_product/images/bgSideNav_03.gif";
		}
	}
}

function SelectSubmit(brand,prodtype,brand_path,sex,size,color,price,skin,virtue,typ)
{
	if(typ=='Catalog')
	{
		sex="";
		size="";
		color="";
	}
	window.location="/e/ptxwebstore_product/product_list.asp?brand="+brand+"&prodtype="+prodtype+"&brand_path="+brand_path+"&sex="+sex+"&size="+size+"&color="+color+"&price="+price+"&skin="+skin+"&virtue="+virtue+"&TableField=TableField";
}

function ClearSelection(brand,prodtype,brand_path,sex,size,color,price,skin,virtue)
{
	window.location="/e/ptxwebstore_product/product_list.asp?brand="+brand+"&prodtype="+prodtype+"&brand_path="+brand_path+"&sex="+sex+"&size="+size+"&color="+color+"&price="+price+"&skin="+skin+"&virtue="+virtue+"&TableField=TableField";
}

stuHover = function() {
	if(document.getElementById("nav"))
	{
		var cssRule;
		var newSelector;
		for (var i = 0; i < document.styleSheets.length; i++)
			for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
				{
				cssRule = document.styleSheets[i].rules[x];
				if (cssRule.selectorText.indexOf("LI:hover") != -1)
				{
					 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
					document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
				}
			}
		var getElm = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<getElm.length; i++) {
			getElm[i].onmouseover=function() {
				this.className+=" iehover";
			}
			getElm[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);
