﻿//全站顶部搜索验证
function checktopsearch()
{
        if (Jtrim(document.topsearchform.keyword.value)=='' || Jtrim(document.topsearchform.keyword.value)=='请输入查询关键字') {
                window.alert ("请输入查询关键字！");
				document.topsearchform.keyword.value="";
	            document.topsearchform.keyword.focus();
                return false;
        }
        return true
}
function enchecktopsearch()
{
        if (Jtrim(document.topsearchform.keyword.value)=='' || Jtrim(document.topsearchform.keyword.value)=='enter a query keyword') {
                window.alert ("Please enter a query keyword!");
				document.topsearchform.keyword.value="";
	            document.topsearchform.keyword.focus();
                return false;
        }
        return true
}


//网站首页验证登陆框函数02
function checkindexmemberlogin02()
{
        if (Jtrim(document.indexloginform.username.value)=='') {
                window.alert ("请输入您的会员名 ！");
	            document.indexloginform.username.focus();
                return false;
        }
	    if (!isusername(document.indexloginform.username.value)){
	       document.indexloginform.username.focus();
           return false;
        }
		if (Jtrim(document.indexloginform.username.value).length<5||Jtrim(document.indexloginform.username.value).length>20) {
            window.alert ("您的会员名需大于4位且不能超过20位！")
	        document.indexloginform.username.focus();
            return false;
        }
        if (Jtrim(document.indexloginform.password.value)=='') {
                window.alert ("请输入您的密码 ！");
	            document.indexloginform.password.focus();
                return false;
        }
        if (Jtrim(document.indexloginform.password.value).length<6||Jtrim(document.indexloginform.password.value).length>20) {
                window.alert ("您的密码需大于5位且不能超过20位！");
	            document.indexloginform.password.focus();
                return false;
        }
        return true
}



//网站首页验证登陆框函数
function checkindexmemberlogin()
{
        if(!document.indexloginform.UserType[0].checked&&!document.indexloginform.UserType[1].checked){
                window.alert ("请选择会员类型！");
                return false;
        }
        if (Jtrim(document.indexloginform.username.value)=='') {
                window.alert ("请输入您的会员名 ！");
	            document.indexloginform.username.focus();
                return false;
        }
	    if (!isusername(document.indexloginform.username.value)){
	       document.indexloginform.username.focus();
           return false;
        }
		if (Jtrim(document.indexloginform.username.value).length<5||Jtrim(document.indexloginform.username.value).length>20) {
            window.alert ("您的会员名需大于4位且不能超过20位！")
	        document.indexloginform.username.focus();
            return false;
        }
        if (Jtrim(document.indexloginform.password.value)=='') {
                window.alert ("请输入您的密码 ！");
	            document.indexloginform.password.focus();
                return false;
        }
        if (Jtrim(document.indexloginform.password.value).length<6||Jtrim(document.indexloginform.password.value).length>20) {
                window.alert ("您的密码需大于5位且不能超过20位！");
	            document.indexloginform.password.focus();
                return false;
        }
        if (Jtrim(document.indexloginform.CheckCode.value)=='') {
    		  alert("请输入验证码！");        
    		  document.indexloginform.CheckCode.focus();        
    		  return (false);        
   		 } 
		if (strlength(Jtrim(document.indexloginform.CheckCode.value))!= 6){
			alert("验证码输入不正确，请返回调整！");
	        document.indexloginform.CheckCode.focus();
			return false;
		}
        return true
}

//资讯中心评论验证函数current
function CheckComment()
{   
		if (Jtrim(document.commentform.Content.value)==""){
			alert("评论内容不能为空！");
	        document.commentform.Content.focus();
			return false;
		}
		if (strlength(Jtrim(document.commentform.Content.value))<2){
			alert("评论内容不能少于2字符或1汉字，请返回调整！");
	        document.commentform.Content.focus();
			return false;
		}
		if (strlength(Jtrim(document.commentform.Content.value))>1000){
			alert("评论内容限500汉字或1000字符，请返回调整！");
	        document.commentform.Content.focus();
			return false;
		}
        if (Jtrim(document.commentform.CheckCode.value)=='') {
    		  alert("请输入验证码！");        
    		  document.commentform.CheckCode.focus();        
    		  return (false);        
   		 } 
		if (strlength(Jtrim(document.commentform.CheckCode.value))!= 6){
			alert("验证码输入不正确，请返回调整！");
	        document.commentform.CheckCode.focus();
			return false;
		}
	document.commentform.submit();
}

//分类信息留言评论验证函数current
function CheckFenLeiGuestBook()
{   
		if (Jtrim(document.fenleiguestbook.Content.value)==""){
			alert("留言内容不能为空！");
	        document.fenleiguestbook.Content.focus();
			return false;
		}
		if (strlength(Jtrim(document.fenleiguestbook.Content.value))<20){
			alert("留言内容不能少于10汉字或20字符，请返回调整！");
	        document.fenleiguestbook.Content.focus();
			return false;
		}
		if (strlength(Jtrim(document.fenleiguestbook.Content.value))>2000){
			alert("留言内容限1000汉字或2000字符，请返回调整！");
	        document.fenleiguestbook.Content.focus();
			return false;
		}
        if (Jtrim(document.fenleiguestbook.CheckCode.value)=='') {
    		  alert("请输入验证码！");        
    		  document.fenleiguestbook.CheckCode.focus();        
    		  return (false);        
   		 } 
		if (strlength(Jtrim(document.fenleiguestbook.CheckCode.value))!= 6){
			alert("验证码输入不正确，请返回调整！");
	        document.fenleiguestbook.CheckCode.focus();
			return false;
		}
	document.fenleiguestbook.submit();
}


//搜索验证函数current
function placehoder(){
	var keyword=Jtrim(document.searchform.keyword.value);
	var stype=Jtrim(document.searchform.stype.value);
	if(keyword==''){
		window.alert ("请输入搜索关键词！");
		document.searchform.keyword.focus();
		return false;
	} 
	if(stype==''||stype=='0'){
		window.alert ("请输入搜索类型！");
		document.searchform.stype.focus();
		return false;
	} 
	if(stype=='1'){
		document.searchform.action="/fenlei/search.asp?keyword="+keyword+"&stype="+stype;
	}else if(stype=='2'){
		document.searchform.action="/store/search.asp?keyword="+keyword+"&stype="+stype;
	}else if(stype=='3'){
		document.searchform.action="/info/search.asp?keyword="+keyword+"&stype="+stype;
	}else{
			return false;
	}
	return true
} 


//搜索验证函数
<!--
function baitongsearch()
{
var KeyWord=formsearch.KeyWord.value
if(formsearch.KeyWord.value=="在此输入查询关键词")
{
	alert("请输入您要查询的关键字!");
	return false;
}
if(formsearch.KeyWord.value=="")
{
	alert("请输入您要查询的关键字!");
	return false;
}
}
//-->


//全站搜索
<!--
function baitongallsitesearch()
{
var SearchArea=document.baitongsearch.SearchArea.value
var KeyWord=document.baitongsearch.KeyWord.value

if(document.baitongsearch.SearchArea.value==""||document.baitongsearch.SearchArea.value=="0")
{
	alert("请选择搜索区域!");
	return false;
}
if(document.baitongsearch.KeyWord.value=="输入查询关键字")
{
	alert("请输入您要查询的关键字!");
	return false;
}
if(document.baitongsearch.KeyWord.value=="")
{
	alert("请输入您要查询的关键字!");
	return false;
}
//资讯搜索
//if(document.baitongsearch.SearchArea.value=="0"){
//	document.baitongsearch.action="http://www.chinaz.com/plus/search.php?keyword="+KeyWord+"";
//	document.baitongsearch.submit();
//}
//商机搜索
if(document.baitongsearch.SearchArea.value=="1")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="2")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="3")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="4")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="5")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="6")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
if(document.baitongsearch.SearchArea.value=="7")
location.href="/Trade/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
//产品展示搜索
if(document.baitongsearch.SearchArea.value=="8")
location.href="/Product/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
//企业会员搜索
if(document.baitongsearch.SearchArea.value=="9")
location.href="/Company/search.asp?SearchArea="+SearchArea+"&keyword="+KeyWord+"";
return false;
}
//-->



//切换代码函数开始
var isIE = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
var GO = function(elemId){
	if(document.getElementById){
		return document.getElementById(elemId);
	}else if(document.layers){
		document.layers[elemId];
	}else{
		return eval('document.all.' + elemId);
	}
}
function Menu(mid,idx){
	for(var i=0;i<10;i++){
		if(!GO("m_"+mid+"_"+i)) break;
		GO("m_"+mid+"_"+i).className = "menuOff";
		GO("c_"+mid+"_"+i).style.display = "none";
	}
	GO("m_"+mid+"_"+idx).className = "menuOn";
	GO("c_"+mid+"_"+idx).style.display = "block";
}
//切换代码函数结束





  function showdiv(divnum,divbefor,id){
	for(i=1;i<=divnum;i++){
		try{
			if(i==divbefor){
				document.getElementById(id+i).style.display="inline";
			}else{
				document.getElementById(id+i).style.display="none";
			}
		}catch(e){ }
	}
}



function correctPNG()  
{ 
for(var i=0; i<document.images.length; i++) 
{ 
  var img = document.images[i] 
  var imgName = img.src.toUpperCase() 
  if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
  { 
   var imgID = (img.id) ? "id='" + img.id + "' " : "" 
   var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
   var imgStyle = "display:inline-block;" + img.style.cssText  
   if (img.align == "left") imgStyle = "float:left;" + imgStyle 
   if (img.align == "right") imgStyle = "float:right;" + imgStyle 
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle   
   var strNewHTML = "<span " + imgID + imgClass + imgTitle 
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"  
   img.outerHTML = strNewHTML 
   i = i-1 
  } 
} 
} 
window.attachEvent("onload", correctPNG);
