
function ChangeCountryNew(CountryID,continent,DefaultCountrycode,p_hotel) {
	var control = document.getElementById(CountryID);
    control.options.length = 0; 
    var i;
    for (i = 0; i < count0; i++) {
        if (g[i][0] == continent) {
            if (p_hotel == 1) {
                if (g[i][3] != 1) control.options[control.options.length] = new Option(g[i][1], g[i][2]);
            }
            else {
                control.options[control.options.length] = new Option(g[i][1], g[i][2]);
            }
        }
    }
	control.value = DefaultCountrycode;
}
function ChangeProvinceNew(ProvinceID,country,DefaultProvinceCode,p_hotel,p_scene) {
    var control = document.getElementById(ProvinceID);
    control.options.length = 0; 
    var ii;
    control.options.add(new Option("--省份--", ""));
    for (ii = 0; ii < count1; ii++) {
        if (p[ii][0] == country) {
            if (p_hotel == 1 && p_scene == 1) {
                if (p[ii][3] != 1 && p[ii][4] != 1) control.options[control.options.length] = new Option(p[ii][1], p[ii][2]);
            }
            else if (p_hotel != 1 && p_scene == 1) {
                if (p[ii][4] != 1) control.options[control.options.length] = new Option(p[ii][1], p[ii][2]);
            }
            else if (p_hotel == 1 && p_scene != 1) {
                if (p[ii][3] != 1) control.options[control.options.length] = new Option(p[ii][1], p[ii][2]);
            }
            else {
                control.options[control.options.length] = new Option(p[ii][1], p[ii][2]);
            }
        }
    }
	control.value = DefaultProvinceCode;
}

function ChangeCityNew(CityID, province,DefaultCitycode,p_hotel,p_scene) {
    var control = document.getElementById(CityID); 
    control.options.length = 0;
    var iii;
    control.options.add(new Option("--城市--", ""));
    for (iii = 0; iii < count2; iii++) {
        if (c[iii][0] == province) {
            if (p_hotel == 1 && p_scene == 1) {
                if (c[iii][3] != 1 && c[iii][4] != 1) control.options[control.options.length] = new Option(c[iii][1], c[iii][2]);
            }
            else if (p_hotel != 1 && p_scene == 1) {
                if (c[iii][4] != 1) control.options[control.options.length] = new Option(c[iii][1], c[iii][2]);
            }
            else if (p_hotel == 1 && p_scene != 1) {
                if (c[iii][3] != 1) control.options[control.options.length] = new Option(c[iii][1], c[iii][2]);
            }
            else {
                control.options[control.options.length] = new Option(c[iii][1], c[iii][2]);
            }

        }
    }
	control.value = DefaultCitycode;
}
function ChangeCommercialNew(CommercialID, City,p_hotel) {
    var control = document.getElementById(CommercialID);
    control.options.length = 0;
    var iiii;
    control.options.add(new Option("--区域--", ""));
    for (iiii = 0; iiii < count3; iiii++) {
        if (t[iiii][0] == City) {
            if (p_hotel == 1) {
                if (t[iiii][3] != 1) control.options[control.options.length] = new Option(t[iiii][1], t[iiii][2]);
            }
            else {
                control.options[control.options.length] = new Option(t[iiii][1], t[iiii][2]);
            } 
        }
    }
}


/*midify by csz 2009-6-16
需要定义如下参数:
var hotel=0;//是否酒店城市 1表示是,其它则为不是
var scene=0;//是否景点城市 1表示是,其它则为不是
iscountry=0'';//是否显示国家 1表示不显示,其它则为显示
iscommercial=0'';//是否显示区 1表示不显示,其它则为显示
var DefaultCountrycode='';//默认国家代码
var DefaultProvinceCode='';//默认省代码
var DefaultCitycode='';//默认城市代码
------------------------------------------------------------------------------------*/
function p_changeNew(countrycode, provincecode, citycode, commercialcode,countryName,provinceName,cityName,zoneName,p_hotel,p_scene,iscountry,iscommercial) {
    ChangeCountryNew(countryName,0,countrycode,p_hotel);
    if (iscountry == 1) {
        document.getElementById(countryName).value = 'cn';
        document.getElementById(countryName).style.display = 'none';
        ChangeProvinceNew(provinceName,"cn", provincecode,p_hotel,p_scene);
    }
    else {
        document.getElementById(countryName).value = countrycode;
        ChangeProvinceNew(provinceName,countrycode, provincecode,p_hotel,p_scene);
    }
    document.getElementById(provinceName).value = provincecode;
    ChangeCityNew(cityName,provincecode,citycode,p_hotel,p_scene);
    document.getElementById(cityName).value = citycode;
    ChangeCommercialNew(zoneName,citycode,p_hotel);
    document.getElementById(zoneName).value = commercialcode;
    if (iscommercial == 1) {
        document.getElementById(zoneName).style.display = 'none';
    }

    return;
}
/*
document.write('<select name="' + countryName + '" id="' + countryName + '" onChange="ChangeProvince(' + provinceName + ',this.value)" class=' + classname + '>');
document.write('<option value="" selected>--国家--</option>');
document.write('</select>');
document.write('<select name="' + provinceName + '" id="' + provinceName + '" onChange="ChangeCity(' + cityName + ',this.value)" class=' + classname + '>');
document.write('<option value="" selected>--省份--</option>');
document.write('</select><br />');
document.write('<select name="' + cityName + '" id="' + cityName + '" onChange="ChangeCommercial(' + zoneName + ',this.value)" class=' + classname + '>');
document.write('<option value="" selected>--城市--</option>');
document.write('</select>');
document.write('<select name="' + zoneName + '" id="' + zoneName + '" class=' + classname + '>');
document.write('<option value="" selected>--区域--</option>');
document.write('</select>');
document.write('<script language="javascript">p_change("' + countrycode + '","' + provincecode + '","' + citycode + '","' + commercialcode + '")</script>');
*/
