﻿function eval_str(str) //初始化数据成数组
{return eval("("+str+")");}
var select_var=[]; //已选变量
var select_maxnum=5; //最多选择项
function clear_select_all(){select_var.splice(0,5);reselect__city();$("input").attr("checked","");$("input").attr("disabled","");}

function select_city_style(max,type,show,hide,iframe){
var load_http="/js/select/";
var load_js=load_http+"city.js";
if(type==1){load_js=load_http+"industry.js";}
if(type==2){load_js=load_http+"position.js";}
if(type==3){load_js=load_http+"major.js";}
select_var=[];
try{
if((iframe!="" || iframe!=null) && iframe!=undefined){
var select_1=parent.frames[iframe].$("#"+show).attr("value").split(",");
var select_2=parent.frames[iframe].$("#"+hide).attr("value").split(",");
}else{
var select_1=$("#"+show).attr("value").split(",");
var select_2=$("#"+hide).attr("value").split(",");
}
for(i=0;i<select_2.length;i++){
select_var[i]=[select_2[i],select_1[i]];
}
}
catch(e){
select_var=[];
}

var temp_h1 = document.body.clientHeight;
var temp_h2 = document.documentElement.clientHeight;
var isXhtml = (temp_h2<=temp_h1&&temp_h2!=0)?true:false; 
var htmlbody = isXhtml?document.documentElement:document.body;
var close_height=htmlbody.scrollTop;
var screenheight=(htmlbody.scrollHeight>=window.screen.availHeight)?htmlbody.scrollHeight:window.screen.availHeight;
var screenwidth=window.screen.width-20;
$("#Popup_select__ground").remove();$("#Popup_select_div").remove();$("#Popup_select__ground2").remove();
$("<div id=\"Popup_select__ground2\"><IFRAME width='100%' height='100%'></IFRAME></div>").appendTo("body"); 
$("<div id=\"Popup_select__ground\"></div>").appendTo("body"); 
$("#Popup_select__ground2").css({ position: "absolute","z-index":"98","background-color":"#333333","-moz-opacity":".00",opacity:"0.0",top:"0px",left:"0px",width:screenwidth+"px",height:screenheight+"px" }); 

$("#Popup_select__ground").css({ position: "absolute","z-index":"99","background-color":"#333333","-moz-opacity":".60",opacity:"0.6",top:"0px",left:"0px",width:screenwidth+"px",height:screenheight+"px" }); 
$("<div id=\"Popup_select_div\"></div>").appendTo("body");
$("#Popup_select_div").css({ position: "absolute","z-index":"100","background-color":"#EFEFE7",border:"#FFFFFF 1px solid","font-size":"12px",top:close_height+80+"px",width:"620px",left:((document.body.clientWidth-620)/2)+20+"px"}); 

$("<table width=\"100%\" height=\"425\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#EFEFE7\"><tr><td valign=\"top\"><div style=\"width:600px;height:25px; margin-left:10px\"><img id='Popup_select_img' src=\""+load_http+"selectimg\/select_in.gif\" width=\"11\" height=\"11\" align=\"right\" style=\"margin-top:6px\"\/><\/div><div><center><table width=\"566px\" height=\"30px\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" background=\""+load_http+"selectimg\/select_bg.gif\" bgcolor=\"#2373A6\" style=\"border:#CCCFD5 1px solid;\"><tr><td width=\"19\" align=\"left\"><img src=\""+load_http+"selectimg\/select_left.gif\" width=\"19\" height=\"30\" \/><\/td><td width=\"537\" align=\"left\"><span style=\"color: #F2F2F2;\"> 请选择合适选项<\/span><\/td><td width=\"10\" align=\"right\"><img src=\""+load_http+"selectimg\/select_right.gif\" width=\"8\" height=\"30\" \/><\/td><\/tr><\/table></center><div style=\"height:24px;width:564px;border-bottom:#CCCFD5 1px solid;border-left:#CCCFD5 1px solid;border-right:#CCCFD5 1px solid; margin-left:27px; background-color:#FFFFFF\" id=\"select_style___one\">　<select name=\"select__list\" id=\"select__list\"><option value=\"\">请选择合适选项<\/option><\/select><span id=\"select__list__nbsp\">&nbsp;&nbsp;<\/span><\/div><div style=\"height:200px;width:564px;border-bottom:#CCCFD5 1px solid;border-left:#CCCFD5 1px solid;border-right:#CCCFD5 1px solid; margin-left:27px;background-color:#FFFFFF; overflow:auto; font-size:12px\" id=\"select__list_view\"><\/div><div class=\"STYLE1\" style=\"height:20px;margin-left:27px;width:564px; margin-top:10px\">已选择项目：<span id=\"clear_select_all\"><a href=\"javascript:void(0)\" onclick=\"clear_select_all();\"><img src=\""+load_http+"selectimg\/select_recycle.gif\" width=\"11\" height=\"11\" border=\"0\"\/> 清空所选内容<\/a><\/span><\/div><div style=\"height:88px;width:564px;border:#CCCFD5 1px solid; margin-left:27px;background-color:#FFFFFF\">  <table width=\"566\" height=\"84\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td colspan=\"3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"select_padding_view\" class=\"STYLE1\"><tr><td width=\"33%\" height=\"28\">&nbsp;<\/td><td width=\"33%\">&nbsp;<\/td><td width=\"33%\">&nbsp;<\/td><\/tr><tr><td height=\"28\">&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><\/tr><\/table><\/td><td width=\"77\" align=\"center\"><table width=\"83%\" height=\"57\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><input type=\"button\" name=\"select_button_ok\" id=\"select_button_ok\" value=\" 确 定 \"  class=\"input button\" \/><\/td><\/tr><tr><td><input type=\"button\" name=\"select_button_quit\" id=\"select_button_quit\" value=\" 取 消 \"  class=\"input button\" \/><\/td><\/tr><\/table><\/td><\/tr><\/table><\/div><\/div><\/td><\/tr><\/table>").appendTo("#Popup_select_div");
function resize_select_window(){$("#Popup_select_div").css("left",((document.body.clientWidth-620)/2)+20+"px");$("#Popup_select_div").css("top",document.documentElement.scrollTop +80+"px");}
$("#Popup_select_img").hover(function(){$(this).attr("src",""+load_http+"selectimg/select_out.gif");$(this).click(function(){remove_select_window();});},
function () {$(this).attr("src",""+load_http+"selectimg\/select_in.gif");}); 

$(document).resize(function(){resize_select_window();})
$(document).scroll(function(){resize_select_window();})
function remove_select_window(){$("#Popup_select__ground").remove();$("#Popup_select_div").remove();$("#Popup_select__ground2").remove();}

var list=""; //列表变量
if(max!=""){select_maxnum=max;}
jQuery.getScript(load_js,function(){once_read();}); //加载选择城市JS文件
$("#select_button_quit").click(function(){remove_select_window();})
$("#select_button_ok").click(function(){
show_select();})
function show_select(){
var show_var=[];hide_var=[];

for(i=0;i<select_var.length;i++)
{
show_var[i]=select_var[i][1];	
hide_var[i]=select_var[i][0];	
}

if((iframe!="" || iframe!=null) && iframe!=undefined){
parent.document.getElementById(iframe).contentWindow.$("#"+show).attr("value",show_var.toString());parent.document.getElementById(iframe).contentWindow.$("#"+hide).attr("value",hide_var.toString());
}else{
$("#"+show).attr("value",show_var.toString());
$("#"+hide).attr("value",hide_var.toString());}

select_var="";show_var="";hide_var="";
remove_select_window();
}

}