﻿function JumpSearchLayers(typeid,positionid,arrayid,fname,vname,tname)
{
	var objllist=document.getElementsByTagName("select");
	for(var i=0;i<objllist.length;i++)
    {
		objllist[i].style.visibility="hidden";
	} 
	document.getElementById("bodyly").style.display="block";
	document.getElementById("bodyly").style.width=document.documentElement.scrollWidth;   
	document.getElementById("bodyly").style.height=document.documentElement.scrollHeight; 
	document.getElementById("SearchDivhire").style.display='block';
	if(navigator.appName.indexOf("Explorer") > -1)
	{
 		document.getElementById("SearchDivhire").style.top=document.documentElement.scrollTop+50;   
 		document.getElementById("SearchDivhire").style.left=document.documentElement.scrollWidth/2-270;
 
	}
	else
	{
		document.getElementById("SearchDivhire").style.left=270 + "px";
		document.getElementById("SearchDivhire").style.top =100 + "px";
		 
	}
	document.getElementById("city").style.display="none";
	var onecount;
	strs='';
	if (arrayid==1)
	{
	onecount=positionarray.length;
	arraynames=positionarray;
	document.getElementById("wintit").innerHTML='请选择岗位类别';
	strss='<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择职位</span>'
	}
	if (arrayid==2)
	{
	onecount=provincearray.length;
	arraynames=provincearray;
	document.getElementById("wintit").innerHTML='请选择所在省市';
	strss='<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择城市</span>'
	}
	if (arrayid==3)
	{
	onecount=positionarrays.length;
	arraynames=positionarrays;
	document.getElementById("wintit").innerHTML='请选择岗位类别';
	strs='<span style=line-height:24px;float:left;font-weight:bold;width:500px;>请选择职位</span>'
	}
	var positionid=positionid;
	var i;
	str='';
	if (typeid==2)
	{
		str='';
	}
	else
	if (typeid==0)
	{
		str='';
	}
	else
	{
		str=strs;
	}
	for (i=0;i<onecount;i++)
	{
	if (typeid==2)
	{
		document.getElementById("hiretype").innerHTML='';
		str+='<li style="float:left;width:160px;height:20px;cursor:pointer;" onclick=document.'+fname+'.'+vname+'.value="'+arraynames[i][0]+'";document.'+fname+'.'+tname+'.value="'+arraynames[i][0]+","+arraynames[i][2]+'";unSearchLayers();>'+arraynames[i][0]+'</li>'
		document.getElementById("hiretypes").innerHTML=str;	
	}
	else
		if (arraynames[i][1] == positionid)
		{
			if (typeid==0)
			{
				document.getElementById("hiretype").innerHTML='';
				str+='<li onclick=JumpSearchLayers(1,'+arraynames[i][2]+','+arrayid+',"'+fname+'","'+vname+'","'+tname+'");InsertType('+arraynames[i][2]+','+arrayid+',"'+fname+'","'+vname+'","'+tname+'","'+arraynames[i][0]+'"); onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" style="float:left;width:160px;height:20px;cursor:pointer;"><input type="checkbox" id="checkbox'+arraynames[i][2]+'" name="checkbox'+arraynames[i][2]+'" value="'+arraynames[i][2]+'" onclick=d_checkbox("'+arraynames[i][0]+'","'+arraynames[i][2]+'","'+tname+'");>'+arraynames[i][0]+'</li>'
				document.getElementById("hiretypes").innerHTML=str;
			}
			else
			{
				document.getElementById("hiretype").innerHTML='';
				str+='<li onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" style="float:left;width:160px;height:20px;cursor:pointer;"><input type="checkbox" id="checkbox'+arraynames[i][2]+'" name="checkbox'+arraynames[i][2]+'" value="'+arraynames[i][2]+'" onclick=d_checkbox("'+arraynames[i][0]+'","'+arraynames[i][2]+'","'+tname+'")>'+arraynames[i][0]+'</li>'
				document.getElementById("hiretype").innerHTML=str;
			}
		}
	}
}

function d_checkbox(arrayname,arrayid,tname){
    if(document.getElementById("checkbox"+arrayid).checked){
        var arraystr2 = "";
        var arraystr3 = "";
        document.getElementById("xuan").innerHTML += "<a href=\"###\" alt=\"单击取消该项\" id="+arrayid+" onclick=\"remove("+arrayid+","+tname+")\">" +arrayname + "."+arrayid+"</a> ";
        if(tname=='position'){
            if(document.getElementById("positions").value == "默认不限"){
                document.getElementById("positions").value = "";
            }
                var arraystr0 = document.getElementById("xuan").innerText.replace("[点击确认选择]","");
                var arraystr1 = arraystr0.split(" ");
                if(arraystr1.length > 6){
                    alert("已经达到最大的5个选择项，超过的选项将不会被查询");return;
                }
                for(var i = 0; i<arraystr1.length-1; i++){
                    arraystr2 += arraystr1[i].split(".")[1] + ",";
                    arraystr3 += arraystr1[i].split(".")[0] + ",";
                }
                document.getElementById("positions").value = arraystr3;
                document.getElementById("position").value = arraystr2;
        }
        if(tname=='workadd'){
            if(document.getElementById("workadds").value == '默认不限'){
                document.getElementById("workadds").value = "";
            }        
                var arraystr0 = document.getElementById("xuan").innerText.replace("[点击确认选择]","");
                var arraystr1 = arraystr0.split(" ");
                if(arraystr1.length > 6){
                    alert("已经达到最大的5个选择项，超过的选项将不会被查询");return;
                }
                for(var i = 0; i<arraystr1.length-1; i++){
                    arraystr2 += arraystr1[i].split(".")[1] + ",";
                    arraystr3 += arraystr1[i].split(".")[0] + ",";
                }
                document.getElementById("workadds").value = arraystr3;
                document.getElementById("workadd").value = arraystr2;
        }
    }else{
        remove(arrayid,tname);        
    }
}

function remove(id,tname){
    document.getElementById("xuan").removeChild(document.getElementById(id));
    document.getElementById("checkbox"+id).checked = false;
    if(tname.id=='position'){
        document.getElementById("positions").value = document.getElementById("xuan").innerText.replace("[点击确认选择]","");
        var arraystr0 = document.getElementById("positions").value;        
        var arraystr1 = arraystr0.split(" ");
        var arraystr2 = "";
        for(var i = 0; i<arraystr1.length-1; i++){
            arraystr2 += arraystr1[i].split(".")[1] + ",";
        }
        document.getElementById("position").value = arraystr2;
    }
        if(tname.id=='workadd'){
        document.getElementById("workadds").value = document.getElementById("xuan").innerText.replace("[点击确认选择]","");
        var arraystr0 = document.getElementById("workadds").value;        
        var arraystr1 = arraystr0.split(" ");
        var arraystr2 = "";
        for(var i = 0; i<arraystr1.length-1; i++){
            arraystr2 += arraystr1[i].split(".")[1] + ",";
        }
        document.getElementById("position").value = arraystr2;
    }
}

function InsertType(positionid,arrayid,fname,vname,tname,nname)
{
document.getElementById("city").style.display="block";
strsss='<li style="float:left;width:500px;height:20px;cursor:pointer;">'+nname+'：</li>'
strss=strss+strsss;
document.getElementById("city").innerHTML=strss;	
}

function JumpSearchDate(fname,vname,tname)
{
	var objllist=document.getElementsByTagName("select");
	for(var i=0;i<objllist.length;i++)
    {
		objllist[i].style.visibility="hidden";
	} 
    document.getElementById("wintit").innerHTML='请选择查询日期';
    document.getElementById("hiretypes").innerHTML='';
    document.getElementById("hiretype").innerHTML='';
    document.getElementById("city").innerHTML='';
    document.getElementById("SearchDivhire").style.display = "block";
    document.getElementById("bodyly").style.display="block";
    document.getElementById("bodyly").style.width=document.body.clientWidth;   
    document.getElementById("bodyly").style.height=document.body.clientHeight;
    document.getElementById("SearchDivhire").style.display='block';
    if(navigator.appName.indexOf("Explorer") > -1)
    {
     document.getElementById("SearchDivhire").style.top=document.documentElement.scrollTop+50;   
     document.getElementById("SearchDivhire").style.left=document.body.clientWidth/2-270;
     
    }
    else
    {
    document.getElementById("SearchDivhire").style.left=270 + "px";
    document.getElementById("SearchDivhire").style.top =100 + "px";
     
    }

    str='';
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="3";document.'+fname+'.'+vname+'.value="近三天";unSearchLayers();>·近三天</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="7";document.'+fname+'.'+vname+'.value="近一周";unSearchLayers();>·近一周</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="14";document.'+fname+'.'+vname+'.value="近两周";unSearchLayers();>·近两周</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="30";document.'+fname+'.'+vname+'.value="近一月";unSearchLayers();>·近一月</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="60";document.'+fname+'.'+vname+'.value="近两月";unSearchLayers();>·近两月</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="182";document.'+fname+'.'+vname+'.value="近半年";unSearchLayers();>·近半年</li>'
    str+='<li style="float:left;width:170px;height:20px;cursor:pointer;" onmouseover=this.style.background="#F1F8FC" onmouseout=this.style.background="" onclick=document.'+fname+'.'+tname+'.value="365";document.'+fname+'.'+vname+'.value="近一年";unSearchLayers();>·近一年</li>'
    document.getElementById("hiretypes").innerHTML=str;
}

function CsbSearchLayers()
{   
	var objllist=document.getElementsByTagName('select');
	for(var i=0;i<objllist.length;i++)
	{
		objllist[i].style.visibility="";
	}
	document.getElementById("SearchDivhire").style.display  = "none";
	document.getElementById("bodyly").style.display="none";
	
	document.getElementById("xuan").innerHTML = '[点击确认选择]';
}


function unSearchLayers()
{   
	var objllist=document.getElementsByTagName('select');
	for(var i=0;i<objllist.length;i++)
	{
		objllist[i].style.visibility="";
	}
	document.getElementById("xuan").innerHTML = '[点击确认选择]';
	document.getElementById("positions").value = '默认不限';
	document.getElementById("position").value = '';
	document.getElementById("workadds").value = '默认不限';
	document.getElementById("workadd").value = '';
	document.getElementById("SearchDivhire").style.display  = "none";
	document.getElementById("bodyly").style.display="none";
}

<!--实现层移动-->
var mmm='';
document.onmouseup=MUp;
document.onmousemove=MMove;

function MDown(Object){
mmm=Object.id;
document.getElementById(mmm).setCapture();
pX=event.x-document.getElementById(mmm).style.pixelLeft;
pY=event.y-document.getElementById(mmm).style.pixelTop;
}

function MMove(){
if(mmm!=''){
document.getElementById(mmm).style.left=event.x-pX;
document.getElementById(mmm).style.top=event.y-pY;
}
}

function MUp(){
if(mmm!=''){
document.getElementById(mmm).releaseCapture();
mmm='';
}
}