//*************************** 说明 ***************************//
// 创 建 者：李慧
// 日    期：2007-2-1
// 功能说明：输出年度、行业、地区、职位、 政治面貌、员工人数、学历、企业性质、企业年产值、知道薪酬网的途径、
//			 注册资金、专家列表下拉列表、职位级别列表，其中地区、职位、专家列表可实现联动菜单功能。
// 修改说明：无。
//************************************************************//



//联动下拉菜单操作部分
//联动
function select_change( child_select, parent_select )
{
	var state_array ;
	var child_select_num ;
	var i ;
	var city_array ;
	child_select.selectedIndex = 0 ;
	if( parent_select == "-1" )
	{
		child_select.options.length = 1 ;
			
		return ;	
	}
	parent_select = parent_select.replace(" " , "_" ) ;
	parent_select = parent_select.replace(" " , "_" ) ;
	state_array = eval( parent_select ) ;
	child_select_num = state_array.length/2 +1 ;
	child_select.options.length = child_select_num ;
	for( i=1 ; i<child_select_num ; i++ )
	{
		child_select.options[i].value = state_array[(i-1)*2] ;
		child_select.options[i].text = state_array[(i-1)*2+1] ;
		
		
	}
}

//设置下拉菜单内容
function set_select_options( select_name, array , selected_option )
{
	var select_num ;
	var i ;
	
	select_num = array.length/2 +1 ;
	
	select_name.options.length = select_num ;
	select_name.selectedIndex = 0 ;
	for( i=1 ; i<select_num ; i++ )
	{
		select_name.options[i].value = array[(i-1)*2] ;
		select_name.options[i].text = array[(i-1)*2+1] ;
		
		if( array[(i-1)*2] == selected_option )
			select_name.selectedIndex = i ;
	}
}





//输出年份下拉列表
function YearList(listname,syear,eyear,selectyear,script)
{
	//listname:列表名
	//syear：开始年份，如果未设置，则取当前年的前后三十年；若设置了一个值，则取设置的年份到当前年份。
	//eyear：结束年份，若未设置开始年份，此年份不起使用；若设置了开始年份，此年份做为结束年份。
	//selectyear：选择的年份。
	//script：要执行的脚本语句。
	
	scriptdate = "";
	
	var currentyear = new Date().getFullYear();//当前年
	var startyear;
	var endyear;
	var scriptdate = "<select id='" + listname + "' name='" + listname + "' ";
	
	if(script != null && script != "")
	{
		scriptdate += " onchange=" + script;
	}
	
	scriptdate +=  ">";

	if(syear == null || syear == "" )
	{
		startyear = currentyear - 30;
		endyear = currentyear + 30;
	}
	else
	{
		startyear = syear;
		if(eyear == null || eyear == "")
		{
			endyear = currentyear;
		}
		else
		{
			endyear = eyear;
		}
	}
	
	for(var i=startyear;i<=endyear;i++)
	{
		scriptdate += "<option value='" + i + "'";
		if(selectyear == null || selectyear == "")
		{
			if(i == currentyear)
			{
				scriptdate += " selected='true'";
			}
		}
		else
		{
			if(i == selectyear)
			{
				scriptdate += " selected='true'";
			}
		}
		scriptdate += ">" + i + "</option>";
	}
	scriptdate += "</select>";
	
	document.write(scriptdate);
} 

//输出行业下拉列表
function WayList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='行业' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择行业</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Ways, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}

//输出地区下拉列表
function AreaList(formname,listname,selectid,mustselect,childname,childselectid,childmustselect,width,childwidth)
{
	//formname：表单名
	//listname：列表名
	//selectid:选中的项目
	//mustselect:必选
	//childname：下级列表名，若为空则只显示省份列表
	//childselectid:选中的子项目
	//childmustselect:下级列表必选
	//width：生成下拉列表的宽度
	//childwidth：下级列表宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(childname != null && childname != "")
	{
		content += " onChange=\"select_change(window.document." + formname + "." + childname + " ,window.document." + formname + "." + listname + ".options[selectedIndex].value );\"";
	}
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='省份' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择省份</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Provinces, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	if(childname != null && childname != "")
	{
		content += "<select id=\"" + childname + "\" name=\"" + childname + "\"";
		if(childmustselect != null && childmustselect)
		{
			content += " ischeck='true' message='城市' mustselect='true'";
		}
		if(childwidth != null)
		{
			content += " style='width:" + childwidth + "px;'";
		}
		content += ">";
		content += "<option selected value=\"-1\">选择城市</option>"
		if(childselectid != null && childselectid != "")
		{
			content += "<script>set_select_options( window.document." + formname + "." + childname + "," + selectid + ", \"" + childselectid + "\" ) ;</script>";
		}
		content += "</select>";
	}
	
	document.write(content);
}




//输出职位下拉列表
function JobList(formname,listname,selectid,mustselect,childname,childselectid,childmustselect,width,childwidth)
{
	//formname：表单名
	//listname：列表名
	//selectid:选中的项目
	//mustselect:必选
	//childname：下级列表名，若为空则只显示省份列表
	//childselectid:选中的子项目
	//childmustselect:下级列表必选
	//width：生成下拉列表的宽度
	//childwidth：下级列表宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(childname != null && childname != "")
	{
		content += " onChange=\"select_change(window.document." + formname + "." + childname + " ,window.document." + formname + "." + listname + ".options[selectedIndex].value );\"";
	}
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='职位大类' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择大类</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Jobclass, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	if(childname != null && childname != "")
	{
		content += "<select id=\"" + childname + "\" name=\"" + childname + "\"";
		if(childmustselect != null && childmustselect)
		{
			content += " ischeck='true' message='职位细类' mustselect='true'";
		}
		if(childwidth != null)
		{
			content += " style='width:" + childwidth + "px;'";
		}
		content += ">";
		content += "<option selected value=\"-1\">选择细类</option>"
		if(childselectid != null && childselectid != "")
		{
			content += "<script>set_select_options( window.document." + formname + "." + childname + "," + selectid + ", \"" + childselectid + "\" ) ;</script>";
		}
		content += "</select>";
	}
	
	document.write(content);
}



//输出政治面貌下拉列表
function ZzmmList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='政治面貌' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择政治面貌</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", zzmm, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}


//输出学历下拉列表
function EducationbgList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='学历' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择学历</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", educationbg, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}


//输出员工人数下拉列表
function EmployeenumList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='员工人数' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择人数</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Employeenum, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}


//输出企业性质下拉列表
function EpropertyList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='企业性质' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择性质</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Eproperty, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}


//输出企业年产值下拉列表
function OutputyearList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='年产值' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择年产值</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Outputyear, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}


//输出知道薪酬公开网的途径下拉列表
function KnowpassList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='知道薪酬公开网的途径' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择途径</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Knowpass, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}





//输出注册资金下拉列表
function RegfundList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='注册资金' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择注册资金</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Regfund, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}




//输出专家下拉列表
function ExpertList(formname,listname,selectid,mustselect,childname,childselectid,childmustselect,width,childwidth)
{
	//formname：表单名
	//listname：列表名
	//selectid:选中的项目
	//mustselect:必选
	//childname：下级列表名，若为空则只显示专家类型列表
	//childselectid:选中的子项目
	//childmustselect:下级列表必选
	//width：生成下拉列表的宽度
	//childwidth：下级列表宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(childname != null && childname != "")
	{
		content += " onChange=\"select_change(window.document." + formname + "." + childname + " ,window.document." + formname + "." + listname + ".options[selectedIndex].value );\"";
	}
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='专家类型' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择类型</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Experts, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	if(childname != null && childname != "")
	{
		content += "<select id=\"" + childname + "\" name=\"" + childname + "\"";
		if(childmustselect != null && childmustselect)
		{
			content += " ischeck='true' message='专家' mustselect='true'";
		}
		if(childwidth != null)
		{
			content += " style='width:" + childwidth + "px;'";
		}
		content += ">";
		content += "<option selected value=\"-1\">选择专家</option>"
		if(childselectid != null && childselectid != "")
		{
			content += "<script>set_select_options( window.document." + formname + "." + childname + "," + selectid + ", \"" + childselectid + "\" ) ;</script>";
		}
		content += "</select>";
	}
	
	document.write(content);
}




//职位级别列表
function StationlevelList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='职位级别' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">职位级别</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Stationlevel, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}



//输出工作经验下拉列表
function GongLingList(formname,listname,selectid,mustselect,width)
{
	//formname:表单名
	//listname:列表名
	//selectid:选中的项目
	//mustselect:必选
	//width:生成下拉列表的宽度
	var content = "";
	
	content = "<select id=\"" + listname + "\" name=\"" + listname + "\"";
	if(mustselect != null && mustselect)
	{
		content += " ischeck='true' message='工作经验' mustselect='true'";
	}
	if(width != null)
	{
		content += " style='width:" + width + "px;'";
	}
	content += ">";
	content += "<option selected value=\"-1\">选择工作经验</option>"
	content += "<script>set_select_options( window.document." + formname + "." + listname + ", Gongling, \"" + selectid + "\" ) ;</script>";
	content += "</select>";
	
	document.write(content);
}

