
//ĞĞÒµÀà±ğJSÎÄ¼ş
var callingsCount;
callings = new Array();
callingsCount=34;
//¶¨ÒåÊı×é
		
callings[1]= new Array("1", "机械产品用户");
callings[2]= new Array("2", "机械加工企业");
callings[3]= new Array("3", "农业机械企业");
callings[4]= new Array("4", "工程机械企业");
callings[5]= new Array("5", "仪器仪表企业");
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("17", "行业管理与服务机构");
callings[18]= new Array("18", "其他行业企业");
//Êä³öÑ¡Ïî
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);
    }
}