function update_sub(CatID1,subTypeForm1,childName1, childVal1, subTypeForm2,childName2,childVal2){
    subTypeForm1.length=0;
    var isTure = true;
    if(childName1 == 'Area' && parseInt(CatID1)%100 != 0 && !aAreaCode.inArray(CatID1))
    {
        isTure = false;    
        subTypeForm1.options[0] = new Option('------', '');
    }
    if(isTure){
        var aChildCode = eval("a" + childName1 + "Code_" + CatID1);
        if("undefined"!=typeof(aChildCode) && "" != aChildCode){
            var k = 0;
            if(childName1 == 'Area'){
                subTypeForm1.options[0] = new Option('不限', '');
                k = 1;
            }
            for(i = 0; i < aChildCode[0].length; i++){
                subTypeForm1.options[k] = new Option(aChildCode[1][i], aChildCode[0][i]);
                if("undefined" != childVal1 && "" != childVal1){
                    if(aChildCode[0][i] == childVal1)
                        subTypeForm1.options[k].selected=true;
                }
                k++;
            }
            //subTypeForm1.options[0].selected=true;
        }
        if (5 < update_sub.arguments.length){
              setSub(subTypeForm1,subTypeForm2,childName2,childVal2);    
        }
    }
    return ;
}

function getById(sIdFlag) {
    return document.getElementById(sIdFlag);
}

function setSub(sltParent,sltChild1,childName1,childVal1,sltChild2,childName2,childVal2){
    typeof(sltParent) == 'string' ? p = getById(sltParent) : p = sltParent;
    typeof(sltChild1) == 'string' ? c1 = getById(sltChild1) : c1 = sltChild1;

    if (5 < setSub.arguments.length){
        c2 = getById(sltChild2);
        update_sub(p.options[p.options.selectedIndex].value, c1, childName1,childVal1, c2, childName2,childVal2);
    }else{
        update_sub(p.options[p.options.selectedIndex].value, c1, childName1, childVal1);
    }
    return ;
}

function tr_show(id,ishide){
    if(ishide){
        document.getElementById(id).style.visibility='hidden';
        //document.getElementById(id).style.display=document.getElementById(id).style.display=="block"?"none":"block";
    }else{
        document.getElementById(id).style.visibility='';
        //document.getElementById(id).style.visibility=document.getElementById(id).style.visibility=="hidden"?"":"hidden";
    }
} 
function setChange(sltParent,sltChild1,childName1,childVal1){
    typeof(sltParent) == 'string' ? p = getById(sltParent) : p = sltParent;
    typeof(sltChild1) == 'string' ? c1 = getById(sltChild1) : c1 = sltChild1;
    update_sub(p.options[p.options.selectedIndex].value, c1, childName1, childVal1);
    if(p.options[p.options.selectedIndex].value == '1'){
        tr_show('jiazhen',false);
        tr_show('jiazhen1',false);
    }else{
        tr_show('jiazhen',true);
        tr_show('jiazhen1',true);
    }
    return ;
}
