function trim(value) {
    return value.replace(/(^\s*)|(\s*$)/g, "");
}

function chbg(v){	
	
	for (var i=1;i<=7 ;i++)
	{
		var tmpObj="tag"+i;	
			
		if ($(tmpObj).className=="onSel"&&i!=v)
			{
				$(tmpObj).className="offSel";
				$("Ptag"+i).className="black12";
			}		
	}
	if ($("tag"+v).className!="onSel")
	{
		$("tag"+v).className="onSel";	
		
	}
	if ($("Ptag"+v).className!="white12")
	{
		
		$("Ptag"+v).className="white12";
	}
	tag(v);
	
	return false;
}

function new_chbg(v){	
	
	for (var i=1;i<=5 ;i++)
	{
		var tmpObj="tag"+i;	
			
		if ($(tmpObj).className=="menu01"&&i!=v)
			{
				$(tmpObj).className="menu02";
				$("Ptag"+i).className="yellow14";
			}		
	}
	if (v!=1)
	{
			$("tag1").className="menu02";
			$("Ptag1").className="yellow";

	}
	if ($("tag"+v).className!="menu01")
	{
		$("tag"+v).className="menu01";	
		
	}
	if ($("Ptag"+v).className!="white01")
	{
		
		$("Ptag"+v).className="white01";
	}
	newtag(v);
	
	return false;
}


function subKey(v){
	$("topKey").value=v;
	$("searchForm").target="_self";
	$("searchForm").method="Post";
	$("searchForm").action=$("ActionGetURL").value+JS_UrlEncode($("topKey").value).replace(/%/g,"_")+".html";
	$("searchForm").submit();
	$("topKey").value="";
	return false;

}
//搜索表单
var num=7;
function tag(id){
	if (id==1){		
		$("snt").value=id;
		$("ActionGetURL").value=="http://www.7e88.cn/b2bsearch.asp?ct=15&xt=xpg&kw=";
	}else if (id==2){		
		$("snt").value=id;
		$("ActionGetURL").value="http://www.7e88.cn/b2bsearch.asp?ct=15&xt=xpg&kw=";
	}else if (id==3){
		$("snt").value=id;
		$("ActionGetURL").value="http://www.7e88.cn/b2bsearch.asp?ct=15&xt=xpg&od=pro&kw=";
	}else if (id==4){
		$("snt").value=id;		
	$("ActionGetURL").value="http://www.7e88.cn/cmpSearch.asp?ct=15&xt=xpg&kw=";
	}else if (id==5){
		$("snt").value=id;
		$("ActionGetURL").value="http://www.7e88.cn/newsSearch.asp?ct=20&xt=xpg&cid=1&ncd=20&kw=";
	}else if (id==6){
		$("snt").value=id;	
		//searchform.action="http://www.veryjob.cn/searchPer.asp";
		$("ActionGetURL").value="http://www.veryjob.cn/searchPer.asp?ct=15&xt=xpg&kw=";
		
		//alert('此此项功能暂未开通!');
		return false;
	}else if (id==7){
		$("snt").value=id;	
		//searchform.action="http://www.veryjob.cn/searchJob.asp";
		$("ActionGetURL").value="http://www.veryjob.cn/searchJob.asp?ct=15&xt=xpg&kw=";
		
		//alert('此此项功能暂未开通!');
		return false;
	}
}

function newtag(id){
	
	if (id==2){		
		
		$("ActionGetURL").value="http://search.7e88.cn/search/";
	}else if (id==3){
		
		$("ActionGetURL").value="http://search.7e88.cn/search/";
	}else if (id==4){
		
		$("ActionGetURL").value="http://search.7e88.cn/cmpSearch/";		
	}else if (id==5){
		
		$("ActionGetURL").value="http://search.7e88.cn/newsSearch/";
	}
}

function searchformsubmit(theForm,kw){	
	if ($(kw).value == "" ||$(kw).value == null)
	{
		alert("请输入查询内容！");
		$(kw).focus();
		return false;
	}
	if ($(kw).value == "请输入产品关键字"){
		alert("请输入查询内容！");
		$(kw).focus();
		return false;	
	
	}
	
	$(theForm).target="_self";
	$(theForm).method="post";
	//$(theForm).action=$("ActionGetURL").value+$(kw).value+"&snt="+$("snt").value;
	$("searchForm").action=$("ActionGetURL").value+JS_UrlEncode($(kw).value).replace(/%/g,"_")+".html";
	
	$(theForm).submit();
	return false;
}

function new_searchformsubmit(theForm,kw){	
	if ($(kw).value == "" ||$(kw).value == null)
	{
		alert("请输入查询内容！");
		$(kw).focus();
		return false;
	}
	if ($(kw).value == "请输入产品关键词"){
		alert("请输入查询内容！");
		$(kw).focus();
		return false;	
	
	}
	
	$(theForm).target="_self";
	$(theForm).method="post";
	$(theForm).action=$("ActionGetURL").value+JS_UrlEncode($(kw).value).replace(/%/g,"_")+".html";
	
	$(theForm).submit();
	return false;
}


function newsSearchFormSubmit(theForm,skw,actionURL){	
	
	if (trim($(skw).value) == "" ||trim($(skw).value) == null)
	{
		alert("请输入查询内容！");
		$(skw).focus();
		return false;
	}
	if ($(skw).value == "请输入产品关键字"){
		alert("请输入查询内容！");
		$(skw).focus();
		return false;	
	
	}
	$(theForm).target="_self";
	$(theForm).method="post";	
	$(theForm).action=$(actionURL).value+$(skw).value;		
	$(theForm).submit();
	return false;
}


function bottomFormSubmit(theForm,kw){	
	if ($(kw).value == "" ||$(kw).value == null)
	{
		alert("请输入查询内容！");
		$(kw).focus();
		return false;
	}
	if ($(kw).value == "请输入产品关键字"){
		alert("请输入查询内容！");
		$(kw).focus();
		return false;	
	
	}
	$(theForm).target="_self";
	$(theForm).method="post";
	$(theForm).action=$("ActionGetURLbot").value+JS_UrlEncode($(kw).value).replace(/%/g,"_")+".html";
	
	$(theForm).submit();
	return false;
}
function searchnt(v){
	
	switch(v)
		{
		case 1:			
		 $('searchNT').innerHTML="商机信息"; break;
		case 2:
		 $('searchNT').innerHTML="商机信息"; break;
		case 3:
		 $('searchNT').innerHTML="产品信息"; break;
		case 4:
		 $('searchNT').innerHTML="企业库"; break;
		case 5:
		 $('searchNT').innerHTML="新闻资讯"; break;
		
		
	}

}

function bottomtag(v){
	
	if (v==3){
		
		$("ActionGetURLbot").value="http://search.7e88.cn/search/";
		
	}else if (v==4){
		$("ActionGetURLbot").value="http://search.7e88.cn/search/";		
		
		
	}else if (v==5){		
		
		$("ActionGetURLbot").value="http://search.7e88.cn/cmpSearch/";
		
	}else if (v==6){	
	
		$("ActionGetURLbot").value="http://search.7e88.cn/newsSearch/";
		
	}	

}
function changesutb(v){
	switch(v)
		{
		case 3:			
		 $('Submit').value="找商机"; break;
		case 4:
		 $('Submit').value="找产品"; break;
		case 5:
		 $('Submit').value="找企业"; break;
		case 6:
		 $('Submit').value="找新闻"; break;		
		
		
	}

}
function bottomchbg(v){
	
	for (var i=3;i<=6 ;i++){
		
		if ($("btag"+i).className=="onsel"&&i!=v)
			{
				
				$("btag"+i).className="offsel";
				if (i!=3)
				{
					//$("b_tag"+i).style.display="block";
				}
				
			}
	}
	if ($("btag"+v).className!="onsel")
	{
		//$("b_tag"+v).style.display="none";
		$("btag"+v).className="onsel";
	}
	bottomtag(v);
	changesutb(v);
	return false;

}
function top1chbg(v){	
	for (var i=3;i<=6 ;i++){
		
		if ($("btag"+i).className=="onsel"&&i!=v)
			{				
				$("btag"+i).className="offsel";
				if (i!=3)
				{
					$("b_tag"+(i-1)).style.display="block";	
				}
				
				$("b_tag"+i).style.display="block";				
			
			}
	}
	if ($("btag"+v).className!="onsel")
	{
		if (v!=3)
			{
				
				$("b_tag"+(v-1)).style.display="none";
			}
		
		$("b_tag"+v).style.display="none";
		$("btag"+v).className="onsel";
		
		
			
		
	}
	bottomtag(v);	
	return false;
	
}

function JS_UrlEncode(str){ 
   var ret=""; 
   var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
   for(var i=0;i<str.length;i++){ 
	var chr = str.charAt(i);      
	 var c=str2asc(chr);	 
     if(parseInt("0x"+c) > 0x7f){ 
       ret+="%"+c.slice(0,2)+"%"+c.slice(-2); 
     }else{ 
       if(chr==" ") 
         ret+="+"; 
       else if(strSpecial.indexOf(chr)!=-1) 
         ret+="%"+c.toString(16); 
       else 
         ret+=chr; 
     } 
   } 
   return ret; 
}
