// JavaScript Document
	function goSubCategory(){
		if (document.form2.cmbClientName.options.selectedIndex>0){
			var path	="catalog.asp?catid="+document.form2.cmbClientName.options[document.form2.cmbClientName.options.selectedIndex ].value + "&"+document.form2.cmbClientName.options[document.form2.cmbClientName.options.selectedIndex ].title;
			document.location.href=path;			
		}
	}
	function goSearch(){
	    var  itemPath="";
		var btype			=	"search";		
		var cmbSelectBy		=	document.frmSearch.cmbSelectBy.value;	
		
		var txtItemName		=	document.frmSearch.txtItemName.value;	
		var txtCatName		=	document.frmSearch.txtCatName.value;				
		var txtCatId		=	document.frmSearch.txtCatId.value;		
		var txtbrandName	=	document.frmSearch.txtbrandName.value;
		var txtgroupName	=	document.frmSearch.txtgroupName.value;	
		var str				=	"";
		
		if ((txtItemName.length==0)&&(txtCatName.length==0)){
			alert("Please enter a keyword.");
			document.frmSearch.txtItemName.focus();
		}else{
//			if (cmbSelectBy=="2"){
//				if (txtCatId.length>0){
//					str	=	str	+	"?catid=" + txtCatId;
//					if (btype.length>0){
//						str	=	str	+	"&btype=" + btype;
//					}
//					if (txtItemName.length>0){
//						str	=	str	+	"&itemName=" + txtItemName;
//					}
//					if (txtCatName.length>0){
//						str	=	str	+	"&catName=" + txtCatName;
//					}
//					if (txtbrandName.length>0){
//						str	=	str	+	"&brandName=" + txtbrandName;
//					}
//					if (txtgroupName.length>0){
//						str	=	str	+	"&group=" + txtgroupName;
//					}
//					
//					itemPath="/catalog/catalog.asp" +	str;
//					
//					//alert(itemPath);
//					
//				}
//				
//			}else{
				if (btype.length>0){
					str	=	str	+	"?btype=" + btype;
				}
				if (txtItemName.length>0){
					str	=	str	+	"&itemName=" + txtItemName;
				}
				if (txtCatName.length>0){
					str	=	str	+	"&catName=" + txtCatName;
				}
				if (txtbrandName.length>0){
					str	=	str	+	"&brandName=" + txtbrandName;
				}
				if (txtgroupName.length>0){
					str	=	str	+	"&group=" + txtgroupName;
				}
					
				itemPath="/catalog/catalog.asp" +	str;
				
				//alert(itemPath);
				
			//}
			
			if (itemPath.length>0){
				document.location.href=itemPath;		 
			}else{
				alert ("Please enter a keyword.");	 
			}
		}//end if
	}
	
	
	function newslatter(){
		var news_name	=	document.form_newslatter.newslatter_name.value;
		var newslatter_email	=	document.form_newslatter.newslatter_email.value;
		if ((news_name=="")||(newslatter_email=="")){
			alert("Please enter your name and email address.");
			document.form_newslatter.newslatter_name.focus();
		}else{
			if (!EmailNewsValidate("newslatter_email","Email","Enter a email address",true)){
				document.form_newslatter.newslatter_name.focus();
			}else{
				document.form_newslatter.submit();
			}
		}
	}	
	
	
	function EmailNewsValidate(fld,fldTitle,caption,rq){
		if (rq==false){
			return(true);
		}
		var fld	=	eval("document.form_newslatter." + fld);
		var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@-_";
		var checkStr = fld.value;
		var allValid = true;
		var_at=false;	
		var_point=false;
		var_start=true;
		var decPoints = 0;
		var allNum = "";
		if ("@"==fld.value.charAt(0)) var_start=false;
		if ("."==fld.value.charAt(0)) var_start=false;
		if ("@"==fld.value.charAt(fld.value.length-1)) var_start=false;
		if ("."==fld.value.charAt(fld.value.length-1)) var_start=false;
		for (j = 0;  j < fld.value.length;  j++)
		  if ("@" == fld.value.charAt(j))
			{
			var_at=true;
			}
		for (j = 0;  j < fld.value.length;  j++)
		  if ("." == fld.value.charAt(j))
			{
			var_point=true;
			}
		
		for (i = 0;  i < checkStr.length;  i++)
		
		{
		
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		
		
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
		if (ch == "@")
		{
		  allNum += "@";
		  decPoints++;
		}
		//    else if (ch != ",")
		//      allNum += ch;
		}
		if (!allValid)
		{
		 fld.focus();
		alert("Please enter a valid email address in the "+fldTitle+" field.");
		return(false);
		}
		if ((var_at==false)||(var_point==false)||(var_start==false))
		{
		  fld.focus();
		alert("Please enter a valid email address in the "+fldTitle+" field.");
		return(false);
		}
		if (decPoints > 1)
		{
		  fld.focus();
			alert("Please enter a Valid Email Address in the "+fldTitle+" field.");
			return(false);
		}
		return(true);
	}  	