var sex_show = new Array();
var sex_value = new Array();

sex_show[0] = '都可以';
sex_value[0] = '';
sex_show[1] = '男性';
sex_value[1] = '男';
sex_show[2] = '女性';
sex_value[2] = '女';

var work_show = new Array();
var work_value = new Array();

work_show[0] = '都可以';
work_value[0] = '';
work_show[1] = '经营/管理';
work_value[1] = '经营/管理';
work_show[2] = '销售/业务';
work_value[2] = '销售/业务';
work_show[3] = '市场营销/公关';
work_value[3] = '市场营销/公关';
work_show[4] = '客户服务';
work_value[4] = '客户服务';
work_show[5] = '行政/人事/人力资源';
work_value[5] = '行政/人事/人力资源';
work_show[6] = '财务/审计/统计';
work_value[6] = '财务/审计/统计';
work_show[7] = '文职';
work_value[7] = '文职';
work_show[8] = '翻译';
work_value[8] = '翻译';
work_show[9] = '计算机/IT';
work_value[9] = '计算机/IT';
work_show[10] = '电子/通讯';
work_value[10] = '电子/通讯';
work_show[11] = '设计';
work_value[11] = '设计';
work_show[12] = '工业/工厂';
work_value[12] = '工业/工厂';
work_show[13] = '金融/经济';
work_value[13] = '金融/经济';
work_show[14] = '法律';
work_value[14] = '法律';
work_show[15] = '机械';
work_value[15] = '机械';
work_show[16] = '技工';
work_value[16] = '技工';
work_show[17] = '房地产/土建';
work_value[17] = '房地产/土建';
work_show[18] = '咨询/顾问';
work_value[18] = '咨询/顾问';
work_show[19] = '医疗/护理/保健';
work_value[19] = '医疗/护理/保健';
work_show[20] = '文教体';
work_value[20] = '文教体';
work_show[21] = '服务业';
work_value[21] = '服务业';
work_show[22] = '化工/制药/环境/冶金/地质';
work_value[22] = '化工/制药/环境/冶金/地质';
work_show[23] = '政府机关/事业单位/公务员';
work_value[23] = '政府机关/事业单位/公务员';
work_show[24] = '其他专业';
work_value[24] = '其他专业';
work_show[25] = '学生';
work_value[25] = '学生';

var enroll_show = new Array();
var enroll_value = new Array();
enroll_show[0] = '都可以';
enroll_value[0] = '';
for (i = 1920; i <= 2015;i++)
{
	enroll_value[i-1919] = i;
	enroll_show[i-1919] = i + '年';
}
 

function buildDiv(showArr,valueArr,title,divName,iptName,btnName){
	var htmlDiv = '';
	var text = '';

	text = title;
		
    htmlDiv = '<div id="'+divName+'"  style="width:500px;position:absolute;left:180px;top:300px;visibility:hidden;z-index:100px;filter:progid:DXImageTransform.Microsoft.DropShadow(Color=#BFBFBF,OffX=4px,OffY=4px);">';
    htmlDiv = htmlDiv + '<table width="500" border="0" cellspacing="0" cellpadding="0" bgcolor="#999999">';
    htmlDiv = htmlDiv + '<tr><td align="left" valign="middle" width="450" height="27" background="../images/icons/search/orangebg.gif">&nbsp;&nbsp;<img src="../images/icons/search/orangearrow.gif">&nbsp;<span style="color:#FFFFFF">请选择'+text+'</span></td><td align="left" valign="middle" width="50" height="20" background="../images/icons/search/orangebg.gif"><span><a onclick="javascript:hiddenLayer(\''+ divName +'\')" style="color:#FFFFFF;cursor:hand;">[关闭]</a></span></td></tr>';
    htmlDiv = htmlDiv + '<tr><td colspan="2" width="500" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">';

    var j = (3 - showArr.length%3) == 3 ? 0 : (3 - showArr.length%3);

    htmlDiv = htmlDiv + '<tr>';
    for(var k=0;k<showArr.length;k++){
	    htmlDiv = htmlDiv + '<td height="20" align="center" width=30% ><a style="cursor:hand" onclick="sltValue(\''+showArr[k]+'\',\''+valueArr[k]+'\',\'' + divName + '\',\'' + iptName + '\',\'' + btnName + '\')">'+showArr[k]+'</a></td>';
	    htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="../images/icons/search/line_bg.gif"></td>';
	    if(k%3 == 2){
	    	htmlDiv = htmlDiv + '</tr><tr>';
	    }
    }
    if(j > 0){
		for(var l=1;l<=j;l++){
			htmlDiv = htmlDiv + '<td height="20">&nbsp;</td>';
	    	htmlDiv = htmlDiv + '<td width="1" height="20" align="center" valign="middle"><img src="../images/icons/search/line_bg.gif"></td>';
		}
		htmlDiv = htmlDiv + '</tr>';
    }
    
    
    htmlDiv = htmlDiv + '</table></td></tr><tr><td colspan="2" height="4" bgcolor="#239A61"></td></tr></table>';
    
    htmlDiv = htmlDiv + '</div>';

    document.write(htmlDiv);
}

function sltValue(show,value,divName,iptName,btnName){
	document.getElementById(iptName).value = value;
	document.getElementById(btnName).value = show;
	document.getElementById(btnName + "1").value = show;
	hiddenLayer(divName);
}


function displayLayer(obj,layerID){
	hiddenLayer('popupSex','popupWork','popupEnrollMin','popupEnrollMax','popupGradMin','popupGradMax');
	
	var dv = document.getElementById(layerID);
	
	GetCenterXY_ForLayer(dv);
	DivSetVisible(dv);
}

function hiddenLayer(){
	var argArr = hiddenLayer.arguments;
	
	showElementAll();
	 
	for(var i=0;i<argArr.length;i++){
		
		document.getElementById(argArr[i]).style.visibility = "hidden";
	}
}

//将悬浮层的位置定位在屏幕中央
function GetCenterXY_ForLayer(objdiv){
	x = document.documentElement.scrollLeft;
	
	y = document.documentElement.scrollTop;
	
	//获取屏幕宽度
	availWidth = parseInt(window.screen.availWidth);
	availHeight = parseInt(window.screen.availHeight);
	
	tblWidth = parseInt(objdiv.style.width);
		
	y = y + availHeight/4;
	x = (availWidth - tblWidth)/2;
	
	objdiv.style.top = y + 'px';
	objdiv.style.left = x + 'px';
 
}

function GetLength(strTemp){
	var i,sum;
	sum=0;
	for(i=0;i<strTemp.length;i++){
		if ((strTemp.charCodeAt(i)>=0) && (strTemp.charCodeAt(i)<=255)) 
			sum = sum + 1;
		else 
			sum=sum + 2;
	}
	return sum;
}

function subStringPro(str, length){
	var stri = '';
	for(i=0,j=0; j<length;){
		if ((str.charCodeAt(i)>=0) && (str.charCodeAt(i)<=255)) {
			stri += str.charAt(i);
			j++;
		} else {
			stri += str.charAt(i);
			j += 2;
		}
		i++;
	}
	return stri;
}

function DivSetVisible(objDiv){
	hideElementAll();
	objDiv.style.visibility = "visible";
}


function HideElement(strElementTagName){
	try{
		for(i=0;i<window.document.getElementsByTagName(strElementTagName).length; i++){
			var objTemp = window.document.getElementsByTagName(strElementTagName)[i];
			objTemp.style.visibility = "hidden";
		}
	}catch(e){
		alert(e.message);
	}
}

function ShowElement(strElementTagName){
	try{
		for(i=0;i<window.document.getElementsByTagName(strElementTagName).length; i++){
			var objTemp = window.document.getElementsByTagName(strElementTagName)[i];
			objTemp.style.visibility = "visible";
		}
	}catch(e){
		alert(e.message);
	}
}

function hideElementAll(){
	HideElement("SELECT");
	HideElement("OBJECT");
	HideElement("IFRAME");
}

function showElementAll(){
	ShowElement("SELECT");
	ShowElement("OBJECT");
	ShowElement("IFRAME");
}


function selectedValue(name)
{
	if (GetUrlParam('ipt' + name) != "") document.getElementById('ipt' + name).value = GetUrlParam('ipt' + name);
	var btn = GetUrlParam('btn' + name + '1');


	if (GetUrlParam('ipt' + name) != "") document.getElementById('ipt' + name).value = GetUrlParam('ipt' + name);
	var btn = GetUrlParam('btn' + name + '1');
	if ( btn != "") 
	{
		if (btn == '%E9%80%89%E6%8B%A9%2F%E4%BF%AE%E6%94%B9') btn = "选择/修改";
 
		document.getElementById('btn' + name + '1').value = decodeURIComponent(btn);
		document.getElementById('btn' + name).value = decodeURIComponent(btn);
	}

}

buildDiv(sex_show,sex_value,"性别","popupSex","iptSex","btnSex");
buildDiv(work_show,work_value,"行业领域","popupWork","iptWork","btnWork");
buildDiv(enroll_show,enroll_value,"入学年份","popupEnrollMin","iptEnrollMin","btnEnrollMin");
buildDiv(enroll_show,enroll_value,"入学年份","popupEnrollMax","iptEnrollMax","btnEnrollMax");

buildDiv(enroll_show,enroll_value,"毕业年份","popupGradMin","iptGradMin","btnGradMin");
buildDiv(enroll_show,enroll_value,"毕业年份","popupGradMax","iptGradMax","btnGradMax");


//设置选中值
function setSelectedValue()
{
	selectedValue("Sex");
}