jQuery.extend(Array.prototype,{remove:function(item){
	var array=this.clone();this.length=0;
	for(var i=0;i<array.length;i++){
		if(array[i].id!=item)this.push(array[i]);
		}return this;},has:function(item){
			for(var i=0;i<this.length;i++){if(this[i]==item)return true;
			if(typeof item=="object"&&this[i].id==item.id)return true;
			}return false;},GetFather:function(item){
				for(var i=0;i<this.length;i++){
					if(this[i].parObj==null)continue;
					if(this[i].parObj.id==item.id)return true;
					if(typeof item=="object"&&this[i].id==item.id)return true;
					}return false;},findById:function(id){
						for(var i=0;i<this.length;i++){
							if(this[i].id==id)return this[i];
							}return null;},
								clear:function(){this.length=0;return this;},clone:function(){return[].concat(this);}});
							var requestFromStr={QueryString:function(Str,val){    // requestFromStr 方法定义
							var uri=Str.substring(0,1)=="?"?Str:"?"+Str;var re=new RegExp("[&?]"+val+"=([^&?]*)","ig");
							return((uri.match(re))?(uri.match(re)[0].substr(val.length+2)):"");
							}};
							function locConverter(locIDs){var arrLoc=locIDs.split(",");
							var temp=[];
							for(var i=0;i<arrLoc.length;i++){temp.push(ConverterLoc(arrLoc[i]));
							}return temp;
							}function traversal(id,items){var p=items.findById(id);
							if(p!=null){return{id:p.id,name:p.name,parObj:null};
							}else{var subItems,c;for(var i=0;i<items.length;i++){
								p=items[i];c=p.subItems.findById(id);if(c!=null)return{
									id:c.id,name:c.name,parObj:{id:p.id,name:p.name,parObj:null}};
									}}return null;}function dbcToSbc(str){return str.replace(/（/g,"(").replace(/）/g,")");
									}
									var PopupSelector={loadSelected:function(url){
									var temp=[];
                                  var selCatParentIDs ="";/**  = __occParentIDList; 
									if(selCatParentIDs.indexOf(",")>0)selCatParentIDs=selCatParentIDs.split(",");
									else{selCatParentIDs=selCatParentIDs.replace(/%2C/g,"%2c");
									selCatParentIDs=selCatParentIDs.split("%2c");
									}**/
								   var selCatIDs = $("#init_position_level").val(); 
									if(selCatIDs.indexOf(",")>0)selCatIDs=selCatIDs.split(",");
									else{selCatIDs=selCatIDs.replace(/%2C/g,"%2c");
									selCatIDs=selCatIDs.split("%2c"); 
									}
		 var addCatID = "";
        if (addCatID != "") {
            selCatIDs.clear();
            selCatIDs[0] = addCatID;
        }
        this._selItems["cat"].clear();
        var allCats = getCat();
        if (addCatID != "" || selCatParentIDs == "") {
            var catItem;
            for (var i = 0; i < selCatIDs.length; i++) {
                catItem = traversal(selCatIDs[i], allCats);
                if (catItem != null) {
                    this._selItems["cat"].push(catItem);
                    temp.push(catItem.name);
                }
            }
        }
    
        if (selCatIDs.length > 0 && selCatIDs[0] != "" && selCatParentIDs != "" && addCatID == "") {
            for (var i = 0; i < selCatParentIDs.length; i++) {
                if (selCatParentIDs[i] == selCatIDs[i]) {
                    if (selCatIDs[i] != 255) { 
                        var catItem = allCats.findById(selCatIDs[i]);
                        this._selItems["cat"].push({
                            id: catItem.id,
                            name: catItem.name,
                            parObj: null
                        });
                        temp.push(catItem.name);
                    }
                }
																else{
																	var parCatItem=allCats.findById(selCatParentIDs[i]);
																	var subCatItem=parCatItem.subItems.findById(selCatIDs[i]);
																	this._selItems["cat"].push({id:subCatItem.id,name:subCatItem.name,parObj:{id:parCatItem.id,name:parCatItem.name,parObj:null}});
																	temp.push(subCatItem.name);}}}if(temp.length!=0){$("#txtCat").removeClass("inp_txt inp_txtsel inp_wl inp_cue");
																	$("#txtCat").addClass("inp_txt inp_txtsel inp_wl");
																	$("#txtCat").val(temp.join("+"));
																	}else{$("#txtCat").removeClass("inp_txt inp_txtsel inp_wl");
																	$("#txtCat").addClass("inp_txt inp_txtsel inp_wl inp_cue");
																	$("#txtCat").val("选择/修改");}temp.length=0;

																	var selLocParentIDs= "";
																	selLocParentIDs = locConverter(selLocParentIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
																	var selLocIDs=$("#init_work_area").val();
																	selLocIDs = locConverter(selLocIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));

																	var addLocID= "";
																	if(addLocID!=""){selLocIDs.clear();selLocIDs[0]=addLocID;}this._selItems["loc"].clear();
																	var allLocs=getLoc();
																	if(addLocID!=""||selLocParentIDs==""){
																		var locItem;for(var i=0;i<selLocIDs.length;i++){locItem=traversal(selLocIDs[i],allLocs); 
																		if(locItem!=null){this._selItems["loc"].push(locItem);temp.push(locItem.name);}}}
																		if(selLocIDs.length>0&&selLocIDs[0]!=""&&selLocParentIDs!=""&&addLocID==""){
																			for(var i=0;i<selLocParentIDs.length;i++){
																				if(selLocParentIDs[i]==selLocIDs[i]){
																					if(selLocIDs[i]!=255){
																						var locItem=allLocs.findById(selLocIDs[i]);
																						this._selItems["loc"].push({id:locItem.id,name:locItem.name,parObj:null});
																						temp.push(locItem.name);}}
																						else{if(selLocParentIDs[i]!="-1"){
																							var parLocItem=allLocs.findById(selLocParentIDs[i]);
																							var subLocItem=parLocItem.subItems.findById(selLocIDs[i]);
																							this._selItems["loc"].push({id:subLocItem.id,name:subLocItem.name,parObj:{id:parLocItem.id,name:parLocItem.name,parObj:null}});
																							temp.push(subLocItem.name);}else{locItem=traversal(selLocIDs[i],allLocs);
																							if(locItem!=null){this._selItems["loc"].push(locItem);
																							temp.push(locItem.name);}}}}}if(temp.length!=0){$("#txtLoc").removeClass("inp_txt inp_txtsel inp_wm inp_cue");
																							$("#txtLoc").addClass("inp_txt inp_txtsel inp_wm");
																							$("#txtLoc").val(temp.join("+"));}else{$("#txtLoc").removeClass("inp_txt inp_txtsel inp_wm");
																							$("#txtLoc").addClass("inp_txt inp_txtsel inp_wm inp_cue");
																							$("#txtLoc").val("选择/修改");}temp.length=0;

																							var selIndIDs=$("#init_industry").val() ;
																							selIndIDs=ConverterInd(selIndIDs.replace(/%2C/g,"%2c").replace(/%2c/g,",")).split(",");
																							var addIndID=requestFromStr.QueryString(url,"addIndIDList");
																							var allInds=getInd();
																							var addIndItem=allInds.findById(addIndID);
																							this._selItems["ind"].clear();
																							if(addIndItem!=null){this._selItems["ind"].push({id:addIndItem.id,name:addIndItem.name,parObj:null});
																							temp.push(addIndItem.name);}if(selIndIDs.length>0&&selIndIDs[0]!=""&&addIndItem==null){
																								for(var i=0;i<selIndIDs.length;i++){
																									if(selIndIDs[i]!=255){var indItem=allInds.findById(selIndIDs[i]);
																									if(indItem==null)continue;
																									this._selItems["ind"].push({id:indItem.id,name:indItem.name,parObj:null});
																									temp.push(indItem.name);}}}if(temp.length!=0){$("#txtInd").removeClass("inp_txt inp_txtsel inp_wm  inp_cue");
																									$("#txtInd").addClass("inp_txt inp_txtsel inp_wm");
																									$("#txtInd").val(temp.join("+"));
																									 }else{
																										 $("#txtInd").removeClass("inp_txt inp_txtsel inp_wm");
																										 $("#txtInd").addClass("inp_txt inp_txtsel inp_wm inp_cue");
                                                                                                         $("#txtInd").val("选择/修改");}temp.length=0;},


getvalue:function(type,ref,inva){
  //alert(type+","+ref+","+inva);
  if(type=='ind'){
    var temp=[];
    var selIndParentIDs= "";
	selIndParentIDs = locConverter(selIndParentIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
	var selIndIDs=$("#"+inva).val();
	selIndIDs = locConverter(selIndIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
   	var addIndID= "";
	if(addIndID!=""){addIndID.clear();addIndID[0]=addIndID;}this._selItems["ind"].clear();
	var allInds=getInd();
	if(addIndID!=""||selIndParentIDs==""){
	var indItem;for(var i=0;i<selIndIDs.length;i++){indItem=traversal(selIndIDs[i],allInds); 
	if(indItem!=null){this._selItems["ind"].push(indItem);temp.push(indItem.name);}}}
	
	if(selIndIDs.length>0&&selIndIDs[0]!=""&&selIndParentIDs!=""&&addIndID==""){
	for(var i=0;i<selIndParentIDs.length;i++){
	if(selIndParentIDs[i]==selIndIDs[i]){
	if(selIndIDs[i]!=255){
	var indItem=allInds.findById(selIndIDs[i]);
	this._selItems["ind"].push({id:addIndID.id,name:indItem.name,parObj:null});
	temp.push(indItem.name);}}
	else{if(selIndParentIDs[i]!="-1"){
	var parIndItem=allInds.findById(selIndParentIDs[i]);
	var subIndItem=parIndItem.subItems.findById(selIndIDs[i]);
	this._selItems["ind"].push({id:subIndItem.id,name:subIndItem.name,parObj:{id:parIndItem.id,name:parIndItem.name,parObj:null}});
	temp.push(subIndItem.name);}else{indItem=traversal(selIndIDs[i],allInds);
	if(indItem!=null){this._selItems["ind"].push(indItem);
	temp.push(indItem.name);}}}}} 
  }   //type=ind
   if(type=='jrind'){
    var temp=[];
    var selIndParentIDs= "";
	selIndParentIDs = locConverter(selIndParentIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
	var selIndIDs=$("#"+inva).val();
	selIndIDs = locConverter(selIndIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
   	var addIndID= "";
	if(addIndID!=""){addIndID.clear();addIndID[0]=addIndID;}this._selItems["jrind"].clear();
	var allInds=getInd();
	if(addIndID!=""||selIndParentIDs==""){
	var indItem;for(var i=0;i<selIndIDs.length;i++){indItem=traversal(selIndIDs[i],allInds); 
	if(indItem!=null){this._selItems["jrind"].push(indItem);temp.push(indItem.name);}}}
	
	if(selIndIDs.length>0&&selIndIDs[0]!=""&&selIndParentIDs!=""&&addIndID==""){
	for(var i=0;i<selIndParentIDs.length;i++){
	if(selIndParentIDs[i]==selIndIDs[i]){
	if(selIndIDs[i]!=255){
	var indItem=allInds.findById(selIndIDs[i]);
	this._selItems["jrind"].push({id:addIndID.id,name:indItem.name,parObj:null});
	temp.push(indItem.name);}}
	else{if(selIndParentIDs[i]!="-1"){
	var parIndItem=allInds.findById(selIndParentIDs[i]);
	var subIndItem=parIndItem.subItems.findById(selIndIDs[i]);
	this._selItems["jrind"].push({id:subIndItem.id,name:subIndItem.name,parObj:{id:parIndItem.id,name:parIndItem.name,parObj:null}});
	temp.push(subIndItem.name);}else{indItem=traversal(selIndIDs[i],allInds);
	if(indItem!=null){this._selItems["jrind"].push(indItem);
	temp.push(indItem.name);}}}}} 
  }   //type=ind
 if(type=='cat'){
 	var temp=[];
    var selCatParentIDs ="";
	var selCatIDs = $("#"+inva).val(); 
	if(selCatIDs.indexOf(",")>0)selCatIDs=selCatIDs.split(",");
	else{selCatIDs=selCatIDs.replace(/%2C/g,"%2c");
	selCatIDs=selCatIDs.split("%2c"); 
	}
		 var addCatID = "";
        if (addCatID != "") {
            selCatIDs.clear();
            selCatIDs[0] = addCatID;
        }
        this._selItems["cat"].clear();
        var allCats = getCat();
        if (addCatID != "" || selCatParentIDs == "") {
            var catItem;
            for (var i = 0; i < selCatIDs.length; i++) {
                catItem = traversal(selCatIDs[i], allCats);
                if (catItem != null) {
                    this._selItems["cat"].push(catItem);
                    //temp.push(catItem.name);
                }
            }
        }
        if (selCatIDs.length > 0 && selCatIDs[0] != "" && selCatParentIDs != "" && addCatID == "") {
              for (var i = 0; i < selCatParentIDs.length; i++) {
                if (selCatParentIDs[i] == selCatIDs[i]) {
                    if (selCatIDs[i] != 255) { 
                        var catItem = allCats.findById(selCatIDs[i]);
                        this._selItems["cat"].push({id: catItem.id,name: catItem.name,parObj: null});
                        //temp.push(catItem.name);
                    }
                }
			else{
			var parCatItem=allCats.findById(selCatParentIDs[i]);
			var subCatItem=parCatItem.subItems.findById(selCatIDs[i]);
			this._selItems["cat"].push({id:subCatItem.id,name:subCatItem.name,parObj:{id:parCatItem.id,name:parCatItem.name,parObj:null}});
			//temp.push(subCatItem.name);
			}}}
 }   //type=cat
 
 if(type=='loc'){
    var temp=[];
    var selLocParentIDs= "";
	selLocParentIDs = locConverter(selLocParentIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
	var selLocIDs=$("#"+inva).val();
	selLocIDs = locConverter(selLocIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
   	var addLocID= "";
	if(addLocID!=""){selLocIDs.clear();selLocIDs[0]=addLocID;}this._selItems["loc"].clear();
	var allLocs=getLoc();
	if(addLocID!=""||selLocParentIDs==""){
	var locItem;for(var i=0;i<selLocIDs.length;i++){locItem=traversal(selLocIDs[i],allLocs); 
	if(locItem!=null){this._selItems["loc"].push(locItem);temp.push(locItem.name);}}}
	if(selLocIDs.length>0&&selLocIDs[0]!=""&&selLocParentIDs!=""&&addLocID==""){
	for(var i=0;i<selLocParentIDs.length;i++){
	if(selLocParentIDs[i]==selLocIDs[i]){
	if(selLocIDs[i]!=255){
	var locItem=allLocs.findById(selLocIDs[i]);
	this._selItems["loc"].push({id:locItem.id,name:locItem.name,parObj:null});
	temp.push(locItem.name);}}
	else{if(selLocParentIDs[i]!="-1"){
	var parLocItem=allLocs.findById(selLocParentIDs[i]);
	var subLocItem=parLocItem.subItems.findById(selLocIDs[i]);
	this._selItems["loc"].push({id:subLocItem.id,name:subLocItem.name,parObj:{id:parLocItem.id,name:parLocItem.name,parObj:null}});
	temp.push(subLocItem.name);}else{locItem=traversal(selLocIDs[i],allLocs);
	if(locItem!=null){this._selItems["loc"].push(locItem);
	temp.push(locItem.name);alert(locItem.name);}}}}} 
 } //type=loc
 
 if(type=='major'){
    var temp=[];
    var selMajorParentIDs= "";
	selMajorParentIDs = locConverter(selMajorParentIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
	var selMajorIDs=$("#"+inva).val();
	selMajorIDs = locConverter(selMajorIDs.replace(/%2C/g, "%2c").replace(/%2c/g, ","));
   	var addMajorID= "";
	if(addMajorID!=""){addMajorID.clear();addMajorID[0]=addMajorID;}this._selItems["major"].clear();
	var allMajors=getMajor();
	if(addMajorID!=""||selMajorParentIDs==""){
	var majorItem;for(var i=0;i<selMajorIDs.length;i++){majorItem=traversal(selMajorIDs[i],allMajors); 
	if(majorItem!=null){this._selItems["major"].push(majorItem);temp.push(majorItem.name);}}}
	
	if(selMajorIDs.length>0&&selMajorIDs[0]!=""&&selMajorParentIDs!=""&&addMajorID==""){
	for(var i=0;i<selMajorParentIDs.length;i++){
	if(selMajorParentIDs[i]==selMajorIDs[i]){
	if(selMajorIDs[i]!=255){
	var majorItem=allMajors.findById(selMajorIDs[i]);
	this._selItems["major"].push({id:majorItem.id,name:majorItem.name,parObj:null});
	temp.push(majorItem.name);}}
	else{if(selMajorParentIDs[i]!="-1"){
	var parMajorItem=allMajors.findById(selMajorParentIDs[i]);
	var subMajorItem=parMajorItem.subItems.findById(selMajorIDs[i]);
	this._selItems["major"].push({id:subMajorItem.id,name:subMajorItem.name,parObj:{id:parMajortem.id,name:parMajorItem.name,parObj:null}});
	temp.push(subMajorItem.name);}else{majorItem=traversal(selMajorIDs[i],allMajors);
	if(majorItem!=null){this._selItems["major"].push(majorItem);
	temp.push(majorItem.name);}}}}} 
 } //type=major
},
popup:function(type,ref,inval,intype){
PopupSelector.getvalue(type,ref,inval);
_inputType="";
if(intype=="radio"){_inputType=intype;}
if(this._box==null)this._box=$("#popupSelector");
if(this._subBox==null)this._subBox=document.getElementById("subItems");
this._ref=ref;this._type=type.toString().toLowerCase();this._inval=inval;
this._curItems=this._selItems[this._type].clone();
var offset=$(ref).offset();
this._style.left=offset.left;

var srcWidth=window.screen.availWidth/2;
 if(this._type=="cat"){
  this._style.left=srcWidth-363;
 }
 if(this._type=="loc"){
  this._style.left=srcWidth-233;
 }
if(this._type=="major" || this._type=="jrind"){
  this._style.left=srcWidth-333;
 }

this._style.top=offset.top;
this.render();},render:function(){var pos={top:(this._style.top+this._style.offset.levelOne.Y),left:this._style.left+this._style.offset.levelOne.X};
if(this._type!="cat"&&this._type!="comptype"){if(document.location.href.toLowerCase().indexOf("searchjob.chinahr.com")>-1)pos.left-=(this._style.width[this._type]-384);
else if(this._type=="jrind");
else if(this._type=="loc"); 
}
var remainHeight=$(window).height()-pos.top+document.documentElement.scrollTop;
if(remainHeight<this._style.height[this._type])pos.top=pos.top-(this._style.height[this._type]-remainHeight);
if(this._style.height[this._type]>$(window).height())pos.top=document.documentElement.scrollTop;
var pslayer=$("#pslayer"); //alert(this._types.length); alert(this._types);
for(var i=0;i<this._types.length;i++){
	   pslayer.removeClass(this._style.className.levelOne[this._types[i]]);
	   	}pslayer.addClass(this._style.className.levelOne[this._type]);

$("#selectingHeader").html(this._gtYourSelected[this._type]);
$("#psHeader").html(this._gtPopupSelectorHeader[this._type]);
var html=[]; /**---------------------  major---------------- **/
var parItems=this.allItems[this._type]();
var start=0;
var end=parItems.length;    //各项数组长度
if(this._type=="loc"){
if(_inputType=="radio"){start=1;end=36;                  //地区选项
/**$("#subHeader1").html("<span>所有省市：</span>");
$("#subHeader2").html("<span>其它国家和地区：</span>").show(); **/
for(var i=end;i<parItems.length;i++){html.push("<li style=text-align:left id=$"+i+" class=\"nonelay\" name="+parItems[i].id+"><a href=\"###\">");
html.push("<label style=text-align:left for=\"pcbx");
html.push(parItems[i].id);html.push("\">");
html.push("<input name=\"pcbx\" id=\"pcbx");
html.push(parItems[i].id);html.push("\" type=\"radio\" value=\"");
html.push(parItems[i].id);html.push("@");
html.push(parItems[i].name);html.push("\"");
if(this._curItems.has({id:parItems[i].id,name:parItems[i].name,parObj:null}))html.push(" checked");
html.push(" onclick=\"PopupSelector.click("+i+",this, null,"+parItems[i].id+")\" />");
html.push(parItems[i].name);html.push("</label>");
html.push("</a></li>");}
  $("#subHeader1").show();
  $("#subHeader2").show();
  $("#allItems2").html(html.join("")).show();
  }else{
 start=1;end=36;                  //地区选项
/**$("#subHeader1").html("<span>所有省市：</span>");
$("#subHeader2").html("<span>其它国家和地区：</span>").show();**/
for(var i=end;i<parItems.length;i++){html.push("<li style=text-align:left id=$"+i+" class=\"nonelay\" name="+parItems[i].id+"><a href=\"javascript:void(0);\">");
html.push("<label style=text-align:left for=\"pcbx");
html.push(parItems[i].id);html.push("\">");
html.push("<input id=\"pcbx");
html.push(parItems[i].id);html.push("\" type=\"checkbox\" value=\"");
html.push(parItems[i].id);html.push("@");
html.push(parItems[i].name);html.push("\"");
if(this._curItems.has({id:parItems[i].id,name:parItems[i].name,parObj:null}))html.push(" checked");
html.push(" onclick=\"PopupSelector.click("+i+",this, null,"+parItems[i].id+")\" />");
html.push(parItems[i].name);html.push("</label>");
html.push("</a></li>");}
  $("#subHeader1").show();
  $("#subHeader2").show();
  $("#allItems2").html(html.join("")).show(); 
   }
  }else{$("#subHeader1").hide();
 $("#subHeader2").hide();
 $("#allItems2").hide();} 
 if(_inputType=="radio"){ //单选项 
 html=[];
 for(var i=start;i<end;i++){var parItem=parItems[i];
 if(parItem.subItems&&parItem.subItems.length>1){
	 if(this._type!="ind"){
		 if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null})||this._curItems.GetFather({id:parItem.id,name:parItem.name,parObj:null}))
html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"layicon\" onmouseover=\"PopupSelector.showSubItems(");
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" onmouseover=\"PopupSelector.showSubItems(");
	 }
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" onmouseover=\"PopupSelector.showSubItems(");
	 html.push(i);html.push(", this, true)\" onmouseout=\"PopupSelector.hideSubItems(this)\">");
	 }
	 else{if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null}))
html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"layon\">");
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"nonelay\">");
	 }
	  html.push("<a href=\"javascript:void(0);\">");
	 if(this._type=="ind"||(    //行业选项
		 this._type=="loc"&&parItem.subItems.length==1)){html.push("<label for=\"pcbx");
	 html.push(parItem.id);html.push("\">"); }
	 html.push("<input name=\"pcbx\" id=\"pcbx");
	 html.push(parItem.id);
	 html.push("\" type=\"radio\" value=\"");
	 html.push(parItem.id);
	 html.push("@");
	 html.push(parItem.name);
	 html.push("\"");
	 if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null}))html.push(" checked");
	 html.push(" onclick=\"PopupSelector.click(");html.push(i+",this, null,"+parItem.id+")\" />");
	 html.push(dbcToSbc(parItem.name));
	 if(this._type=="ind"||this._type=="major"||this._type=="jrind"||(this._type=="loc"&&parItem.subItems.length==1)){html.push("</label>");
	 }
	 html.push("</a></li>");
	 }
	   }else{
	   
	    html=[];
 for(var i=start;i<end;i++){var parItem=parItems[i];
 if(parItem.subItems&&parItem.subItems.length>1){
	 if(this._type!="indzz"){
		 if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null})||this._curItems.GetFather({id:parItem.id,name:parItem.name,parObj:null}))
html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"layicon\" onmouseover=\"PopupSelector.showSubItems(");
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" onmouseover=\"PopupSelector.showSubItems(");
	 }
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" onmouseover=\"PopupSelector.showSubItems(");
	 html.push(i);html.push(", this, true)\" onmouseout=\"PopupSelector.hideSubItems(this)\">");
	 }
	 else{if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null}))
html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"layon\">");
	 else html.push("<li style=text-align:left id=$"+i+" name="+parItem.id+" class=\"nonelay\">");
	 }
	  html.push("<a href=\"javascript:void(0);\">");
	 if(this._type=="ind"||(    //行业选项
		 this._type=="loc"&&parItem.subItems.length==1)){html.push("<label for=\"pcbx");
	 html.push(parItem.id);html.push("\">"); }
	 html.push("<input id=\"pcbx");
	 html.push(parItem.id);
	 html.push("\" type=\"checkbox\" value=\"");
	 html.push(parItem.id);
	 html.push("@");
	 html.push(parItem.name);
	 html.push("\"");
	 if(this._curItems.has({id:parItem.id,name:parItem.name,parObj:null}))html.push(" checked");
	 html.push(" onclick=\"PopupSelector.click(");html.push(i+",this, null,"+parItem.id+")\" />");
	 html.push(dbcToSbc(parItem.name));
	 if(this._type=="ind"||this._type=="major"||this._type=="jrind"||(this._type=="loc"&&parItem.subItems.length==1)){html.push("</label>");
	 }
	 html.push("</a></li>");
	   }
	}
	   //$("#shtml").html(html.join("").toString());
	//alert(html.join("").toString());    //页面显示
	   $("#allItems1").html(html.join("").toString());
	 html.length=0;
	 $("#divSelecting").css("display",(this._curItems.length==0)?"none":"block");
	 var displayNoSelected=(this._curItems.length==0)?"block":"none";
	 if(this._type=="cat"){if(_inputType=="radio"){$("#noSelectedCat_OnlyOne").css("display",displayNoSelected);$("#noSelectedCat").hide();}else{$("#noSelectedCat_OnlyOne").hide();$("#noSelectedCat").css("display",displayNoSelected);} $("#noSelectedLoc_OnlyOne").hide();$("#noSelectedMajor_OnlyOne").hide();$("#noSelectedLoc").hide();$("#noSelectedMajor").hide();$("#noSelectedJrInd").hide();}
	 else if(this._type=="loc"){if(_inputType=="radio"){$("#noSelectedLoc_OnlyOne").css("display",displayNoSelected);$("#noSelectedLoc").hide();}else{$("#noSelectedLoc_OnlyOne").hide();$("#noSelectedLoc").css("display",displayNoSelected);} $("#noSelectedMajor_OnlyOne").hide();$("#noSelectedCat_OnlyOne").hide();$("#noSelectedCat").hide();$("#noSelectedMajor").hide();$("#noSelectedJrInd").hide();}
	 else if(this._type=="major"){ if(_inputType=="radio"){$("#noSelectedMajor_OnlyOne").css("display",displayNoSelected);$("#noSelectedMajor").hide();}else{$("#noSelectedMajor_OnlyOne").hide();$("#noSelectedMajor").css("display",displayNoSelected);} $("#noSelectedLoc_OnlyOne").hide();$("#noSelectedCat_OnlyOne").hide();$("#noSelectedCat").hide();$("#noSelectedLoc").hide();$("#noSelectedJrInd").hide();}
	 else if(this._type=="jrind"){$("#noSelectedJrInd").css("display",displayNoSelected);$("#noSelectedLoc_OnlyOne").hide();$("#noSelectedMajor_OnlyOne").hide();$("#noSelectedCat_OnlyOne").hide();$("#noSelectedCat").hide();$("#noSelectedLoc").hide();$("#noSelectedMajor").hide();}
	 else{$("#noSelectedCat").hide();$("#noSelectedLoc_OnlyOne").hide();$("#noSelectedMajor").hide();
	 $("#noSelectedLoc").hide();$("#noSelectedJrInd").hide();$("#noSelectedCat_OnlyOne").hide();$("#noSelectedMajor_OnlyOne").hide();}for(var i=0;i<this._curItems.length;i++){html.push("<li style=text-align:left id=\"");
	 html.push(this._curItems[i].id);
	 html.push("\"><a href=\"javascript:void(0);\" onclick=\"PopupSelector.remove(");
	 html.push(this._curItems[i].id);
	 if(this._curItems[i].parObj!=null)html.push(","+this._curItems[i].parObj.id+")\">"); 
	 else html.push(")\">");html.push(dbcToSbc(this._curItems[i].name));     // 以选择项ID:name alert(this._curItems[i].id+":"+this._curItems[i].name);
	 html.push("</a></li>");}
	    // alert(html.join(""));
	 $("#selecting").html(html.join(""));   // 已选择项代码
	 if(this._type=="ind"){$("#divSelecting").show();$("#selecting").hide();
	 }else $("#selecting").show();
	 $("#shield").width(this._style.width[this._type]).height(this._style.height[this._type]);
	 $(this._box).css(pos).show();
	 $("#mask").height($(document).height()).show();},
		 close:function(){$("#mask").hide();
	 this._ref=null;$(this._box).hide();},OK:function(){  // 向表单传值
		 var temp=[];
		 var tempid=[];
		 jQuery.each(this._curItems,function(){temp.push(this.name); });
		 if(temp.length!=0){if(this._type=="cat"){$("#txtCat").removeClass("inp_txt inp_txtsel inp_wl inp_cue");
		 $("#txtCat").addClass("inp_txt inp_txtsel inp_wl");
		  jQuery.each(this._curItems,function(){tempid.push(this.id); });
		  if(tempid.length!=0){$("#init_position_level").val(tempid);$("#"+this._inval).val(tempid);}
		 }
		 
		 if(this._type=="loc"||this._type=="ind"){$(this._ref).removeClass("inp_txt inp_txtsel inp_wm inp_cue");
		 $(this._ref).addClass("inp_txt inp_txtsel inp_wm");}
		  $(this._ref).val( getTopStr(dbcToSbc(temp.join("+")),10));
		  // alert( getTopStr(dbcToSbc(temp.join("+")),10));  放入页面表单的值
		  jQuery.each(this._curItems,function(){tempid.push(this.id); });
		  if(tempid.length!=0){
			  if(this._type=="loc"){
                  $("#init_work_area").val(tempid);
                  $("#"+this._inval).val(tempid);
			  }
			  else if(this._type=="ind"){
                   $("#init_industry").val(tempid);
                   $("#"+this._inval).val(tempid);
			   }
			   else if(this._type=="jrind"){
                   $("#init_industry").val(tempid);
                   $("#"+this._inval).val(tempid);
			   }
			   else if(this._type=="major"){
                   $("#init_major").val(tempid);
                   $("#"+this._inval).val(tempid);
			   }
			  }
		 }else{if(this._type=="cat"){
			 $("#txtCat").removeClass("inp_txt inp_txtsel inp_wl");$("#txtCat").addClass("inp_txt inp_txtsel inp_wl inp_cue");
			 $(this._ref).val("选择/修改");$("#init_position_level").val("");$("#"+this._inval).val("");}
			 if(this._type=="major"){
			 $(this._ref).val("选择/修改");$("#"+this._inval).val(tempid);
			 }
			  if(this._type=="jrind"){
			 $(this._ref).val("选择/修改");$("#"+this._inval).val(tempid);
			 }
			 if(this._type=="loc"){$("#txtLoc").removeClass("inp_txt inp_txtsel inp_wm");
			 $("#txtLoc").addClass("inp_txt inp_txtsel inp_wm inp_cue");$(this._ref).val("选择/修改");$("#"+this._inval).val(tempid); $("#init_work_area").val("");
			 }
			 if(this._type=="ind"){
				 $("#txtInd").removeClass("inp_txt inp_txtsel inp_wm");$("#txtInd").addClass("inp_txt inp_txtsel inp_wm inp_cue");
				 $(this._ref).val("选择/修改"); $("#"+this._inval).val(tempid); $("#init_industry").val("");}}this._ref=null;this._selItems[this._type]=this._curItems.clone();this._curItems.clear();

				 $("#selecting").html("");$("#mask").hide();$(this._box).hide();},empty:function(){$("#selecting").html(""); $("#"+this._inval).val("");           //选择成功并关闭层

				 $("#allItems1 input").each(function(i){this.checked=false;});$("#allItems2 input").each(function(i){this.checked=false;});
				 $("#allItems1 li").each(function(i){if(this.className=="layicon")this.className="";
				 if(this.className=="layon")this.className="nonelay";});
				 this._curItems.clear();PopupSelector.showtips();},click:function(ref,cbx,parObj){
				 if(_inputType=="radio"){
				      $("#selecting").html("");
				      this._curItems.clear();
				     }
				     //--------------------------------------------------------------------------------------------
				     if(this._type=="loc"){
				      if(cbx.checked&&this._curItems.length==this._maxSize){
					   alert(this._gtAreaMaxLimit);cbx.checked=false;return;}
				      }else{
				      var vflag=0;
				      var ids= $(cbx).val().toString().split("@")[0];
				      jQuery.each(this._curItems,function(){if(this.id == ids){vflag++;}});
				      if(vflag==0){
				      var bigTypeCounts=0;
				      jQuery.each(this._curItems,function(){if(this.parObj == null){bigTypeCounts++;}});
				      if((cbx.checked&&this._curItems.length==this._maxSize)){
					   alert(this._gtMaxLimit);cbx.checked=false;return;
					   }
				      }
					 }
					 var item={id:cbx.value.split("@")[0],name:cbx.value.split("@")[1],parObj:parObj};
					 var selecting=document.getElementById("selecting");
					 var selItem=null;if(cbx.checked){selItem=document.createElement("li");
					 selItem.id=item.id;
					 if(parObj==null)selItem.innerHTML="<a href=\"javascript:void(0);\" onclick=\"PopupSelector.remove("+item.id+",null);\">"+dbcToSbc(item.name)+"</a>";
					 else selItem.innerHTML="<a href=\"javascript:void(0);\" onclick=\"PopupSelector.remove("+item.id+","+parObj.id+");\">"+dbcToSbc(item.name)+"</a>";
					 selecting.appendChild(selItem);this._curItems.push(item);                          // 增加子类别项
					 if(_inputType=="radio"){$("#subItems").hide();PopupSelector.OK();} //关闭单选
					 if(parObj!=null){document.getElementById('^'+ref).className="layon";
					 var id=parObj.id;$("li[@name="+id+"]").addClass("layicon");}this.showHideSelecting(this);
					 }else{selItem=document.getElementById(item.id);selecting.removeChild(selItem);
					 this._curItems.remove(item.id);if(parObj!=null){document.getElementById('^'+ref).className="";
					 var id=parObj.id;if($("#subItems ol").html().indexOf('CHECKED')<0)$("li[@name="+id+"]").removeClass("layicon");
					 }PopupSelector.showtips();}if(parObj==null){var parItems=this.allItems[this._type]();parItem=parItems[ref];
					 if(cbx.checked){if(parItem.subItems&&parItem.subItems.length>1)document.getElementById('$'+ref).className="layicon";
					 else document.getElementById('$'+ref).className="layon";}else{if((parItem.subItems&&parItem.subItems.length>1))
						 document.getElementById('$'+ref).className="";else document.getElementById('$'+ref).className="nonelay";
					 }var array=this._curItems.clone();this._curItems.clear();
					 for(var i=0;i<array.length;i++){
						 if(array[i].parObj!=null&&array[i].parObj.id==item.id){selecting.removeChild(document.getElementById(array[i].id));
						 }
						 else{this._curItems.push(array[i]);}}
						 $("#subItems input").each(function(i){this.checked=this.disabled=cbx.checked;});
						 if(cbx.checked)$("#subItems li").each(function(i){this.className="layon";});
						 else $("#subItems li").each(function(i){this.className="";});}},showtips:function(){if(this._curItems.length==0){
							 if(this._type!="indzzz")$("#divSelecting").css("display","none");if(this._type=="cat"){
							 if(_inputType=="radio"){$("#noSelectedCat_OnlyOne").show();}else{$("#noSelectedCat").show();}
								 $("#noSelectedLoc").hide();$("#noSelectedMajor").hide();
							     $("#noSelectedJrInd").hide();}if(this._type=="loc"){
							     if(_inputType=="radio"){$("#noSelectedLoc_OnlyOne").show();}else{$("#noSelectedLoc").show();}
								 $("#noSelectedCat").hide();$("#noSelectedMajor").hide();
								 $("#noSelectedJrInd").hide();
								 }if(this._type=="major"){
								 if(_inputType=="radio"){$("#noSelectedMajor_OnlyOne").show();}else{$("#noSelectedMajor").show();}
								 $("#noSelectedCat").hide();
								 $("#noSelectedLoc").hide();$("#noSelectedJrInd").hide();
								 }if(this._type=="jrind"){
								 $("#noSelectedCat").hide();$("#noSelectedJrInd").show();
								 $("#noSelectedLoc").hide();$("#noSelectedMajor").hide();
								 }}},remove:function(id,parObj){
									 document.getElementById("selecting").removeChild(document.getElementById(id));
									 var pcbx=document.getElementById("pcbx"+id);if(pcbx)pcbx.checked=false;
									 var pc=document.getElementById(id);if(pc)pcbx.checked=false;
									 var array=this._curItems.clone();
									 this._curItems.clear();
									 for(var i=0;i<array.length;i++){
										 if(array[i].id!=id)this._curItems.push(array[i]);}if(parObj==null){$("li[@name="+id+"]").removeClass("layicon");
										 $("li[@name="+id+"]").removeClass("layon");
										 var parItems=this.allItems[this._type]();
										 for(var j=0;j<parItems.length;j++){
											 var parItem=parItems[j];
											 if(parItem.id==id){
												 if(parItem.subItems&&parItem.subItems.length==1)$("li[@name="+id+"]").addClass("nonelay");}}}else if(!(this._curItems.GetFather({id:parObj,name:null,parObj:null})))
$("li[@name="+parObj+"]").removeClass("layicon");
												 PopupSelector.showtips();},showHideSelecting:function(selector){$("#noSelectedCat").hide();$("#noSelectedMajor").hide();
												 $("#noSelectedLoc").hide();$("#noSelectedJrInd").hide();if(selector._curItems.length>0){
													 $("#divSelecting").show();}},
														 showSubItems:function(index,ref,isDelay,ev){
														 var subItems=$("#subItems");
													 if(this._hideTimer)clearTimeout(this._hideTimer);
													 if(this._showTimer)clearTimeout(this._showTimer);
													 if(index==this._lastPopupIndex&&subItems.css("display")=="block"){ $(ref).addClass("layshow");
													 return;}if(!isDelay)loadSubItems(index,ref,this);var self=this;
													 this._showTimer=setTimeout(function(){loadSubItems(index,ref,self);},this._delay);
													 function loadSubItems(index,ref,self){var parItem=self.allItems[self._type]()[index];
													 var offset=$(ref).offset();var pos={top:offset.top+self._style.offset.levelTwo[self._type].Y,left:offset.left+self._style.offset.levelTwo[self._type].X};
													 var actualSubItemCount=parItem.subItems.length-1;
													 var calItemCount=(actualSubItemCount%2==0)?actualSubItemCount/2:(actualSubItemCount/2+1);
													 if(actualSubItemCount<=self._oneColumnLimit[self._type])calItemCount=actualSubItemCount;
													 var subBoxHeight=self._style.lineHeight*parseInt(calItemCount)+self._style.topBottomMargin;
													 var winHeight=$(window).height();
													 var remainHeight=winHeight-pos.top+document.documentElement.scrollTop;
													 if(remainHeight<subBoxHeight)pos.top=pos.top-(subBoxHeight-remainHeight);
													 if(subBoxHeight>winHeight)pos.top=document.documentElement.scrollTop;
													 var parentChecked=(ref.getElementsByTagName("input")[0].checked==true)?" checked disabled ":"";
													 var item={id:parItem.id,name:parItem.name,parObj:null};
													 if(_inputType=="radio"){//单选项
													 var html=[];html.push("<ol>");for(var i=1;i<parItem.subItems.length;i++){
														 var subItem=parItem.subItems[i];subItem.parObj=item;
														 if(ref.getElementsByTagName("input")[0].checked==true||self._curItems.has(subItem)){html.push("<li style=text-align:left id=^"+i+" class=\"layon\"  >");
														 }else html.push("<li style=text-align:left id=^"+i+"  >");
														 html.push("<a href=\"javascript:void(0);\"><label for=\"scbx");
														 html.push(subItem.id);html.push("\"><input id=\"scbx");html.push(subItem.id);
														 html.push("\" type=\"radio\" name=\"pcbx\" value=\"");
														 html.push(subItem.id);html.push("@");
														 html.push(subItem.name);
														 html.push("\"");html.push(parentChecked);
														 if(self._curItems.has(subItem))html.push(" checked");
														 html.push(" onclick=\"PopupSelector.click("+i+",this, { id: ");
														 html.push(parItem.id);html.push(", name: '");
														 html.push(parItem.name);html.push("', parObj: null }");
														 html.push(",'')\" />");
														 html.push(dbcToSbc(subItem.name));
														 html.push("</label></a></li>");
														 }html.push("</ol>");
														 }else{
														 var html=[];html.push("<ol>");for(var i=1;i<parItem.subItems.length;i++){
														 var subItem=parItem.subItems[i];subItem.parObj=item;
														 if(ref.getElementsByTagName("input")[0].checked==true||self._curItems.has(subItem)){html.push("<li style=text-align:left id=^"+i+" class=\"layon\"  >");
														 }else html.push("<li style=text-align:left id=^"+i+"  >");
														 html.push("<a href=\"javascript:void(0);\"><label for=\"scbx");
														 html.push(subItem.id);html.push("\"><input id=\"scbx");html.push(subItem.id);
														 html.push("\" type=\"checkbox\" value=\"");
														 html.push(subItem.id);html.push("@");
														 html.push(subItem.name);
														 html.push("\"");html.push(parentChecked);
														 if(self._curItems.has(subItem))html.push(" checked");
														 html.push(" onclick=\"PopupSelector.click("+i+",this, { id: ");
														 html.push(parItem.id);html.push(", name: '");
														 html.push(parItem.name);html.push("', parObj: null }");
														 html.push(",'')\" />");
														 html.push(dbcToSbc(subItem.name));
														 html.push("</label></a></li>");
														 }html.push("</ol>");
														}
														 // alert(html);
														 var subBox=$("#subBox");
														 for(var i=0;i<self._types.length;i++){
															 subItems.removeClass(self._style.className.levelTwo1[self._types[i]]);
															 subItems.removeClass(self._style.className.levelTwo2[self._types[i]]);
															 }
															 var levelTwo=(actualSubItemCount>self._oneColumnLimit[self._type])?self._style.className.levelTwo2[self._type]:self._style.className.levelTwo1[self._type];
															 if(self._type=="loc"){
																 if(parItem.id=="8000"||parItem.id=="15000"){
																	 levelTwo=self._style.className.levelTwo1[self._type];
																	 }}
																	 self._lastPopupIndex=index;
																	 $("#subItems").hover(function(e){self.showSubItems(index,ref,true,e);},function(e){self.hideSubItems(ref);});
																	 subBox.html(html.join(""));
																	 subItems.addClass(levelTwo).css(pos).show();}},hideSubItems:function(ref){
																		 $(ref).removeClass("layshow");if(this._showTimer)clearTimeout(this._showTimer);
																		 if(this._hideTimer)clearTimeout(this._hideTimer);
																		 this._hideTimer=setTimeout(function(){ $("#subItems").hide();},100); },
																			 
																		 //变量定义开始
																			      _showTimer:null,
																			      _hideTimer:null,
																			      _inputType:null,
																				 _lastPopupIndex:null,
																				 _box:null,_subbox:null,
																				 _ref:null,_type:null,
																				 _types:["cat","ind","loc","comptype","major","jrind"],
																				 _maxSize:5,
																				 _curItems:[],
																				 _selItems:{cat:[],loc:[],ind:[],comptype:[],major:[],jrind:[]},
																				 _gtMaxLimit:"对不起,您的已选项已经达到了5项.请减少已选项,再继续选择",
																				 _gtAreaMaxLimit:"对不起,您的选项已经达到了5项.请减少已选项,再继续选择",
																				 _gtYourSelected:{cat:"您选择的职位类别是：",ind:"您最多可以选择５个行业类别",loc:"您选择的工作地点是：",comptype:"您选择的公司性质是：",major:"您选择的专业是：",jrind:"您最多可以选择５个行业类别"},
																				 _gtPopupSelectorHeader:{cat:"职位类别",ind:"行业类别",loc:"地点",comptype:"公司性质",major:"专业",jrind:"行业类别"},
																				 _oneColumnLimit:{cat:12,loc:11},
																				 _delay:500,
																				 _style:{className:{levelOne:{"cat":"lay_wlsh","loc":"lay_wls","ind":"lay_wl","comptype":"lay_wms","major":"lay_wlsh","jrind":"lay_wlsh"},
																				 levelTwo1:{"cat":"lay_wssh","loc":"lay_wss","ind":"lay_wm","comptype":"","major":"lay_wssh","jrind":"lay_wssh"},
																				 levelTwo2:{"cat":"lay_wsh","loc":"lay_ws","ind":"lay_wl2","comptype":"","major":"lay_wsh","jrind":"lay_wsh"}},
																				 left:0,top:0,width:{"cat":594,"loc":466,"ind":746,"comptype":360,"major":594,"jrind":594},
																				 height:{"cat":517,"loc":365,"ind":510,"comptype":173,"major":517,"jrind":517},
																				 lineHeight:20,topBottomMargin:17,offset:{levelOne:{X:0,Y:20},
																				 levelTwo:{"cat":{X:184,Y:0},"loc":{X:85,Y:0},"major":{X:184,Y:0},"ind":{X:284,Y:0},"jrind":{X:184,Y:0}}}},
																				 allItems:{
																				 cat:function(){return getCat();},
																				 ind:function(){return getInd();},
																				 loc:function(){return getLoc();},
																				 major:function(){return getMajor();},
																				 jrind:function(){return getInd();},
																				 comptype:function(){return getCompanyType();}}};

																			 $(document).ready(function(){$("#txtCat").click(function(){PopupSelector.popup("cat",this);});
																			 $("#txtInd").click(function(){PopupSelector.popup("ind",this);});
																			 $("#txtLoc").click(function(){PopupSelector.popup("loc",this);});
																			 $("#txtCatDrop").click(function(){PopupSelector.popup("cat",$("#txtCat")[0]);});
																			 $("#txtIndDrop").click(function(){PopupSelector.popup("ind",$("#txtInd")[0]);});
																			 $("#txtLocDrop").click(function(){PopupSelector.popup("loc",$("#txtLoc")[0]);});
																			 $("#lnkEmpty").click(function(){PopupSelector.empty();});
																			 $("#lnkCancel").click(function(){PopupSelector.cancel();});
																			 $("#lnkOK").click(function(){PopupSelector.OK();});
																			 $("#btnOk").click(function(){PopupSelector.OK();});
																			 $("#btnOkMajor").click(function(){PopupSelector.OK();});
																			 $("#btnOkLoc").click(function(){PopupSelector.OK();});
																			 $("#btnOkLoc_onlyone").click(function(){PopupSelector.OK();});
																			 $("#btnOk_onlyone").click(function(){PopupSelector.OK();});
																			 $("#btnOkMajor_onlyone").click(function(){PopupSelector.OK();});
																			 $("#btnOkJrInd").click(function(){PopupSelector.OK();});
																			 $("#imgClose").click(function(){PopupSelector.close();});
																			 });

																			




