
//行业类别JS文件<!--刘建元 2004-08-26 09:43:47-->
var callingsCount;
callings = new Array();
callingsCount=39;
//定义数组
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("37", "通信、电信运营、增值服务业");
callings[6]= new Array("6", "家具、家电、工艺品、玩具");
callings[7]= new Array("7", "批发零售(百货、超市、购物中心、专卖店…)");
callings[8]= new Array("8", "贸易、商务、进出口");
callings[9]= new Array("9", "电气");
callings[10]= new Array("10", "电力、能源、矿产业");
callings[11]= new Array("11", "石油、化工业");
callings[12]= new Array("12", "生物工程、制药、环保");
callings[13]= new Array("13", "机械制造、机电设备、重工业");
callings[14]= new Array("14", "汽车、摩托车及配件业");
callings[15]= new Array("15", "仪器仪表、电工设备");
callings[16]= new Array("16", "广告、公关、设计");
callings[17]= new Array("18", "艺术、文化传播");
callings[18]= new Array("38", "媒体、影视制作、新闻出版");
callings[19]= new Array("19", "快速消费品(食品、饮料、粮油、化妆品、烟酒…)");
callings[20]= new Array("20", "纺织品业(服饰、鞋类、家纺用品、皮具…)");
callings[21]= new Array("21", "咨询业(顾问、会计师、审计师、法律)");
callings[22]= new Array("22", "金融业(投资、保险、证券、银行、基金)");
callings[23]= new Array("23", "建筑、装潢");
callings[24]= new Array("39", "房地产、物业管理");
callings[25]= new Array("25", "运输、物流、快递");
callings[26]= new Array("26", "旅游业、酒店");
callings[27]= new Array("40", "餐饮、娱乐");
callings[28]= new Array("27", "办公设备、文化体育休闲用品");
callings[29]= new Array("28", "印刷、包装、造纸");
callings[30]= new Array("29", "生产、制造、修饰加工");
callings[31]= new Array("30", "教育、培训、科研院所");
callings[32]= new Array("31", "医疗、美容保健、卫生服务");
callings[33]= new Array("32", "人才交流、中介");
callings[34]= new Array("33", "协会、社团");
callings[35]= new Array("41", "政府公用事业、社区服务");
callings[36]= new Array("34", "农、林、牧、副、渔业");
callings[37]= new Array("36", "法律"); 
callings[38]= new Array("35", "其他");


//输出选项
function writeCallings()
{
    with(document)
    {
        for (var i=0; i<callingsCount; i++) 
            write("<option value='"+callings[i][0]+"'>"+callings[i][1]+"</option>");
    }
}

//添加方法
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)
    {
        try{	
			obj2.add(opt);
		}catch(e){
			obj2.add(opt,null);
		}
        document.thisForm.calling1.value = opt.value; //应先检测对象有无存在
        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=='') { alert('您已经选择了行业类别不限.'); return; }

        //说明该项已被选择,不再操作
        if (opt.value==val)  { alert('您已经选择该项.'); return; }
    }

    //说明选了不限,但已经选有明细项,不能添加成功(有)
    if (opt.value=='0'||opt.value=='') 
    {
        alert('您已经选择了该项所在的类别中的子项.');
        return;
    }

    //增加这一选项,并给hidden传值.
	try{
	    obj2.add(opt);
	}catch(e){
		obj2.add(opt,null);
	}
    //仅为新增项
    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);
    }
}

//<!--lijoy 2004-09-09 10:26:39--><!--lijoy 2004-09-09 10:27:17-->
