
//判断浏览器
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_WishTrainBoxs(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()));
	        }
	    }
	    else {
	        document.getElementById("hid_trade").value = "";
	        document.getElementById("ddl_Trade").length = 0;
	        document.getElementById("ddl_Trade").options.add(new Option("行业不限", ""));
        }
	   
	}
	//以XML求取ddl_WishWorkPlaceCity的数据 -- 期望工作地区
	function XmlPost_WishWorkPlaceCity(obj)
    {
		var svalue = obj.value;
		var webFileUrl = "?wishworkplace=" + svalue;
		var result = "";
		var xmlHttp = createXMLHttp();
		xmlHttp.open("POST", webFileUrl, false);
		xmlHttp.send("");
		result = xmlHttp.responseText;
				　　
		if(result != "")
		{
			document.getElementById("ddl_WishWorkPlaceCity").length=0;
			var piArray = result.split(",");
			for(var i=0;i<piArray.length;i++)
			{
				var ary = piArray[i].toString().split("|");
				document.getElementById("ddl_WishWorkPlaceCity").options.add(new Option(ary[1].toString(),ary[0].toString()));
			}
			document.getElementById("hid_WishWorkPlaceCity").value = document.getElementById("ddl_WishWorkPlaceCity").options[document.getElementById("ddl_WishWorkPlaceCity").selectedIndex].value;
		}
		
	}
	//以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 {
	        document.getElementById("hid_trade").value = "0";
	        document.getElementById("ddl_Trade").length = 0;
	        document.getElementById("ddl_Trade").options.add(new Option("行业不限", "0"));
	    }
	   
	}
	//以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;
		}
		
	}

//职位搜索
function Search_Advance()
{
	var Url;
	var JobType,WishWorkPlace,Trade,JobProperty,Degree,WorkYears,Sex,MinAge,MaxAge,PublishDate,WorkPlace,EnResume,Key;
	
	JobType			= document.getElementById("hid_JobTypeSub").value;
	WishWorkPlace	= document.getElementById("hid_WishWorkPlaceCity").value;
	Trade = document.getElementById("hid_trade").value;
	if (Trade == "") {
	    Trade = document.getElementById("ddl_TradeType").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;
	PublishDate		= document.getElementById("ddl_PublishDate").value;
	WorkPlace		= document.getElementById("hid_WorkPlaceCity").value;
	Key				= document.getElementById("txt_Key").value;
	EnResume		= "0";
	
	//if(document.getElementById("chk_EnResume").checked == true){ EnResume = "1"; }
	
	if(Key == "请输入关键字")
	{
		alert("请输入搜索关键字！");
		return;
	}
	
	Url = "Com_Search_Advance.aspx?JobType="+ JobType +"&Trade="+ Trade +"&WishWorkPlace="+ WishWorkPlace +"&JobProperty="+ JobProperty +"&Degree="+ Degree +"&WorkYears="+WorkYears  +"&Sex="+ Sex +"&MinAge="+ MinAge +"&MaxAge="+ MaxAge +"&PublishDate="+ PublishDate +"&WorkPlace="+ WorkPlace +"&EnResume="+ EnResume +"&Key="+ Key;
	
	window.open(Url);
}

