function SearchClick(which)
{
  if (which==1)
  {  
    document.SearchFrm.jobtype.disabled=false;
    document.SearchFrm.jobregion.disabled=false;
	document.getElementById("searchkey").name='jobname';
	document.getElementById("searchkey").value='输入职位名称关键词';
    document.SearchFrm.action='/person/personjobsearch_list.asp?whichfile=6.2';
  }
  if (which==2)
  {  
    document.SearchFrm.jobtype.disabled=true;
    document.SearchFrm.jobregion.disabled=true;
	document.getElementById("searchkey").name='companyname';
	document.getElementById("searchkey").value='输入公司名称关键词';
    document.SearchFrm.action='/person/personjobsearch_5_submit.asp';
  }
}

function CheckSearchForm(theform)
{
  if (document.SearchFrm.keytype[0].checked==true)
  {
    if (document.getElementById("searchkey").value=='输入职位名称关键词')
	{
	  document.getElementById("searchkey").value='';
	}
  }
  else
  {
    if ((document.getElementById("searchkey").value=='输入公司名称关键词')||(document.getElementById("searchkey").value==''))
	{
      alert("请输入公司名称关键字!");
      mobj = document.getElementById("searchkey");
      mobj.focus();
      return false;
    }  
  }
}

function SetDefaultText()
{
  if ((document.SearchFrm.keytype[0].checked==true)&&(document.getElementById("searchkey").value==''))
  {
	document.getElementById("searchkey").value='输入职位名称关键词';
  }
  if ((document.SearchFrm.keytype[1].checked==true)&&(document.getElementById("searchkey").value==''))
  {
	document.getElementById("searchkey").value='输入公司名称关键词';
  }
}

function fillwebgroup(p){
	var obj=$("nav_select");
	tmpstr="";
	obj.innerHTML="";
	for(var i=0;i<region.length;i++){
  	obj.options.add(new Option(region[i][1],"http://www."+region[i][0]+".com")); 
		if(region[i][1]==p)obj.options[i].selected=1;
	}
}

function fillStation(p){
	var str="";
	for(var i=0;i<region.length;i++){
		str += "<li"
		if(region[i][1]==p)
			str += " style=\"font-weight:bold\"";
		str += "><a style='cursor:pointer' onclick=\"goto('" + region[i][0] + "')\">" + region[i][1] + "</a>";
	}
	$("station_text_ul").innerHTML=str;
}

function goto(url){
	$("station").style.display="none";
	document.location = "http://www." + url + ".com";
}

function showrecommend(){
	var tmpary1;
	var tmpary2;
	for(var i=0;i<tmpstr1.length;i++){
		tmpary1=tmpstr4[i].split("!");
		tmpary2=tmpstr5[i].split("!");
		tmpstr="<ul><li class=\"main_left_li\"><a href=\"\/person\/companys.asp?companyid="+tmpstr1[i]+"\">"+tmpstr2[i]+"</a>&nbsp;["+tmpstr3[i]+"]<\/li><li class=\"main_left_li1\">";
		for(var j=0;j<tmpary1.length;j++){
			tmpstr=tmpstr+"<a href=\"/person/jobs.asp?jobid="+tmpary1[j]+"\" class=\"ls12hui\">"+tmpary2[j]+"</a>&nbsp;";
		}
		tmpstr=tmpstr+"</li></ul>";
		document.write(tmpstr);
		if(i==11 || i==23){
			document.write("<div class=\"main_left_line\"></div>");
		}
	}
	for(var i=tmpstr1.length;i<34;i++){
		tmpstr="<ul><li class=\"main_left_li\" style=\"background:none\">&nbsp;</li><li class=\"main_left_li1\">&nbsp;</li></ul>";
		document.write(tmpstr);
		if(i==11 || i==23){
			document.write("<div class=\"main_left_line\"></div>");
		}
	}
}

function showhot(){
	tmpstr="";
	for(var i=0;i<tmpstr1.length;i++){
		tmpstr="<li class=\"top_text_li";
		if(i %3==1)tmpstr=tmpstr+"1";
		tmpstr=tmpstr+"\"><a href=\"/person/companys.asp?companyid="+tmpstr1[i]+"\">"+tmpstr2[i]+"</a>&nbsp;["+tmpstr3[i]+"]</li>";
		document.write(tmpstr);
	}
	if(tmpstr1.length % 3==1)tmpstr="<li></li><li></li>";
	if(tmpstr1.length % 3==2)tmpstr="<li></li>";
}

function showfrdlink(){
	tmpstr="";
	for(var i=0;i<tmpstr1.length;i++){
		tmpstr="<li onmouseover=\"javascript:this.style.background=fl_overcolor;\" onmouseout=\"javascript:this.style.background=fl_outcolor;\"><a href=\""+ tmpstr1[i] +"\"";
		if(tmpstr2[i]==1){
			tmpstr=tmpstr+" rel=\"nofollow\"";
		}
		tmpstr=tmpstr+">"+tmpstr3[i]+"</a></li>"
		document.write(tmpstr);
	}
	for(var i=0;i<tmpstr1.length %8;i++){
		document.write("<li></li>");
	}			
}


function address_Selected(e)
{
	var ev = window.event|| e;
   	if(ev.keyCode==27)
	{
		openBg(0);
		openSelect(0,'selectAddress',null);
	}
	if( 13 == ev.keyCode )
	{
		transAddress();
	}
}

function showCity(cid,cname,ctype){
	$("divcity").innerHTML = "";
	getCity(cid,cname,ctype);

	if(ctype==0){
		var url = "library/getCity.asp?cid=" + escape(cid);
		xmlHttp.open("GET", url, true);
		xmlHttp.onreadystatechange = updateCityType;
		xmlHttp.send(null);
	}
}

function getCity(cid,cname,ctype){
	$("previewItem").innerHTML = "<label id='input'>"+ cname +"</label>";
	$("tmpjiguan").value=cid;
	if(ctype==1){
		transAddress();
	}
}

function transAddress(){
	openBg(0);
	openSelect(0,'selectAddress',null);
	copyAddress()	
}

function copyAddress(){
	var id1="previewItem";
	var mes = "";
	var items2 = $(id1).getElementsByTagName("label");
	for(var i = 0 ; i < items2.length ; i++)
	{
		if(items2[i].value!='')
		{
			mes=items2[i].innerHTML;
			break;		
		}
	}
	$("cjobregion").value=mes;
	$("jobregion").value=$("tmpjiguan").value;
}

function updateCityType() {
  	if (xmlHttp.readyState ==4) {
		$("divcity").innerHTML = xmlHttp.responseText;
  	}
}

function getTop(obj,offset)
{
	var y = obj.offsetTop;
	while (obj = obj.offsetParent) y += obj.offsetTop;
	return y+offset;
}

function getLeft(obj,dwidth,offset) 
{
	var x = obj.offsetLeft;
	while (obj = obj.offsetParent) x += obj.offsetLeft;
	var wwidth=document.body.clientWidth;
	if(wwidth<800)wwidth=800;
	dwidth=wwidth-dwidth;
	if(x>dwidth)x=dwidth
	return x+offset;
}

function showpost(jid){
	var pl=0;
	if(jid==99){
		$("jobtype").value=jid;	
		$("jobtype_name").value="其他";
		closepostdetail();
		openBg(0);
		openSelect(0,'selectJob',null);
	}else{
		var obj=$("li"+jid);
		var layer=$("postdetail");
		var y=getTop(obj,5);
		var x=getLeft(obj,10,40);
		layer.style.display = "block";
		if(isIE){x = event.clientX;}
		mouseinpostdetail=0;
		showjid=jid;
		for(var i=1;i<30;i++){
			$("lbl"+i).innerHTML="0";
			$("l"+i).style.display="none";
		}
		var loct=-1;
		for(var i=0;i<post_v.length;i++){
			if(post_v[i]==jid){
				loct=i;
			}
		}
		if(loct>-1){
			if(subpost_s[loct].length>9){
				$("posttext3").style.width="345px"
				$("l1").style.width="325px";
				if(x+350>document.body.clientWidth){
					x=document.body.clientWidth-350;
				}
				pl=(subpost_s[loct].length+1)*10.5+2;
			}else{
				$("posttext3").style.width="175px"
				$("l1").style.width="155px";
				if(x+180>document.body.clientWidth){
					x=document.body.clientWidth-180;
				}
				pl=(subpost_s[loct].length+1)*21+2;
			}
			$("l1").style.display="block";
			$("l1").style.cursor="pointer";
			$("l1").innerHTML="(全部)"+post_s[loct]+"类";
			$("lbl1").innerHTML=post_v[loct];
			for(var i=0;i<subpost_s[loct].length;i++){
				j=i+2;
				$("l"+j).style.display="block";
				$("l"+j).innerHTML=subpost_s[loct][i];
				$("lbl"+j).innerHTML=subpost_v[loct][i];
			}
		}
		var maxl=$("selectJob").offsetHeight+$("selectJob").offsetTop;
		if(maxl<document.body.scrollHeight){maxl=document.body.scrollHeight;}
		if(pl+y>maxl){
			y =(y+5-pl);
		}
		if(isIE){
			layer.style.left =x;
			layer.style.top =y;
		}else{
			layer.style.left =x+"px";
			layer.style.top =y+"px";
		}			
		layer.focus();
	}
}

function highbright(jid,zt,bc){
	if(zt==1){
		$("li"+jid).style.backgroundColor=postbkcolor;
		$("li"+jid).style.color="#FFFFFF";
		$("li"+jid).style.fontWeight="bold";
	}else{
		if(bc==1){
			$("li"+jid).style.backgroundColor="#FFFFFF";
		}
		else{
			$("li"+jid).style.backgroundColor="#f6f5f4";
		}
		$("li"+jid).style.color="#000000";
		$("li"+jid).style.fontWeight="";
	}
}

function subhighbright(jid,zt){
	if(zt==1){
		$("l"+jid).style.backgroundColor=postbkcolor;
		$("l"+jid).style.color="#FFFFFF";
		$("l"+jid).style.fontWeight="bold";
	}else{
		$("l"+jid).style.backgroundColor=postforecolor;
		$("l"+jid).style.color="#000000";
		if(jid>1)$("l"+jid).style.fontWeight="";
	}
}

function closepostdetail(){
	$("postdetail").style.display="none";
	mouseinpostdetail=0;
}

function moveinpostdetail(){
	mouseinpostdetail=1;
}

function confirmpost(obj){
	var o=obj.id;
	o=o.replace("l","lbl");
	var retid=$("postreturnid").innerHTML;
	$(retid).value=$(o).innerHTML;	
	retid=$("postreturnname").innerHTML;
	$(retid).value=obj.innerHTML;
	$("lbljobselected").innerHTML=obj.innerHTML;
	closepostdetail();
	openBg(0);
	openSelect(0,'selectJob',null);
}

function postnolimit(jid,jname){
	var retid=$("postreturnid").innerHTML;
	$("jobtype").value=jid;	
	retid=$("postreturnname").innerHTML;
	$(retid).value=jname;
	$("lbljobselected").innerHTML=jname;
	openBg(0);
	openSelect(0,'selectJob',null);
}

function setpostreturn(pid,pname){
	$("postreturnid").innerHTML=pid;
	$("postreturnname").innerHTML=pname;
	$("lbljobselected").innerHTML=$(pname).value;
}

function setnolimit(b){
	if(b==0){
		$("post_text_title2").style.display="none";
	}else{
		$("post_text_title2").style.display="";
	}
}

function fillpostdiv(){
	tmpstr="<div id=\"post_text_title1\">已选职位：<label id=\"lbljobselected\"></label></div><div id=\"post_text_title2\">&nbsp;<font onclick=\"postnolimit('0000','不限')\" style=\"cursor:pointer;\">不限制职位选择</font></div><div class=\"clear\"></div>";
	for(var i=0;i<post_group.length;i++){
		tmpstr=tmpstr+"<div class=\"post_1\" style=\"padding-top:"+post_group[i][1]+"px;height:"+post_group[i][2]+"px;line-height:16px;";
		if(i % 2 == 0){
			tmpstr=tmpstr+"background-color:#f6f5f4;\">"+post_group[i][0]+"</div><ul class=\"post_2\">";
		}else{
			tmpstr=tmpstr+"\">"+post_group[i][0]+"</div><ul class=\"post_3\">";
		}
		for(var j=post_group_region[i][0];j<=post_group_region[i][1];j++){
			tmpstr=tmpstr+"<li id=\"li"+post_v[j]+"\" onclick=\"showpost('"+post_v[j]+"');\" onmousemove=\"highbright("+post_v[j]+",1,0)\" onmouseout=\"highbright("+post_v[j]+",0,"+(i % 2)+")\">"+post_s[j]+"</li>";
		}
		tmpstr=tmpstr+"</ul><div class=\"clear\"></div>";
	}
	$("post_text").innerHTML=tmpstr;
}

function fillpost(){
	fillpostdiv();
	tmpstr="<li style=\"font-weight:bolder\" id=\"l1\" onmousemove=\"subhighbright(1,1)\" onmouseout=\"subhighbright(1,0)\" onclick=\"confirmpost(this)\"></li>";
	for(var i=2;i<31;i++){
		tmpstr=tmpstr + "<li id=\"l"+i+"\" onmousemove=\"subhighbright("+i+",1)\" onmouseout=\"subhighbright("+i+",0)\" onclick=\"confirmpost(this)\" style=\"cursor:pointer\"></li>";
	}
	$("posttext3").innerHTML=tmpstr;
	tmpstr="";
	for(var i=1;i<31;i++){
		tmpstr=tmpstr+"<label id=\"lbl"+i+"\">0</label>";
	}
	tmpstr=tmpstr+"<label name=\"postreturnid\" id=\"postreturnid\"></label><label id=\"postreturnname\" name=\"postreturnname\"></label>";
	$("postlabel").innerHTML=tmpstr;
}

function filladdress(){
	var icount=0;
	tmpstr=""
	for(var i=0;i<x.length;i++){   
		if(x[i].length<3){
			tmpstr=tmpstr+"<li onmouseover=\"javascript:this.style.background=postbkcolor;this.style.color='#ffffff';\" onmouseout=\"javascript:this.style.background='#ffffff';this.style.color='#000000';\" onDblClick=\"transAddress()\" onclick=\"showCity(" + x[i] +",'" + p[i] +"'," + x1[i] +");\">"+ p[i] +"</li>";
			icount++;
		}
	}
	$("city_text_ul").innerHTML=tmpstr;
}

function filllogo(){
	tmpstr="";
	for(var i=0;i<logostr1.length;i++){
		tmpstr=tmpstr+"<a href=\"/person/companys.asp?companyid="+logostr1[i]+"\"><img src=\"http://downloads.51rc.com/imagefolder/companylogo/"+logostr2[i]+"\" alt=\""+logostr3[i]+"\"></a>";
	}
	$("logo").innerHTML=tmpstr;
}
