﻿// JavaScript Document
//dojo.require("dojo.parser");
//dojo.require("dijit.Dialog");
//dojo.require("dijit.form.NumberSpinner");
//dojo.require("dijit.form.Button");
//dojo.require("dijit.Menu");
//dojo.require("dojo.cookie");
//dojo.require("dijit.form.TextBox");
//dojo.require("dijit.layout.StackContainer");
//dojo.require("dijit.layout.TabContainer");
//dojo.require("dijit.layout.ContentPane");
//dojo.require("dijit.TitlePane");

dojo.addOnLoad(function(){

				dojo.xhrGet({
			   	url:"aaa.html",
				load:function(response){
							job_part.setContent(response);
							dojo.xhrGet({
								url:"shownews.aspx",
								load:function(response){
											news_Content.setContent(response);
											//工作词联想功能
											new autoComplete("keyword",{
											submitBtn:"jobsearch",
											//beforeSubmit:function(val,textbox){return false},
											urltype:"Company",
											suggestAppend:true
										});
										},
								error:function(error){job_part.setContent("加载错误！")}
								});
							//加载bbb.htm(人才)
							dojo.xhrGet({
							url:"bbb.html",
							load:function(response){
										talent_part.setContent(response);
										Job_Search1(1);
										//人才词联想功能
										new autoComplete("talent_keyword",{
										submitBtn:"talentsearch",
										//beforeSubmit:function(val,textbox){return false},
										urltype:"Person",
										suggestAppend:true
									});
									},
							error:function(error){talent_part.setContent("加载错误！")}
							});
						},
				error:function(error){job_part.setContent("加载错误！")}
				});
				
				
						})
//初始化
function chushi()
{
				
				//个人是否登录
				dojo.xhrGet({
			   	url:"default2.aspx?Type=Pol&id="+Math.random().toString(),
				load:function(response){
							if(response.toString()!="False")
							{
								Mylog.selectChild(gr_menu);
								dojo.byId("my_per_name").innerHTML=response.toString();
							}
							
							
						},
				error:function(error){}
				});
				//企业是否登录
				dojo.xhrGet({
			   	url:"default.aspx?Type=Col&id="+Math.random().toString(),
				load:function(response){
							if(response.toString()!="False")
							{
								Mylog.selectChild(qy_menu);
								dojo.byId("my_com_name").innerHTML=response.toString();
							}
							
							
						},
				error:function(error){}
				});
				
				//显示实景
				qh_shijing("1")
}

//翻页
function fanye1(url)
{
	dojo.byId("job_content").innerHTML="数据加载中....";
	dojo.xhrGet({
			   	url:url,
				load:function(response){
							dojo.byId("job_content").innerHTML=response;
							
						},
				error:function(error){dojo.byId("job_content").innerHTML="加载错误！"}
				});
	window.scroll(0,400);
}
function fanye2(url)
{
	dojo.byId("talent_content").innerHTML="数据加载中....";
	dojo.xhrGet({
			   	url:url,
				load:function(response){
							dojo.byId("talent_content").innerHTML=response;
							
						},
				error:function(error){dojo.byId("talent_content").innerHTML="加载错误！"}
				});
	window.scroll(0,400);
}
function gr_log()
{
	var yonghu=dojo.byId("gr_yonghu").value;
	var mima=dojo.byId("gr_mima").value;
	
	
	dojo.xhrGet({
			   	url:"default2.aspx?Type=Plogin&User="+escape(yonghu)+"&Pwd="+escape(mima),
				load:function(response){
							if(response.toString()!="您输入的用户名或密码错误")
							{
								dojo.byId("my_per_name").innerHTML=response;
								alert("登陆成功！");
								Mylog.selectChild(gr_menu);
							}
							else
							{
								alert("登陆失败");
							}
							
						},
				error:function(error){alert("登陆失败")}
				});
}
function qy_log()
{
	var yonghu=dojo.byId("qy_yonghu").value;
	var mima=dojo.byId("qy_mima").value;
	
	dojo.xhrGet({
			   	url:"default2.aspx?Type=Clogin&User="+escape(yonghu)+"&Pwd="+escape(mima),
				load:function(response){
							if(response.toString()!="您输入的用户名或密码错误")
							{
								alert("登陆成功！");
								dojo.byId("my_com_name").innerHTML=response;
								Mylog.selectChild(qy_menu);
							}
							else
							{
								alert("登陆失败");
							}
							
						},
				error:function(error){alert("登陆失败")}
				});
}
function Gr_denglu()
{
	var yonghu=dojo.byId("Gr_yonghu_xx").value;
	var mima=dojo.byId("Gr_mima_xx").value;
	alert(yonghu+mima);
}
function Qy_denglu()
{
	var yonghu=dojo.byId("Qy_yonghu_xx").value;
	var mima=dojo.byId("Qy_mima_xx").value;
	alert(yonghu+mima);
}
function tuichu()
{
	dojo.xhrGet({
			   	url:"default2.aspx?Type=Exit",
				load:function(response){
							
							
						},
				error:function(error){}
				});
	Mylog.selectChild(log_start);
}
function fs_yaoqing()
{
	var yaoqing=dojo.byId("yaoqing").value;
	var yqids=dojo.byId("yqids").innerHTML;
	//发送
			   dojo.xhrGet({
			   	url:"default2.aspx?Type=Cpl&Title=1&JoId=1&PeId="+yqids+"&Con="+escape(yaoqing),
				load:function(response){
							if(response.toString()=="True")
							{
								alert("发送邀请成功！");
							}
							else
							{
								alert("发送邀请失败！");
							}
							
						},
				error:function(error){alert("发送邀请失败")}
				});
	dlg_yaoqing.hide();
}
function get_time()
{
	var date=new Date();
	var year="",month="",day="",week="",hour="",minute="",second="";
	year=date.getFullYear();
	month=add_zero(date.getMonth()+1);
	day=add_zero(date.getDate());
	week=date.getDay();
	switch (date.getDay()) {
	case 0:val="星期天";break
	case 1:val="星期一";break
	case 2:val="星期二";break
	case 3:val="星期三";break
	case 4:val="星期四";break
	case 5:val="星期五";break
	case 6:val="星期六";break
	}
	hour=add_zero(date.getHours());
	minute=add_zero(date.getMinutes());
	second=add_zero(date.getSeconds());
return "今天是： "+year+"年"+month+"月"+day+"日"+" "+val;
}
function add_zero(str)
{
	var STR=str;
	if(STR.length<2)
	{
		STR="0"+str;
	}
	return STR;
}
function senfe(o,a,b,c,d)//对表格设置样式，行颜色。
		{
		 var t=document.getElementById(o).getElementsByTagName("tr");
		 for(var i=0;i<t.length;i++){
		  t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
		  t[i].onclick=function(){
		   if(this.x!="1"){
			this.x="1";//本来打算直接用背景色判断，FF获取到的背景是RGB值，不好判断
			this.style.backgroundColor=d;
		   }else{
			this.x="0";
			this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
		   }
		  }
		  t[i].onmouseover=function(){
		   if(this.x!="1")this.style.backgroundColor=c;
		  }
		  t[i].onmouseout=function(){
		   if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
		  }
		 }
		}
	function shezhi_biaoge(biaoge)
	{
		senfe(biaoge,"#fff","#F3F3F3","#E2E2E2","#E8F3FF");
	}
		function page_job()
		{
			sc.selectChild(job_part);
			dojo.byId("td_job").style.background="url(img/1.jpg)";
			dojo.byId("td_talent").style.background="url(img/2-2.jpg)";
		}
		function page_talent()
		{
			sc.selectChild(talent_part);
			dojo.byId("td_job").style.background="url(img/1-1.jpg)";
			dojo.byId("td_talent").style.background="url(img/2.jpg)";
		}
		function changejob(controlid)//全选工作
		{
		
			var items=document.getElementsByName("job");
  			var itemall=document.getElementById(controlid);
			document.getElementById("all_job1").checked=itemall.checked;
			document.getElementById("all_job").checked=itemall.checked;
		  for(var i=0;i<items.length;i++){
			items[i].checked=itemall.checked;

			  }
		}
		function change_talent(controlid)//全选人才
		{
		
			var items=document.getElementsByName("talent");
  			var itemall=document.getElementById(controlid);
		
			document.getElementById("all_talent1").checked=itemall.checked;
			document.getElementById("all_talent").checked=itemall.checked;
				
		  for(var i=0;i<items.length;i++){
			items[i].checked=itemall.checked;

			  }
		}
		
		function  Quyu_Check(shengshi,diqu,shengshi_id,diqu_id)//选择区域
		{
			
			
				if(shengshi=="不限")
				{
					dojo.byId("job_quyu").innerHTML="不限-不限";
					dojo.byId("job_quyu_url").innerHTML="";
				}
				else
				{
					dojo.byId("job_quyu").innerHTML=shengshi+"-"+diqu;
					dojo.byId("job_quyu_url").innerHTML="&Arid="+shengshi_id+"&Ciid="+diqu_id;
					
				}
				Job_Search();
				dojo.byId("yincang_quyu").click();
			
		}
		function  Quyu_Check1(shengshi,diqu,shengshi_id,diqu_id)//选择区域
		{
			
			
				if(shengshi=="不限")
				{
					dojo.byId("talent_quyu").innerHTML="不限-不限";
					dojo.byId("talent_quyu_url").innerHTML="";
				}
				else
				{
					dojo.byId("talent_quyu").innerHTML=shengshi+"-"+diqu;
					dojo.byId("talent_quyu_url").innerHTML="&Arid="+shengshi_id+"&Ciid="+diqu_id;
				}
				Talent_Search(0);
			dojo.byId("tyincang_quyu").click();
		}
		function  Quyu_Check2(shengshi,diqu,shengshi_id,diqu_id)//选择区域
		{
			
			
				if(shengshi=="全国")
				{
					dojo.byId("top_city").innerHTML="全国-全国";
					dojo.byId("talent_quyu").innerHTML="不限-不限";
					dojo.byId("talent_quyu_url").innerHTML="";
					dojo.byId("job_quyu").innerHTML="不限-不限";
					dojo.byId("job_quyu_url").innerHTML="";
				}
				else
				{
					dojo.byId("top_city").innerHTML=shengshi+"-"+diqu;
					dojo.byId("job_quyu").innerHTML=shengshi+"-"+diqu;
					dojo.byId("job_quyu_url").innerHTML="&Arid="+shengshi_id+"&Ciid="+diqu_id;
					dojo.byId("talent_quyu").innerHTML=shengshi+"-"+diqu;
					dojo.byId("talent_quyu_url").innerHTML="&Arid="+shengshi_id+"&Ciid="+diqu_id;
				}
			Job_Search1(0);
			dojo.byId("yincang_chengshi").click();
		}
		function Hangye_Check(hangye,hangye_id)
		{
				if(hangye=="不限")
				{
					dojo.byId("job_hangye").innerHTML="不限";
					dojo.byId("job_hangye_url").innerHTML="";
				}
				else
				{
					dojo.byId("job_hangye").innerHTML=hangye;
					dojo.byId("job_hangye_url").innerHTML="&Trid="+hangye_id;
				}
				Job_Search();
				dojo.byId("yincang_hangye").click();
		}
		function Xueli_Check(xueli,xueli_id)
		{
			if(xueli=="不限")
			{
				dojo.byId("job_xueli").innerHTML="不限";
				dojo.byId("job_xueli_url").innerHTML="";
			}
			else
			{
				dojo.byId("job_xueli").innerHTML=xueli;
				dojo.byId("job_xueli_url").innerHTML="&Deid="+xueli_id;
			}
			Job_Search();
			dojo.byId("yincang_xueli").click();
		}
		function Jingyan_Check(jingyan,jingyan_id)
		{
			if(jingyan=="不限")
			{
				dojo.byId("job_jingyan").innerHTML="不限";
				dojo.byId("job_jingyan_url").innerHTML="";
			}
			else
			{
				dojo.byId("job_jingyan").innerHTML=jingyan;
				dojo.byId("job_jingyan_url").innerHTML="&Wyid="+jingyan_id;
			}
			Job_Search();
			dojo.byId("yincang_jingyan").click();
		}
		function Xinchou_Check(Xinchou,Xinchou_id)
		{
			if(Xinchou=="不限")
			{
				dojo.byId("job_xinchou").innerHTML="不限";
				dojo.byId("job_xinchou_url").innerHTML="";
			}
			else
			{
				dojo.byId("job_xinchou").innerHTML=Xinchou;
				dojo.byId("job_xinchou_url").innerHTML="&Mpid="+Xinchou_id;
			}
			Job_Search();
			dojo.byId("yincang_xinchou").click();
		}
		function Leibie_Check(leibie,leibie_id)
		{
			if(leibie=="不限")
			{
				dojo.byId("job_leibie").innerHTML="不限";
				dojo.byId("job_leibie_url").innerHTML="";
			}
			else
			{
				dojo.byId("job_leibie").innerHTML=leibie;
				dojo.byId("job_leibie_url").innerHTML="&Jtid="+leibie_id;
			}
			Job_Search();
			dojo.byId("yincang_leibie").click();
		}
		function Shijian_Check(shijian,shijian_id)
		{
			if(shijian=="不限")
			{
				dojo.byId("job_shijian").innerHTML="不限";
				dojo.byId("job_shijian_url").innerHTML="";
			}
			else
			{
				dojo.byId("job_shijian").innerHTML=shijian;
				dojo.byId("job_shijian_url").innerHTML="&Upda="+shijian_id;
			}
			Job_Search();
			dojo.byId("yincang_shijian").click();
		}
		function Job_Search_Page(dizhi)
		{
			dojo.byId("job_content").innerHTML="数据加载中....";
			 dojo.xhrGet({
			   	url:dizhi,
				load:function(response){
							dojo.byId("job_content").innerHTML=response;
							
						},
				error:function(error){dojo.byId("job_content").innerHTML="加载错误！"}
				});
		}
		function Job_Search1(flag)
		{
			var Myurl="default2.aspx?Type=Msg&Stid=Company&Key="+escape(dojo.byId("keyword").value);
		   Myurl+=dojo.byId("job_hangye_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_xueli_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_jingyan_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_xinchou_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_quyu_url").innerHTML.replace("amp;","").replace("amp;","");
		   Myurl+=dojo.byId("job_leibie_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_shijian_url").innerHTML.replace("amp;","");
		   dojo.byId("job_content").innerHTML="数据加载中....";
		   dojo.xhrGet({
			   	url:Myurl,
				load:function(response){
							dojo.byId("job_content").innerHTML=response;
							//后发送
							dojo.xhrGet({
			   	url:Myurl.replace("=Msg","=Recount"),
				load:function(response){
							dojo.byId("Job_Count").innerHTML=response.toString();
							//再搜索人才
							Talent_Search(flag);
						},
		 error:function(error){}
				});
						},
				error:function(error){dojo.byId("job_content").innerHTML="加载错误！"}
				});
		   
		}
		function Job_Search()
		{
			var Myurl="default2.aspx?Type=Msg&Stid=Company&Key="+escape(dojo.byId("keyword").value);
		   Myurl+=dojo.byId("job_hangye_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_xueli_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_jingyan_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_xinchou_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_quyu_url").innerHTML.replace("amp;","").replace("amp;","");
		   Myurl+=dojo.byId("job_leibie_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("job_shijian_url").innerHTML.replace("amp;","");
		   dojo.byId("job_content").innerHTML="数据加载中....";
		   dojo.xhrGet({
			   	url:Myurl,
				load:function(response){
							dojo.byId("job_content").innerHTML=response;
							//后发送
							dojo.xhrGet({
			   	url:Myurl.replace("=Msg","=Recount"),
				load:function(response){
							dojo.byId("Job_Count").innerHTML=response.toString();
							
						},
		 error:function(error){}
				});
						},
				error:function(error){dojo.byId("job_content").innerHTML="加载错误！"}
				});
		   //window.scroll(0,400);
		}
		function Top_Search(Keyword)
		{
			
			dojo.byId("keyword").value=Keyword;
			
		   Job_Search();
		
		}
		function Talent_Search_Page(dizhi)
		{
			dojo.byId("talent_content").innerHTML="数据加载中....";
		   dojo.xhrGet({
			   	url:dizhi,
				load:function(response){
							dojo.byId("talent_content").innerHTML=response;
							
						},
				error:function(error){dojo.byId("talent_content").innerHTML="加载错误！"}
				});
		}
		function Talent_Search(flag)
		{
			var Myurl="default2.aspx?Type=Msg&Stid=Person&Key="+escape(dojo.byId("talent_keyword").value);
			if(dojo.byId("talent_xingbie_url").innerHTML!="")
				Myurl+="&Sex="+escape(dojo.byId("talent_xingbie_url").innerHTML);
			
		   Myurl+=dojo.byId("talent_xueli_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("talent_jingyan_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("talent_xinchou_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("talent_quyu_url").innerHTML.replace("amp;","").replace("amp;","");
		   Myurl+=dojo.byId("talent_zhuanye_url").innerHTML.replace("amp;","");
		   Myurl+=dojo.byId("talent_shijian_url").innerHTML.replace("amp;","");
			
		   dojo.byId("talent_content").innerHTML="数据加载中....";
		   dojo.xhrGet({
			   	url:Myurl,
				load:function(response){
							dojo.byId("talent_content").innerHTML=response;
							//后发送
							dojo.xhrGet({
			   	url:Myurl.replace("=Msg","=Recount"),
				load:function(response){
							dojo.byId("Talent_Count").innerHTML=response.toString();
							//是否执行初始程序，即第一次执行
							if(flag==1)
							{
								chushi();
							}
						},
		 error:function(error){}
				});
							
						},
				error:function(error){dojo.byId("talent_content").innerHTML="加载错误！"}
				});
		   //window.scroll(0,400);
		}
		function TTop_Search(Keyword)
		{
			
			dojo.byId("talent_keyword").value=Keyword;
			 
		  Talent_Search(0);
		
		}
		function Talent_Xingbie(xingbie,xingbie_id)
		{
			if(xingbie=="不限")
			{
				dojo.byId("talent_xingbie").innerHTML="不限";
				dojo.byId("talent_xingbie_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_xingbie").innerHTML=xingbie;
				dojo.byId("talent_xingbie_url").innerHTML=xingbie;
			}
			Talent_Search(0);
			dojo.byId("tyincang_xingbie").click();
			
		}
		function Talent_Xueli(xueli,xueli_id)
		{
			if(xueli=="不限")
			{
				dojo.byId("talent_xueli").innerHTML="不限";
				dojo.byId("talent_xueli_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_xueli").innerHTML=xueli;
				dojo.byId("talent_xueli_url").innerHTML="&Deid="+xueli_id;
			}
			Talent_Search(0);
			dojo.byId("tyincang_xueli").click();
			
		}
		function Talent_Jingyan(jingyan,jingyan_id)
		{
			if(jingyan=="不限")
			{
				dojo.byId("talent_jingyan").innerHTML="不限";
				dojo.byId("talent_jingyan_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_jingyan").innerHTML=jingyan;
				dojo.byId("talent_jingyan_url").innerHTML="&Wyid="+jingyan_id;
			}
			Talent_Search(0);
			dojo.byId("tyincang_jingyan").click();
			
		}
		function Talent_Xinchou(xinchou,xinchou_id)
		{
			if(xinchou=="不限")
			{
				dojo.byId("talent_xinchou").innerHTML="不限";
				dojo.byId("talent_xinchou_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_xinchou").innerHTML=xinchou;
				dojo.byId("talent_xinchou_url").innerHTML="&Wpid="+xinchou_id;
			}
			Talent_Search(0);
			dojo.byId("tyincang_xinchou").click();
			
		}
		function Talent_Zhuanye(zhuanye,zhuanye_id)
		{
			if(zhuanye=="不限")
			{
				dojo.byId("talent_zhuanye").innerHTML="不限";
				dojo.byId("talent_zhuanye_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_zhuanye").innerHTML=zhuanye;
				dojo.byId("talent_zhuanye_url").innerHTML="&Spid="+zhuanye_id;
			}
			Talent_Search(0);
			dojo.byId("tyincang_zhuanye").click();
			
		}
		function Talent_Shijian(shijian,shijian_id)
		{
			if(shijian=="不限")
			{
				dojo.byId("talent_shijian").innerHTML="不限";
				dojo.byId("talent_shijian_url").innerHTML="";
			}
			else
			{
				dojo.byId("talent_shijian").innerHTML=shijian;
				dojo.byId("talent_shijian_url").innerHTML="&Upda="+shijian_id;
			}
			Talent_Search(0);
			dojo.byId("tyincang_shijian").click();
			
		}
		function qh_shijing(shijing_id)
		{
			
				dojo.xhrGet({
			   	url:"showphoto.aspx?Tradeid="+shijing_id,
				load:function(response){
							dojo.byId("div_shijing").innerHTML=response;
							
						},
				error:function(error){shijing.innerHTML="加载失败";}
				});
							
		}
		function Applay_job()
		{
			var items=document.getElementsByName("job");
				var str_id="0";
		  		for(var i=0;i<items.length;i++){
					if(items[i].checked)
						str_id+=","+items[i].value;				
			   }
			   if(str_id==0)
			   		str_id="";
			   if(str_id.length>0)
			   		str_id=str_id.replace("0,","");
				if(str_id=="")
				{
					alert("请选择要申请的职位！");
					return;
				}
				//个人是否登录
			
				dojo.xhrGet({
			   	url:"default2.aspx?Type=Pol&id="+Math.random().toString(),
				load:function(response){
							if(response.toString()=="False")
							{
								
								alert("请先登录人才用户！");
								
							}
							else
							{
								//发送
			   dojo.xhrGet({
			   	url:"default2.aspx?Type=Ppl&JoId="+str_id,
				load:function(response){
							if(response.toString()=="True")
							{
								alert("申请成功！");
							}
							else
							{
								alert("申请失败！");
							}
							
						},
				error:function(error){alert("申请失败")}
				});
							}
							
						},
				error:function(error){}
				});
		}
		function Applay_talent()
		{
			var items=document.getElementsByName("talent");
				var str_id="0";
		  		for(var i=0;i<items.length;i++){
					if(items[i].checked)
						str_id+=","+items[i].value;
			   }
			   if(str_id==0)
			   		str_id="";
			   if(str_id.length>0)
			   		str_id=str_id.replace("0,","");
				if(str_id=="")
				{
					alert("请选择要邀请的人才！");
					return;
				}
				//个人是否登录
				dojo.xhrGet({
			   	url:"default2.aspx?Type=Col&id="+Math.random().toString(),
				load:function(response){
							if(response.toString()=="False")
							{
								alert("请先登录企业用户！");
								return;
							}
							else
							{
								dojo.byId("yaoqing").value="";
							   dojo.byId("yqids").innerHTML=str_id;
							   dlg_yaoqing.show();
							}
							
						},
				error:function(error){}
				});
		}
