﻿function $(x) {
  if (typeof x == "string") 
  return document.getElementById(x);
  return x;
  }
function newsshow(i){
if(i==1)
{
	$("news1").style.display='';
	$("news2").style.display='none';
	$("news3").style.display='none';
	$("li1").className="company_title_v";
	$("li2").className="company_title_l";
	$("li3").className="company_title_l";
}
else if(i==2)
{
	$("news1").style.display='none';
	$("news2").style.display='';
	$("news3").style.display='none';
	$("li1").className="company_title_l";
	$("li2").className="company_title_v";
	$("li3").className="company_title_l";
}
else
{
	$("news1").style.display='none';
	$("news2").style.display='none';
	$("news3").style.display='';
	$("li1").className="company_title_l";
	$("li2").className="company_title_l";
	$("li3").className="company_title_v";
}
}

function searchTypeHide(i)
{
	if( i==1 )
	{
		$("divsearchtype").className="search_left_x";
	}
	else if( i==2 )
	{
		$("divsearcharea").className="search_right_x";
	}
}

function searchTypeHide1()
{
		$("divsearchtype").className="m_search_left_x1";
}
//鼠标经过事件
function changeli1 (tdid){
		tdid.style.backgroundColor = "#99CCFF";
	}
	//鼠标离开事件
	function changeli2(tdid){
		tdid.style.backgroundColor = "";
	}
function setSearchTypeValue(i,j)
{
	$("divsearchtypename").innerHTML=i;
	$("typecode").value=j;
	$("divsearchtype").className="search_left_x1";
}
function setSearchTypeValue1(i,j)
{
	$("divsearchtypename").innerHTML=i;
	$("type").value=j;
	$("divsearchtype").className="m_search_left_x";
}
function changeCity(i,j)
{
		$("divareacode").innerHTML=i;
	$("areacode").value=j;
	$("divsearcharea").className="search_right_x1";
}
function closeCity()
{
	$("divsearcharea").className="search_right_x1";
}
function checkdata(){
		var str = $("textsearch").value; 
		var regu = "^[0-9a-zA-Z\u4e00-\u9fa5]+$";   
		var re = new RegExp(regu);
		//if(str!=null && str!="") {str = str.toLowerCase(str);}
		if(str=="" || str==null){
			alert("请输入搜索关键字！");
			$("textsearch").value = "";
			$("textsearch").focus();
		}
		
		else if (!re.test(str) && str!=null && str!='') {
			$("textsearch").value = "";
			alert("只能输入字母、数字及中文！");
			$("textsearch").focus();
		}
		else {
			$("form1").action = "http://"+$("areacode").value+".tzjie.com/search.php?type="+$("typecode").value+"&keys="+str;
			document.form1.submit();
		}
	}
function userlogin()
{
	document.form2.submit();
}
function selectKeyword(i)
{
	$("textsearch").value=i;
}	

