
//行业类别JS文件
var callingsCount;
callings = new Array();
callingsCount=34;
//定义数组
callings[0]= new Array("1", "互联网、电子商务");
callings[1]= new Array("2", "计算机业（软件、数据库、系统集成）");
callings[2]= new Array("3", "计算机业（硬件、网络设备）");
callings[3]= new Array("4", "电子、微电子技术");
callings[4]= new Array("5", "通讯、电信业");
callings[5]= new Array("6", "家电业");
callings[6]= new Array("7", "批发零售(百货、超市、购物中心、专卖店…)");
callings[7]= new Array("8", "贸易、商务、进出口");
callings[8]= new Array("9", "电气");
callings[9]= new Array("10", "电力、能源、矿产业");
callings[10]= new Array("11", "石油、化工业");
callings[11]= new Array("12", "生物工程、制药、环保");
callings[12]= new Array("13", "机械制造、机电设备、重工业");
callings[13]= new Array("14", "汽车、摩托车");
callings[14]= new Array("15", "仪器仪表、电工设备");
callings[15]= new Array("16", "广告、公关、设计");//合并原“17.媒体、影视制作、新闻出版”(下)
callings[16]= new Array("17", "艺术、文化传播、媒体、影视制作、新闻出版");
callings[17]= new Array("18", "快速消费品（食品、饮料、粮油、化妆品、烟酒…）");
callings[18]= new Array("19", "纺织品业（服饰、鞋类、家纺用品、皮具…）");
callings[19]= new Array("20", "咨询业（顾问、会计师、审计师、法律）");
callings[20]= new Array("21", "金融业（投资、保险、证券、银行、基金）");
callings[21]= new Array("22", "建筑、房地产、物业管理、装潢");
callings[22]= new Array("23", "运输、物流、快递"); //合并原“24.餐饮、娱乐、酒店”(下)
callings[23]= new Array("24", "旅游业、餐饮、娱乐、酒店");
callings[24]= new Array("25", "办公设备、文化体育休闲用品、家居用品");
callings[25]= new Array("26", "印刷、包装、造纸");
callings[26]= new Array("27", "生产、制造、加工");
callings[27]= new Array("28", "教育、培训、科研院所");
callings[28]= new Array("29", "医疗、保健、卫生服务");
callings[29]= new Array("30", "人才交流、中介");
callings[30]= new Array("31", "协会、社团、政府公用事业、社区服务");
callings[31]= new Array("32", "农、林、牧、副、渔业");
callings[32]= new Array("33", "法律"); //新增
callings[33]= new Array("34", "其他");

//输出选项
function writeCallings()
{
    with(document)
    {
        for (var i=0; i<callingsCount; i++) 
            write("<option value='"+callings[i][0]+"'>"+callings[i][1]+"</option>");
    }
}

//输出选项2
function HomeWriteCallings()
{
    with(document)
    {
        for (var i=0; i<callingsCount; i++) 
            write("·<a class='list4' href='search_job_list1.asp?callings="+callings[i][0]+"' target='_blank'>"+callings[i][1]+"</a><Br>");
    }
}

//显示行业
function ShowCallings(x)
{
    with(document)
    {
        for (var i=0; i<callingsCount; i++) 
	    if(i==x)
		{
            	write(""+callings[i][1]+"");
		}
    }
}

//添加方法
function append_selected_item(obj1, obj2)
{
    var len, txt, val;
    if(typeof(obj1.options[obj1.selectedIndex])=="unknown")
    {
        alert("系统提示:请选择您想要添加的资料项!");
        obj1.focus();
        return;
    }

    clear_list(obj1, obj2);

    //取长度
    len = obj2.length;
    if (len>2)
    {
        alert("您已经添加了三项,不能更添加了!");
        return;
    }

    //生成一个新元素
    var opt = document.createElement("OPTION");
    opt.text = obj1.options[obj1.selectedIndex].text;
    opt.value = obj1.options[obj1.selectedIndex].value;

    if (len==0)
    {
        obj2.add(opt);
        document.thisForm.calling1.value = opt.value; //应先检测对象有无存在
        return;
    }

    //说明选了不限,但已经选有明细项,不能添加成功(有)
    if (opt.value=='0'||opt.value=='') 
    {
        alert('您已经选有至少一项行业类别,不能再选行业类别不限!');
        return;
    }

    //先清原值  
    document.thisForm.calling1.value = '';
    document.thisForm.calling2.value = '';
    document.thisForm.calling3.value = '';

    //检查有无重复项
    for(i=0; i<obj2.length; i++)
    {
        txt = obj2.options[i].text;
        val = obj2.options[i].value;
        //提前传值
        if (i==0) document.thisForm.calling1.value = obj2.options[0].value;
        if (i==1) document.thisForm.calling2.value = obj2.options[1].value;
        if (i==2) document.thisForm.calling3.value = obj2.options[2].value;

        //检测值(说明选了不限:不再添加)
        if (val=='0'||val=='') { return; }
        
        //说明该项已被选择,不再操作
        if (opt.value==val)  { return; }
    }

    //增加这一选项,并给hidden传值.
    obj2.add(opt);
    //仅为新增项
    if (len==0) document.thisForm.calling1.value = obj2.options[0].value;
    if (len==1) document.thisForm.calling2.value = obj2.options[1].value;
    if (len==2) document.thisForm.calling3.value = obj2.options[2].value;
}

//移除选项
function remove_selected_item(obj)
{
    if(typeof(obj.options[obj.selectedIndex])=="unknown")
    {
        alert("系统提示:请选择您想要移除的资料项!");
        obj.focus();
    }

    if (obj.selectedIndex>-1)
    {
        obj.remove(obj.selectedIndex);

        //先清原值  
        document.thisForm.calling1.value = '';
        document.thisForm.calling2.value = '';
        document.thisForm.calling3.value = '';
    }

    //重新置参数
    for(i=0; i<obj.length; i++)
    {
        if (i==0) document.thisForm.calling1.value = obj.options[0].value;
        if (i==1) document.thisForm.calling2.value = obj.options[1].value;
        if (i==2) document.thisForm.calling3.value = obj.options[2].value;
    }
}


//添加方法
function clear_list(obj1, obj2)
{
    var len, txt, val;
    //选中,并且两个都是列表
    if (typeof(obj1.options[obj1.selectedIndex])=="unknown")  return;
    if (typeof(obj2)!="object") return;

    //取长度(无数据退出)
    len = obj2.length;
    if (len==0) return;

    //生成一个新元素
    txt = obj1.options[obj1.selectedIndex].text;
    val = obj1.options[obj1.selectedIndex].value;

    //检查添加的数据是否是不限:是:清除目标列表数据;否:下一步
    if (val=='' || val=='0')
    {
        for (var i=len-1; i>-1; i--) { obj2.remove(i); }
    }
    else
    {
        val = obj2.options[0].value;
        if (val=='' || val=='0') obj2.remove(0);
    }
}