function ChkSrh(){
	var objName;
	var strValue;
	
	objName = "Leftmenu1_txtSrhProd";
	strValue = Trim(document.getElementById(objName).value);
	if(strValue == "")
	{
		alert("請輸入搜尋條件!");
		document.getElementById(objName).focus();
		return false;
	}
	return true;
}

function Topnext(obj){
	if (window.event.keyCode==13){
			event.keyCode=9;
	}
}
function loadS(){
	
	var strValue;
	strValue=document.getElementById("Leftmenu1_txtSrhProd").value;
	if(strValue!="")
		 txtSrh();
	return false;
}

function txtSrh()
{
	var ddlType, strType, strTxt;
	strTxt=document.getElementById("Leftmenu1_txtSrhProd").value;
	ddlType=document.getElementById("Leftmenu1_ddlSrhType");
	strType = ddlType.options[ddlType.selectedIndex].value;
	if(CheckInputValue())
		document.getElementById("Leftmenu1_ifmMain5").src="../publicarea/jingoindexleftsearchvalue.aspx?strType="+strType+"|"+strTxt;
}

function CheckInputValue(){
	objName = "Leftmenu1_txtSrhProd";
	strValue = document.getElementById(objName).value;
	
	if(ChineseMatchLength(strValue))
		return true;
	else
	{
		if(strValue.length < 3)
		{
			document.getElementById(objName).focus();
			return false;
		}
		return true;
	}
}

function ChineseMatchLength(strValue){
	var n = 0; 
    var m = strValue.length;
	for(var i=0;i<m;i++) {    
		if(strValue.charCodeAt(i)<255)
			return false
	}
	return true;
}

function FilterChar(e){
	var keynum;
	var sCode;
	
	if(window.event) // IE
		keynum = e.keyCode
	else if(e.which) // Netscape/Firefox/Opera
		keynum = e.which
	
	sCode = String.fromCharCode(keynum);
	
	if(/[0-9a-zA-Z* \-]/.test(sCode))
		return true;
	else
		return false;
}

function openhelp(){
	url = "../publicarea/searchhelp.htm";
	status = "scroll:0;resizable:0;status:0;help:0;dialogWidth:310px;dialogHeight:250px";
	returnValues = window.showModalDialog(url,0,status);
	return false;
}

function ShowConduct()
{
	var url,status;
	var returnValues;
			
	url = "../eshop/econduct/page1.htm";
	status = "scroll:0;resizable:0;status:0;help:0;dialogWidth:305px;dialogHeight:480px";
	win = window.showModalDialog(url,0,status);	
}

function ShowSubMenu() 
{                 
	var obj,srcElement,targetElement;
	var targetId,sid,objId,objId2,status;                 
	var icount,sid_len,index;
	
	icount = 30;
	srcElement = window.event.srcElement;   
		
	if(srcElement.className == "MainMenu") 
	{
		sid = srcElement.id;
		sid_len = sid.length;
		for(i = 1;i < icount;i++)
		{
			targetId = sid + "_" + i; 			      
			obj = document.all(targetId); 	
			if(obj == null) break;	
			
			if(obj.style.display == "none") 
				status = "";
			else 
				status = "none";
				
			obj.style.display = status;
			for(j = 1;j < icount;j++)
			{						
				objId = targetId + "_" + j;
				obj = document.all(objId);
				
				if(obj == null) break;
					
				obj.style.display = status;	
			}
		}
		
		//隱藏其它選單			
		for(i = 1;i < icount;i++)
		{		
			obj = document.all("Menum" + i + "_1");
			if(obj == null) break;
			
			for(j = 1;j < icount;j++)
			{
				objId = "Menum" + i + "_" + j;
				obj = document.all(objId);				
				if(obj == null) break;			
							
				if(objId.substr(0,sid_len) != sid)
				{
					obj.style.display = "none";					
					for(k = 1;k < icount;k++)
					{						
						objId2 = objId + "_" + k;
						obj = document.all(objId2);
						
						if(obj == null) break;
							
						obj.style.display = "none";	
					}
				}	
			}	
				
		}
	}	
}

function RedirectClass(class2ID)
{		
	var url;
	
	url = "../product/productclass.aspx?Class2ID=" + class2ID;
	location.href(url);
}
