/**
 * @version 2.0
 * @author panlianghu
 * @copyright 2007 vekcn.com
 * Tue Dec 18 09:58:53 CST 2007
 */
function build_select(first_id,second_id,first_array,second_array,def_value)
{
    if(def_value == "" || def_value == "0")
    {
        var k=1000;
        for( key in first_array )       {
            var sOption = document.createElement("OPTION");
            sOption.text = first_array[key];
            sOption.value = key;
            document.getElementById(first_id).options.add(sOption,k);
            k--;
        }
    }
    else
    {
        pro_key = def_value.substr(0,2);
        var k=1000;
        for( key in first_array )
        {
            var sOption = document.createElement("OPTION");
            sOption.text = first_array[key];
            sOption.value = key;
            if(pro_key == key)
            {
                sOption.id = "sele_pro"+first_id;
            }
            document.getElementById(first_id).options.add(sOption,k);
            k--;
        }
        document.getElementById("sele_pro"+first_id).selected = true;
        var k=1000;
        for( key in second_array[pro_key] )     {
            var sOption = document.createElement("OPTION");
            sOption.text = second_array[pro_key][key];
            sOption.value = key;
            if(def_value == key)
            {
                sOption.id = "sele_city"+second_id;
            }
            document.getElementById(second_id).options.add(sOption,k);
        }
        k--;
        document.getElementById("sele_city"+second_id).selected = true;
    }
}


function build_second(first_value,second_id,second_array)
{
    document.getElementById(second_id).innerHTML = "";
    var k=1000;
    for( key in second_array[first_value]){
        var sOption = document.createElement("OPTION");
        sOption.text = second_array[first_value][key];
        sOption.value = key;
        document.getElementById(second_id).options.add(sOption,k);
    }
    k--;
}
