//:::::::::::::::::::::::::::::::::::::::::::::
//::::::::::::::::(job/index.asp)::::::::::::::
//:::::::::::::::职位列表页搜索开始::::::::::::
//:::::::::::::::::::::::::::::::::::::::::::::
//获取查询条件
function JobIndexSearch(){
	var m=document.myform;
	var CallingID;
	var ClassID;
	var SpecialID;
	var Title;
	CallingID  			= m.CallingID.value;
	ClassID  			= m.ClassID.value;
	SpecialID  			= m.SpecialID.value;
	if(m.ClassID.length==0){
		alert('请至少选择一个职位!')
		m.ClassID.focus();
		return false;
	}
	for (var i=0;i< m.ClassID.length;i++){
		if(i == 0){
			ClassID = m.ClassID.options[i].value;
		}else{
			ClassID += ','+ m.ClassID.options[i].value;
		}
	}
	for (var i=0;i< m.SpecialID.length;i++){
		if(i == 0){
			SpecialID = m.SpecialID.options[i].value;
		}else{
			SpecialID += ','+ m.SpecialID.options[i].value;
		}
	}
	Title  				= m.Title.value;
	//初始查询条件
	var where='a.yn=1 And d.MainID=a.JobID And d.FromID=c.SpecialID';
	//var where="a.yn=1  and b.CompanyID=d.CompanyID and d.CompanyClass=0  and a.UserName = b.UserName And a.JobID In(Select MainID From LZ8_SpecialRelation Where MainID = a.JobID) And c.SpecialID In (Select FromID From LZ8_SpecialRelation Where MainID = a.JobID)";
	//检验用户是否输入了关键字
	if(Title !=""){
		if(m.exactitude.checked){
			where += " and a.Title=" + "'" +Title+ "'";
		}else{
			where += " and a.Title like" + "'%" +Title+ "%'";
		}
	}
	//检验用户是否选择了行业类别
	if(CallingID != ""){
		where += " and a.CallingID = " + CallingID;
	}
	//检验用户是否选择了分类
	if(ClassID != ""){
		where += " and a.JobID in(Select MainID from LZ8_ClassRelation Where FromID =" + ClassID +")";
	}
	
//	//检验用户是否选择了地区
//	if(SpecialID != ""){
//		where += " and c.SpecialID in("+ SpecialID +")";
//	}
	document.searchwhere.where.value		=	where;
	document.Savesearchwhere.where.value		=	where;
	document.Savesearchwhere.ID.value			=	ClassID;
	return true;
}

//::::::::::::::::::::::::::::::::::::::::::::://
//::::::::::::::::(job/index.asp):::::::::::::://
//:::::::::::::::职位列表页搜索结束:::::::::::://
//::::::::::::::::::::::::::::::::::::::::::::://




//:::::::::::::::::::::::::::::::::::::::::::::
//::::::::::::::::(job/invite.asp):::::::::::::
//:::::::::::::::人才搜索人才搜索[列表页]开始::
//:::::::::::::::::::::::::::::::::::::::::::::
//获取查询条件
function InviteSearch(){
	
	var SpecialID ="{$SpecialID}";
	//搜索人才简历初始条件
	if(SpecialID==""){
		var where = "a.yn=1 and b.ResumeID=(Select Top 1 ResumeID from LZ8_ResumeEducate where ResumeID=a.ResumeID) ";
	}else{
		var where = "a.yn=1 And b.ResumeID=(Select Top 1 ResumeID from LZ8_ResumeEducate where ResumeID=a.ResumeID) and c.FromID in(select SpecialID from LZ8_Special where (SpecialID={$SpecialID} or ParentID={$SpecialID})) and a.ResumeID = c.MainID and c.FromID=d.SpecialID";
	}

	//设置初始提示查询信息

	var m=document.myform;
	var CallingID		= m.CallingID.value;
	var ClassID			= m.ClassID.value;
	var Dwell			= m.Dwell.value;
	
	if(m.CallingID.value==""){
		alert('请选择“行业”!')
		m.CallingID.focus();
		return false;
	}

	//检验用户是选择了现职位分类
	for (var i=0;i< m.ClassID.length;i++){
		if(i == 0){
			ClassID = m.ClassID.options[i].value;				//检验用户是选择了职位分类
			if(ClassID != ""){
				where += " and ( a.NowMainCareer like '%|" + ClassID + "|%'";
			}
		}else{
			ClassID = m.ClassID.options[i].value;
			where += " or a.NowMainCareer like '%|" + ClassID + "|%'";
		}
	}
	if(ClassID != ""){
		where += ")";
	}
	
	var Title 					= m.Title.value;
	var RequestSex				= m.RequestSex.value;
	var RequestAgeStart			= m.RequestAgeStart.value;
	var RequestAgeEnd			= m.RequestAgeEnd.value;
	var RequestWorkYear			= m.RequestWorkYear.value;
	var MarryYN					= m.MarryYN.value;

	//检验用户是否输入了关键字
	if(Title !=""){
		if(m.exactitude.checked){
			where += " and (a.TrueName = " + "'" +Title+ "'";
			where += " or a.UserName = " + "'" +Title+ "'";
			where += " or a.ObjectCN like'%" +Title+ "%')";
		}else{
			where += " and (a.TrueName like '%" +Title+ "%'";
			where += " or a.UserName like '%" +Title+ "%'";
			where += " or a.ObjectCN like '%" +Title+ "%')";
		}
	}
	
	//检验用户是否选择了行业类别
	if(CallingID != ""){
		where += " and a.NowTrade = " + CallingID;
	}
	
	//检验用户是选择了居住地区
	if(Dwell != ""){
		where += " and a.Dwell like" + "'%" +Dwell+ "%'";
	}
	
	//检验用户是否选择了性别
	if(RequestSex !=""){
		where += " and a.Sex = " + RequestSex;
	}
	
	//检验用户是否选择了工作经验
	if(RequestWorkYear !=""){
		where += " and a.Experience >" + RequestWorkYear ;
	}
	
	//检验用户是否选择了年龄
//	if(RequestAgeStart =="0"){
//			if(RequestAgeEnd =="100"){
//				where = where ;

//			}else{
//				if(RequestAgeEnd != "100"){
//				where += " and a.RequestAgeEnd <" + RequestAgeEnd;
//				}
//			}
//	}else{
//			if(RequestAgeEnd !="100"){
//					where += " and a.RequestAgeStart >" +RequestAgeStart+" and RequestAgeEnd <"+RequestAgeEnd;
//			}else{
//				if(RequestAgeEnd =="100"){
//					where += " and a.RequestAgeStart >" +RequestAgeStart;
//				}
//			}
//	}

		document.searchwhere.where.value			=	where;
		document.Savesearchwhere.where.value			=	where;
		document.Savesearchwhere.ID.value				=	CallingID;
		document.Savesearchwhere.s.value				=	RequestSex;
		document.Savesearchwhere.a.value				=	RequestAgeStart +"-"+ RequestAgeEnd;
		document.Savesearchwhere.t.value				=	Title;
	return true;
}
//:::::::::::::::::::::::::::::::::::::::::::::
//::::::::::::::::(job/invite.asp):::::::::::::
//:::::::::::::::人才搜索人才搜索[列表页]结束::
//:::::::::::::::::::::::::::::::::::::::::::::







/////////////////////////////////////////////////
//::::::::::::::::(job/searchindex.asp):::::::::::::://
//:::::::::::::::职位搜索页搜索开始:::::::::::://
/////////////////////////////////////////////////
//获取查询条件
function JobSearchIndex(){

	var m=document.myform;
	var n=document.myform2;
	
	var EndValueYear=n.EndValidY.value + "/";
	var EndValueMonth=n.EndValidM.value + "/";
	var EndValueDate=n.EndValidD.value + "";
	n.EndValidDate.value=EndValueYear + EndValueMonth + EndValueDate;
	var sysDate=new Date(parseInt(n.EndValidY.value),parseInt(n.EndValidM.value),parseInt(n.EndValidD.value));
	var theDate=new Date();
	var theDate=new Date(theDate.getFullYear(),theDate.getMonth()+1,theDate.getDate());

	var CallingID;
	var ClassID;
	var SpecialID;
	var Title;
	var RequestSex;
	var RequestAgeStart;
	var RequestAgeEnd;
	var RequestSpeciality;
	var RequestDegreeID;
	var RequestLanguage;
	var RequestResidence;
	var RequestComputers;
	var JobType;
	var Salarylow;
	var Salaryhigh;
	var RequestWorkYear;
	var RequestLocation;
	var EatHouse;	

	CallingID  			= m.CallingID.value;
	ClassID  			= m.ClassID.value;
	SpecialID  			= m.SpecialID.value;

	if(m.ClassID.length==0){
		alert('请至少选择一个职位!')
		m.ClassID.focus();
		return false;
	}
	
	for (var i=0;i< m.ClassID.length;i++){
		if(i == 0){
			ClassID = m.ClassID.options[i].value;
		}else{
			ClassID += ','+ m.ClassID.options[i].value;
		}
	}
	for (var i=0;i< m.SpecialID.length;i++){
		if(i == 0){
			SpecialID = m.SpecialID.options[i].value;
		}else{
			SpecialID += ','+ m.SpecialID.options[i].value;
		}
	}
	Title  				= m.Title.value;
	RequestSex  		= n.RequestSex.value;
	RequestAgeStart 	= n.RequestAgeStart.value;
	RequestAgeEnd 		= n.RequestAgeEnd.value;
	RequestSpeciality 	= n.RequestSpeciality.value;
	RequestDegreeID 	= n.RequestDegreeID.value;
	RequestLanguage 	= n.RequestLanguage.value;
	
	RequestResidence  	= n.RequestResidence.value;
	RequestComputers  	= n.RequestComputers.value;
	JobType  			= n.JobType.value;
	Salarylow  			= n.Salarylow.value;
	
	Salaryhigh  		= n.Salaryhigh.value;
	RequestWorkYear  	= n.RequestWorkYear.value;
	RequestLocation 	= n.RequestLocation.value;
	EatHouse  			= n.EatHouse.value;
	
	//初始查询条件
	var where="a.yn=1 and b.CompanyID=d.CompanyID and d.CompanyClass=0 and a.UserName = b.UserName And a.JobID In(Select MainID From LZ8_SpecialRelation Where MainID = a.JobID) And c.SpecialID In (Select FromID From LZ8_SpecialRelation Where MainID = a.JobID)";
//	设置初始提示查询信息
	var searchinfo ="您设置的查询条件为:";
//	where=CallingID+Title+RequestSex+RequestAgeStart+RequestAgeEnd+RequestSpeciality+RequestDegreeID+RequestLanguage;
//	where+=RequestResidence+RequestComputers+JobType+Salarylow;
//	where+=Salaryhigh+RequestWorkYear+RequestLocation+EatHouse;

	//检验用户是否输入了关键字
	if(Title !=""){
		if(m.exactitude.checked){
			where += " and a.Title=" + "'" +Title+ "'";
		}else{
			where += " and a.Title like" + "'%" +Title+ "%'";
		}
	}

	//检验用户是否选择了行业类别
	if(CallingID != ""){
		where += " and a.CallingID = " + CallingID;
	}

	//检验用户是否选择了分类
	if(ClassID != ""){
		where += " and a.JobID in(Select MainID from LZ8_ClassRelation Where FromID in(" + ClassID +"))";
	}
	//检验用户是否选择了地区
	if(SpecialID != ""){
		where += " and c.SpecialID in("+ SpecialID +")";
	}

		//检验用户是否选择了性别
	if(RequestSex !=""){
		where += " and a.RequestSex= " + RequestSex;
		
	}
	//检验用户是否选择了年龄
	if(RequestAgeStart =="0"){
			if(RequestAgeEnd =="100"){
				where = where ;
			}else{
				if(RequestAgeEnd != "100"){
				where += " and a.RequestAgeEnd <" + RequestAgeEnd;
				}
			}
	}else{
			if(RequestAgeEnd !="100"){
					where += " and a.RequestAgeStart >" +RequestAgeStart+" and RequestAgeEnd <"+RequestAgeEnd;
			}else{
				if(RequestAgeEnd =="100"){
					where += " and a.RequestAgeStart >" +RequestAgeStart;
				}
			}
	}
	//检验用户是否选择了专业要求
	if(RequestSpeciality !=""){
		where += " and a.RequestSpeciality like" + "'%" + RequestSpeciality + "%'";
	}

	//检验用户是否选择了学历要求
	if(RequestDegreeID !=""){
		where += " and a.RequestDegreeID >=" + RequestDegreeID ;
	}

	//检验用户是否选择了外语要求
	if(RequestLanguage !=""){
		where += " and a.RequestLanguage like" + "'%" + RequestLanguage+ "%'";
	}

	//检验用户是否选择了户籍要求
	if(RequestResidence!=""){
		where += " and a.RequestResidence = " + "'" + RequestResidence  + "'";
	}

	//检验用户是否选择了计算机能力
	if(RequestComputers !=""){
		where += " and a.RequestComputers like"+ "'%" + RequestComputers+ "%'";
	}

	//检验用户是否选择了工作性质
	if(JobType !=""){
		where += " and a.JobType = "+ "'" + JobType + "'";
	}
	
	//检验用户是否选择了薪资待遇
	if(Salarylow ==""){
		if(Salaryhigh ==""){
		where=where;
		}else
		if(Salaryhigh !=""){
		where += " and a.Salary <" +Salaryhigh;
		}
	}else
		if(Salarylow !=""){
		if(Salaryhigh ==""){
		where += " and a.Salary >" +Salarylow;
		}else{
			if(Salarylow<Salaryhigh){
				where += " and a.Salary >" +Salarylow+" and Salary <" +Salaryhigh;
			}else{
				where += " and a.Salary <" +Salarylow+" and Salary >" +Salaryhigh;
			}
		}
	}

	//检验用户是否选择了工作经验
	if(RequestWorkYear =="0"){
		where = where;
	}else{
		where += " and a.RequestWorkYear >" + RequestWorkYear ;
	}

	//检验用户是否选择了所在地区
	if(RequestLocation !=""){
		where += " and a.RequestLocation = "+ "'"  + RequestLocation + "'" ;
	}
	
	//检验用户是否选择了食宿提供
	if(EatHouse !=""){
		where += " and a.EatHouse = " + "'" + EatHouse + "'" ;
	}

	document.searchwhere.where.value		=	where;
	document.Savesearchwhere.where.value		=	where;
	document.Savesearchwhere.ID.value			=	ClassID;
	return true;
}
/////////////////////////////////////////////////
//::::::::::::::::(job/searchindex.asp):::::::::::::://
//:::::::::::::::职位搜索页搜索结束:::::::::::://
/////////////////////////////////////////////////



