
//判断浏览器
function createXMLHttp()
{
    var request = false;
    if (window.XMLHttpRequest){ request = new XMLHttpRequest(); }
    else if (window.ActiveXObject) 
    {
       try{ request = new ActiveXObject("MSXML2.XMLHTTP"); } 
       catch (e1) 
       {
         try{ request = new ActiveXObject("Microsoft.XMLHTTP"); } 
         catch (e2){ request = false; }
       }
    }
    return request;
}

//以XML求取ddl_JobTypeSub的数据
	function XmlPost_JobTypeSub(obj)
    {
		var svalue = obj.value;
		var webFileUrl = "?jobtypeid=" + svalue;
		var result = "";
		var xmlHttp = createXMLHttp();
		xmlHttp.open("POST", webFileUrl, false);
		xmlHttp.send("");
		result = xmlHttp.responseText;		　　
		if(result != "")
		{
			document.getElementById("ddl_JobTypeSub").length=0;
			var piArray = result.split(",");
			for(var i=0;i<piArray.length;i++)
			{
				var ary = piArray[i].toString().split("|");
				document.getElementById("ddl_JobTypeSub").options.add(new Option(ary[1].toString(),ary[0].toString()));
			}
			document.getElementById("hid_JobTypeSub").value = document.getElementById("ddl_JobTypeSub").options[document.getElementById("ddl_JobTypeSub").selectedIndex].value;
		}
		else
		{
			alert(result);
		}
     }


     //以XML求取lib_WishTrainBox的数据
     function XmlPost_WishTrainBox(obj) {
         var svalue = obj.value;
         var webFileUrl = "?wishTrainid=" + svalue;
         var result = "";
         var xmlHttp = createXMLHttp();
         xmlHttp.open("POST", webFileUrl, false);
         xmlHttp.send("");
         result = xmlHttp.responseText;
         if (result != "") {
             document.getElementById("ddl_Trade").length = 0;
             var piArray = result.split(",");
             for (var i = 0; i < piArray.length; i++) {
                 var ary = piArray[i].toString().split("|");
                 document.getElementById("ddl_Trade").options.add(new Option(ary[1].toString(), ary[0].toString()));
             }
             document.getElementById("hid_TradeType").value = document.getElementById("ddl_Trade").options[document.getElementById("ddl_Trade").selectedIndex].value;
         }
         else {
             alert(result);
         }
     }



	
	//以XML求取ddl_WorkPlaceCity的数据
	function XmlPost_WorkPlaceCity(obj)
    {
		var svalue = obj.value;
		var webFileUrl = "?provinceid=" + svalue;
		var result = "";
		var xmlHttp = createXMLHttp();
		xmlHttp.open("POST", webFileUrl, false);
		xmlHttp.send("");
		result = xmlHttp.responseText;
				　　
		if(result != "")
		{
			document.getElementById("ddl_WorkPlaceCity").length=0;
			var piArray = result.split(",");
			for(var i=0;i<piArray.length;i++)
			{
				var ary = piArray[i].toString().split("|");
				document.getElementById("ddl_WorkPlaceCity").options.add(new Option(ary[1].toString(),ary[0].toString()));
			}
			document.getElementById("hid_WorkPlaceCity").value = document.getElementById("ddl_WorkPlaceCity").options[document.getElementById("ddl_WorkPlaceCity").selectedIndex].value;
		}
		else
		{
			alert(result);
		}
	}
	

//职位搜索
function Search_Quick()
{
	var Url;
	var JobType,Trade,WorkPlace,PublishDate,WorkYears,KeyClass,Key;
	
	JobType = document.getElementById("jobtype").value;
	WorkPlace = document.getElementById("workplace").value;
	Trade = document.getElementById("trade").value;
	PublishDate = document.getElementById("datetime").value;
	WorkYears = document.getElementById("workyear").value;
	Key = document.getElementById("txt_Key").value;
	
	KeyClass	= "1";
	if(document.getElementById("rbn_Class2").checked == true){KeyClass = "2"}
	
	if(Key == "请输入关键字")
	{
		alert("请输入搜索关键字");
		return;
	}
	
	Url = "Per_Search_Quick.aspx?JobType="+ JobType +"&Trade="+ Trade +"&WorkPlace="+ WorkPlace +"&WorkYears="+ WorkYears +"&PublishDate="+ PublishDate +"&KeyClass="+ KeyClass +"&Key="+ Key;
	
	window.open(Url);
}

//全能搜索
function Search_Advance()
{
	var Url;
	var JobType,Trade,WorkPlace,Property,JobProperty,Degree,WorkYears,Sex,MinAge,MaxAge,MonthPay,PublishDate,Key;
	
	JobType		= document.getElementById("hid_JobTypeSub").value;
	WorkPlace	= document.getElementById("hid_WorkPlaceCity").value;
	Trade = document.getElementById("hid_Trade").value;
	Property    = document.getElementById("ddl_Property").value; 
	JobProperty = document.getElementById("ddl_JobProperty").value; 
	Degree		= document.getElementById("ddl_Degree").value;
	WorkYears	= document.getElementById("ddl_WorkYears").value;
	Sex			= document.getElementById("ddl_Sex").value;
	MinAge		= document.getElementById("ddl_MinAge").value;
	MaxAge		= document.getElementById("ddl_MaxAge").value;
	MonthPay	= document.getElementById("ddl_MonthPay").value;
	PublishDate	= document.getElementById("ddl_PublishDate").value;
	Key			= document.getElementById("txt_Key").value;
	
	if(Key == "请输入关键字"){Key = "";}
	
	Url = "Per_Search_Advance.aspx?JobType="+ JobType +"&Trade="+ Trade +"&WorkPlace="+ WorkPlace +"&Property="+ Property +"&JobProperty="+ JobProperty +"&Degree="+ Degree +"&WorkYears="+WorkYears  +"&Sex="+ Sex +"&MinAge="+ MinAge +"&MaxAge="+ MaxAge +"&MonthPay="+ MonthPay +"&PublishDate="+ PublishDate +"&Key="+ Key;
	
	window.open(Url);
}




//切换急聘/热门职位
function asecBoard(n) 
{ 
    for(i=1;i<4;i++) 
    { 
        eval("document.getElementById('al0"+i+"').className='a102'"); 
        eval("document.getElementById('abx0"+i+"').style.display='none'"); 
    } 
    eval("document.getElementById('al0"+n+"').className='a101'"); 
    eval("document.getElementById('abx0"+n+"').style.display='block'"); 
}

//切换分类搜索
function bsecBoard(n) 
{ 
    for(i=1;i<4;i++) 
    { 
        eval("document.getElementById('bl0"+i+"').className='a102'"); 
        eval("document.getElementById('bbx0"+i+"').style.display='none'"); 
    } 
    eval("document.getElementById('bl0"+n+"').className='a101'"); 
    eval("document.getElementById('bbx0"+n+"').style.display='block'"); 
}


	//检测用户名
	function CheckAccount(username)
    {
      var re, r;
    
      re = /\S/;
      r = username.match(re);
      if (!r)
      {
        alert("请输入用户帐号！");
        return false;
      }
      else
      {
        window.open("Register_Check.aspx?type=username&value="+username,"")
      }
    }
    
    //检测邮箱地址
	function CheckMail(email)
    {
      var re, r;
    
      re = /\S/;
      r = email.match(re);
      if (!r)
      {
        alert("请输入邮箱地址！");
        return false;
      }
      else
      {
        window.open("Register_Check.aspx?type=email&value="+email,"")
      }
    }
