
function get_jobcategory_select(){
	objx=document.getElementById("id_jobcategory_box");
	obj=objx.getElementsByTagName("select");
	strx=this.value.split(",");
	msglay=strx[0];
	msgid=strx[1];
	lngx=obj.length;
	for(var i = msglay; i < lngx; i++) {
		var e = obj[i];
		pobj=e.parentElement;
		pobj.removeChild(e);
	}
	strval="";
	for(var i = 0; i < msglay; i++) {
		var e = obj[i];
		if(e.selectedIndex>0)strval+=e.options[e.selectedIndex].innerHTML+" ";
	}
	objx=document.getElementById("id_jobcategory_box");
	obj=objx.getElementsByTagName("input");
	objjobcategory=document.getElementById(obj[0].id);
	objjobcategory.value=strval;
	if(msgid=="") return;
	yj_ajax_get(cfg_web_url+"/plus/ajax/index.php?isajax=1&act=get_job_category_select&id="+msgid,on_jobcategory_addselect);
}
function get_jobcategory_select_1(msgid,msglay){
	objx=document.getElementById("id_jobcategory_box");
	obj=objx.getElementsByTagName("select");
	lngx=obj.length;
	for(var i = msglay; i < lngx; i++) {
		var e = obj[i];
		pobj=e.parentElement;
		pobj.removeChild(e);
	}
	strval="";
	for(var i = 0; i < msglay; i++) {
		var e = obj[i];
		if(e.selectedIndex>0)strval+=e.options[e.selectedIndex].innerHTML+" ";
	}
	objx=document.getElementById("id_jobcategory_box");
	obj=objx.getElementsByTagName("input");
	objjobcategory=document.getElementById(obj[0].id);
	objjobcategory.value=strval;
	if(msgid=="") return;
	yj_ajax_get(cfg_web_url+"/plus/ajax/index.php?isajax=1&act=get_job_category_select&id="+msgid,on_jobcategory_addselect);
}

function on_jobcategory_addselect(data,textStatus)
{
	if(data=="") return;
	testDiv=document.getElementById("id_jobcategory_box");
	var select = document.createElement("select"); 
	str_option=data.split("|");
	for(i=0;i<str_option.length;i++){
		str_x=str_option[i].split("=");
		strx=str_x[0].split(",");
		msglay=strx[0];
		select.options[i+1] = new Option(str_x[1],str_x[0]);
	}
	select.options[0] = new Option("--请选择--", msglay+",");
	select.options[0].selected=true;
	select.onchange=get_jobcategory_select;
	var object = testDiv.appendChild(select);
}
function on_jobcategory_edit()
{
	$("#id_jobcategory_box input").hide();
	$("#id_jobcategory_box a").hide();
	$("#id_jobcategory_box select").show();
}
function me_winJobCategory(msgid,msgval)
{
	obj=document.getElementById("wincategory"+msgid);
	if(!obj){
		yj_ajax_get(cfg_web_url+"/plus/ajax/hr_job_category.php?isajax=1&msgval="+msgval,function(data){
			dialog_init_ajax("category"+msgid,"企业用户",data);
			div_show("wincategory"+msgid);
		});
	}else{
		div_show("wincategory"+msgid);
	}

}
function me_winLogin()
{
	obj=document.getElementById("winlogin");
	if(!obj){
		yj_ajax_get(cfg_web_url+"/index.php?appdir=label&app=login&isajax=1",function(data){
			dialog_init_ajax("login","用户登录",data,300);
			div_show("winlogin");
		});
	}else{
		div_show("winlogin");
	}

}

function me_winArea(msgid)
{
	obj=document.getElementById("winarea"+msgid);
	if(!obj){
		yj_ajax_get(cfg_web_url+"/plus/ajax/sys_area.php?isajax=1",function(data){
			dialog_init_ajax("area"+msgid,"选择地区",data);
			div_show("winarea"+msgid);
		});
	}else{
		div_show("winarea"+msgid);
	}

}
function me_get_next_area(msgid,msgsp,msgval){
	yj_ajax_get(cfg_web_url+"/plus/ajax/sys_area_next.php?isajax=1&pid="+msgid,function(data){
		if(data==""){
			document.frmSearch.search_area.value=msgval;
			if(msgval.length>12) msgval=msgval.substring(0,20)+"...";
			document.getElementById("id_area").innerHTML=msgval;
			div_hide_show("winareasearch_area");
		}else{
			obj_id=document.getElementById("id_area_next_"+msgsp);
			obj_id.innerHTML=data;
			var obj_win=document.getElementById("winareasearch_area");
			var obj_val=document.getElementById("id_val_areasearch_area");
			var obj_alpha=document.getElementById("id_alpha_areasearch_area");
			var obj_body=document.getElementById("id_body_areasearch_area");
			var lng_h=obj_val.clientHeight+40;
			obj_body.style.height=lng_h+"px";
			obj_body.style.top="-"+(lng_h+10)+"px";
			obj_alpha.style.height=lng_h+20+"px";
			obj_win.style.height=lng_h+20+"px";
		}
	});
}
function me_get_next_category(event,msgid){
	obj=document.getElementById("wincategorynext"+msgid);
	if(window.event) event=window.event;
	lng_left=event.clientX;
	lng_top=event.clientY;
	if(!obj){
		yj_ajax_get(cfg_web_url+"/plus/ajax/hr_job_category_next.php?isajax=1&pid="+msgid,function(data){
			dialog_init_ajax("categorynext"+msgid,"请选择",data,350,0);
			div_show("wincategorynext"+msgid,lng_top,lng_left);
		});
	}else{

		div_show("wincategorynext"+msgid,lng_top,lng_left);
	}
}
function me_get_show_category(msgid,msgval){
	obj_id=document.getElementById("id_sellist");
	obj_x=document.getElementById("id_next_"+msgid);
	if(obj_x){
		//obj_id_e=document.getElementsByTagName("span");
		obj_id.removeChild(obj_x);
		str_val=document.frmSearch.search_jobcategory.value;
		str_val=str_val.replace("|"+msgval,"");
		str_val=str_val.replace(msgval,"");
		document.frmSearch.search_jobcategory.value=str_val;
		if(str_val.length>12) str_val=str_val.substring(0,20)+"...";
		document.getElementById("id_category").innerHTML=str_val;
	}else{
		obj_id_e=obj_id.getElementsByTagName("span");
		if(obj_id_e.length>=5){
			alert("最多只允许选择5个");
			obj_x=document.getElementById("id_x_next_"+msgid);
			if(obj_x) obj_x.checked=false;
			return false;
		}
		str_html=" <span id='id_next_"+msgid+"'><input type='checkbox' name='sel_category[]' value='"+msgval+"' checked onclick=\"me_get_show_category("+msgid+",'"+msgval+"');\">"+msgval+"</span>";
		obj_id.innerHTML+=str_html;
		if(document.frmSearch.search_jobcategory.value!="") document.frmSearch.search_jobcategory.value=document.frmSearch.search_jobcategory.value+"|";
		document.frmSearch.search_jobcategory.value=document.frmSearch.search_jobcategory.value+msgval;
		str_val=document.frmSearch.search_jobcategory.value;
		if(str_val.length>12) str_val=str_val.substring(0,20)+"...";
		document.getElementById("id_category").innerHTML=str_val;
	}
}

function me_search_pubtime(){
	str_content=document.getElementById("id_search_pubtime").innerHTML;
	dialog_init_content("id_search_pubtime",str_content,"选择时间");
}
function me_selpubtime(xobj,xval){
	document.frmSearch.search_pubtime.value=xval;
	document.getElementById("id_pubtimebox").innerHTML=xobj.innerHTML;
	div_hide_show("winid_search_pubtime");
}