function setcity(provinceid, cityid) {
	var province = document.getElementById(provinceid).value;
    switch (province) {
        case "East Anglia" :
            var cityOptions = new Array(
            "Cambridgeshire", "Cambridgeshire",
            "Norfolk", "Norfolk",
            "Suffolk", "Suffolk");
             break;
        case "East Midlands" :
            var cityOptions = new Array(
            "Derbyshire", "Derbyshire",
            "Leicestershire", "Leicestershire",
            "Lincolnshire", "Lincolnshire",
            "Northamptonshire", "Northamptonshire",
            "Nottinghamshire", "Nottinghamshire",
            "Rutland", "Rutland");
            break;
        case "London" :
            var cityOptions = new Array(
            "Central/West End", "Central/West End",
            "City", "City",
            "East London", "East London",
            "North London", "North London",
            "North West London", "North West London",
            "South East London", "South East London",
            "South West London","South West London",
            "West London", "West London");
            break;
        case "North East" :
            var cityOptions = new Array(
            "Durham", "Durham",
            "Northumberland", "Northumberland",
            "Teesside", "Teesside",
            "Tyneside", "Tyneside");
             break;
        case "North West" :
            var cityOptions = new Array(
            "Cheshire", "Cheshire",
            "Cumbria", "Cumbria",
            "Greater Manchester", "Greater Manchester",
            "Lancashire", "Lancashire",
            "Merseyside", "Merseyside");
            break;
        case "South East" :
            var cityOptions = new Array(
            "Bedfordshire", "Bedfordshire",
            "Berkshire", "Berkshire",
            "Buckinghamshire", "Buckinghamshire",
            "East Sussex", "East Sussex",
            "Essex", "Essex",
            "Hampshire", "Hampshire",
            "Hertfordshire", "Hertfordshire",
            "Isle of Wight", "Isle of Wight",
            "Kent", "Kent",
            "Oxfordshire", "Oxfordshire",
            "Surrey", "Surrey",
            "West Sussex", "West Sussex");
            break;
        case "South West" :
            var cityOptions = new Array(
            "Bristol Area", "Bristol Area",
            "Cornwall", "Cornwall",
            "Devon", "Devon",
            "Dorset", "Dorset",
            "Gloucestershire", "Gloucestershire",
            "Somerset", "Somerset",
            "Wiltshire", "Wiltshire");
            break;
        case "West Midlands" :
            var cityOptions = new Array(
            "Birmingham", "Birmingham",
            "Hereford &amp; Worcester", "Hereford &amp; Worcester",
            "Shropshire", "Shropshire",
            "Staffordshire", "Staffordshire",
            "Warwickshire", "Warwickshire");
            break;
        case "Yorkshire" :
            var cityOptions = new Array(
            "East Riding", "East Riding",
            "North Yorkshire", "North Yorkshire",
            "South Yorkshire", "South Yorkshire",
            "West Yorkshire", "West Yorkshire",
            "West Yorkshire", "West Yorkshire");
            break;
        case "Scotland" :
            var cityOptions = new Array(
            "Aberdeenshire", "Aberdeenshire",
            "Angus", "Angus",
            "Argyll &amp; Bute", "Argyll &amp; Bute",
            "Ayrshire", "Ayrshire",
            "Borders", "Borders",
            "Dumfries &amp; Galloway", "Dumfries &amp; Galloway",
            "Edinburgh &amp; Lothians", "Edinburgh &amp; Lothians",
            "Fife", "Fife",
            "Glasgow Area", "Glasgow Area",
            "Highlands &amp; Islands", "Highlands &amp; Islands",
            "Lanarkshire", "Lanarkshire",
            "Moray", "Moray",
            "Perth &amp; Kinross", "Perth &amp; Kinross",
            "Stirling", "Stirling");
            break;
        case "Wales" :
            var cityOptions = new Array(
            "Cardiff", "Cardiff",
            "Carmarthenshire", "Carmarthenshire",
            "Ceredigion", "Ceredigion",
            "Conwy", "Conwy",
            "Denbighshire", "Denbighshire",
            "Flintshire", "Flintshire",
            "Gwynedd", "Gwynedd",
            "Isle of Anglesey", "Isle of Anglesey",
            "Monmouthshire", "Monmouthshire",
            "Pembrokeshire", "Pembrokeshire",
            "Powys", "Powys",
            "South Wales", "South Wales",
            "South Wales", "South Wales");
            break;
        case "N. Ireland" :
            var cityOptions = new Array(
            "Antrim", "Antrim",
            "Armagh", "Armagh",
            "Belfast", "Belfast",
            "Down", "Down",
            "Fermanagh", "Fermanagh",
            "Londonderry", "Londonderry",
            "Tyrone", "Tyrone");
            break;
        case "Channel I." :
            var cityOptions = new Array(
            "Jersey", "Jersey",
            "Guernsey", "Guernsey");
            break;
        case "中国" :
            var cityOptions = new Array(
            "安徽", "安徽",
            "北京", "北京",
            "重庆", "重庆",
            "福建", "福建",
            "甘肃", "甘肃",
            "广东", "广东",
            "广西", "广西",
            "贵州", "贵州",
            "海南", "海南",
            "河北", "河北",
            "黑龙江", "黑龙江",
            "河南", "河南",
            "香港", "香港",
            "湖北", "湖北",
            "湖南", "湖南",
            "江苏", "江苏",
            "江西", "江西",
            "吉林", "吉林",
            "辽宁", "辽宁",
            "澳门", "澳门",
            "内蒙古", "内蒙古",
            "宁夏", "宁夏",
            "青海", "青海",
            "山东", "山东",
            "上海", "上海",
            "山西", "山西",
            "陕西", "陕西",
            "四川", "四川",
            "台湾", "台湾",
            "天津", "天津",
            "新疆", "新疆",
            "西藏", "西藏",
            "云南", "云南",
            "浙江", "浙江");
            break;
        case "其他地区" :
            var cityOptions = new Array(
            "欧洲", "欧洲",
            "北美", "北美",
            "南美", "南美",
            "亚洲", "亚洲",
            "非洲", "非洲",
            "大洋洲", "大洋洲",
            "火星", "火星");
            break;

		default:
            var cityOptions = new Array("选择地区", "");
            break;
    }
	
	var cityObject = document.getElementById(cityid);
	cityObject.options.length = 0;
	cityObject.options[0] = new Option("选择地区", "");
	var j = 0;
	for(var i = 0; i < cityOptions.length/2; i++) {
		j = i + 1;
	    cityObject.options[j] = new Option(cityOptions[i*2],cityOptions[i*2+1]);
	}
}

function initprovcity(provinceid, province) {
	var provObject = document.getElementById(provinceid);
    for(var i = 0; i < provObject.options.length; i++) {
        if (provObject.options[i].value == province) {
        	provObject.selectedIndex = i;
			break;
        }
    }
    //setcity(provinceid, cityid);
}

function showprovince(provinceid, cityid, province) {
	var provinces = new Array(
		"East Anglia", "East Midlands", "London", "North East", "North West", "South East", "South West", "West Midlands", "Yorkshire", "Scotland", "Wales", "N. Ireland", "Channel I.",
		"中国", "其他地区"
	);

	var html = "<select name=\"" + provinceid + "\" id=\"" + provinceid + "\" onchange=\"setcity('" + provinceid + "', '" + cityid + "');\">";
	html = html + "<option value=\"\">选择区域</option>";
	for(var i = 0; i < provinces.length; i++) {
		html = html + "<option value=\"" + provinces[i] + "\">" + provinces[i] + "</option>";
	}
	html = html + "</select>";
	document.write(html);

	initprovcity(provinceid, province);

}

function showcity(cityid, city) {


	var html = "<select name=\"" + cityid + "\" id=\"" + cityid + "\">";
	if(city == "") {
		html = html + "<option value=\"\">选择地区</option>";
	} else {
		html = html + "<option value=\"" + city + "\">" + city + "</option>";
	}
	html = html + "</select>";
	document.write(html);
}