﻿// JScript 文件
//最终赋值到的控件
var txtIndustryId;//显示索引行业编号控件的Id
var txtJobId;//显示岗位编号控件的Id
var txtPostId;//显示职位编号控件的Id
var txtPostName;//显示职位名称的控件Id
var x,y;
function SearchPost(Nowx,Nowy,ShowIndustryId,ShowJobId,ShowPostId,ShowPostName)
   {
    document.getElementById('SearchDiv').innerHTML='';
    x=Nowx;
    y=Nowy;
   txtIndustryId=ShowIndustryId;
   txtJobId=ShowJobId;
   txtPostId=ShowPostId;
   txtPostName=ShowPostName;
   startRequest('/SearchPost/SearchIndex.html',Postcallback);
   }
   
   //显示行业列表以供搜索
   
   function Postcallback()
   {
    if(y.length>1)
   {
   document.getElementById('SearchDiv').style.top=y;
   }
    if(x.length>1)
   {
        document.getElementById('SearchDiv').style.left=x;
   }
   //创建显示全部行业的层
   var ShowDiv=document.createElement("Div");
   var NowId='SearchPostDiv';
   ShowDiv.id=NowId;
   ShowDiv.style.position="relative";//relative
   ShowDiv.style.backgroundColor="#FFFFFF";
//   ShowDiv.style.height="300px";
//   ShowDiv.style.width="300px";
  // ShowDiv.style.border="#ffff00 2px solid";
   ShowDiv.style.width="900px";
  // ShowDiv.style.top=event.clientY+'px';
 //  ShowDiv.style.left='10px';
   ShowDiv.style.textAlign="left";
   ShowDiv.style.fontSize="12px"
   ShowDiv.style.lineHeight="25px"
   ShowDiv.style.padding="0px"
   ShowDiv.style.zIndex="2"
   //加载行业内容以及关闭按钮
   ShowDiv.innerHTML=''+returnDom;
   document.getElementById('SearchDiv').appendChild(ShowDiv);
   }
 //除行业DIV(大层)的方法
   function RemoveBigDiv()
   {
   Job=0;
    var RemovePostDiv=document.getElementById('SearchPostDiv');
   document.getElementById('SearchDiv').removeChild(RemovePostDiv);
   }
   
   
  //加载职位自定义模板
  var NowX='0px';//x坐标
  var NowY='0px';//y坐标
  var Industry=0;//行业编号
  var IndustryName='';//行业名称
  var Job=0;//岗位编号
  var Post=0;//职位编号
  
function ShowPost(IndustryId,JobId,NowIndustryName)
{
  GetPost(IndustryId,JobId,NowIndustryName);
}


  function GetPost(IndustryId,JobId,NowIndustryName)
  {
  //去除前一个职位显示列
   try
   {
     if(Job!="0")
   {
     RemoveSmallDiv(Job)
   }
   }
   catch(err)
   {

   }
 
   Industry=IndustryId;
   IndustryName=NowIndustryName;
   Job=JobId;
   startRequest('/Company/Offer/Ajax/GetPostList.aspx?IndustryId='+IndustryId+'&JobId='+JobId,Postcallback2);
  }
  
  function Postcallback2()
  {
    
  var line='';
  var ShowPost=new Array();
  ShowPost=returnDom.split("?");
  for(i=0;i<ShowPost.length;i++)
  {
    eval("Content="+ShowPost[i]);
    line+='<li style="text-align:left;" onclick=ab('+Content.value+',"'+Content.text+'")><div style="padding-left:15px; cursor:pointer; color:#267BA4; font-size:12px; width:180px;">'+Content.text+'</div></li>';
  }
   var ShowDiv=document.createElement("Div");
   var NowId='PostDiv'+Job
   ShowDiv.id=NowId;
//ShowDiv.style.position="absolute";//relative
   ShowDiv.style.backgroundColor="#F7FCFE";
////  ShowDiv.style.height="300px";
////  ShowDiv.style.width="300px";
   ShowDiv.style.border="#BFE7FA 2px solid";
//   ShowDiv.style.top=NowY+'px';
//   ShowDiv.style.left=NowX+'px';
   ShowDiv.style.fontSize="12px"
   ShowDiv.style.lineHeight="25px"
  ShowDiv.style.padding="5px"
 // ShowDiv.style.z-Index="3000"
  //加载职位内容以及关闭按钮
   ShowDiv.innerHTML='<UL><li><div style="margin:0 10px; border-bottom:1px #8DC1DA solid; width:180px;"><div style="float:left; height:20px; margin-left:2px;"><span style="color:#1F7097; font-size:14px;font-weight:bold; line-height:20px; padding-right:25px;">请选择职位</span></div><div style="float:right;margin-right:3px; height:20px;"><span onclick=RemoveSmallDiv("'+Job+'") style="cursor:pointer;"><img src="/Images/SearchImage2.jpg"/></span></div><div style="clear:both;"></div></div></li>'+line+'</UL>';
  
   document.getElementById('da'+Job).appendChild(ShowDiv);
   //document.getElementById('SearchPostDiv').appendChild(ShowDiv);
  }
  
  
  //去除显示职位的小DIV
function RemoveSmallDiv(NowJob)
{

 var RemovePostDiv=document.getElementById('PostDiv'+Job);
 document.getElementById('da'+NowJob).removeChild(RemovePostDiv); 
}


//确定搜索参数
function ab(PostId,PostName)
{
document.getElementById(txtPostName).value=PostName;
//document.getElementById(txtIndustryId).value=Industry;
document.getElementById(txtJobId).value=Job;
//alert(txtJobId);
if(document.getElementById('PostSeverName')!=null)
{
document.getElementById('PostSeverName').value=PostName;
}
document.getElementById(txtPostId).value=PostId;
Job=0;
RemoveBigDiv();

try
{
GetPost22();
}
catch(error)
{

}
}

function CheckPost()
{
RemoveBigDiv();
}
