﻿//var Countrys = new Array("中国","中国香港","中国澳门","中国台湾","其他");
var Countrys = new Array("中国");
var Provinces=new Array();
var Citys=new Array();
Provinces[0]=new Array("安徽","北京","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","天津","西藏","新疆","云南","浙江","重庆");
Citys[0]=new Array();
Citys[0][0]=new Array("安庆","蚌埠","巢湖","池州","滁州","阜阳","合肥","淮北","淮南","黄山","六安","马鞍山","宿州","铜陵","芜湖","宣城","亳州","宁国","无为");
Citys[0][1]=new Array("北京市");
Citys[0][2]=new Array("福州","龙岩","南平","宁德","莆田","泉州","三明","厦门","漳州","晋江");
Citys[0][3]=new Array("白银","定西","甘南自治州","嘉峪关","金昌","酒泉","兰州","临夏自治州","陇南","平凉","庆阳","天水","武威","张掖");
Citys[0][4]=new Array("潮州","东莞","佛山","广州","河源","惠州","江门","揭阳","茂名","梅州","清远","汕头","汕尾","韶关","深圳","阳江","云浮","湛江","肇庆","中山","珠海");
Citys[0][5]=new Array("百色","北海","崇左","防城港","桂林","贵港","河池","贺州","来宾","柳州","南宁","钦州","梧州","玉林");
Citys[0][6]=new Array("安顺","毕节","贵阳","六盘水","黔东南自治州","黔南自治州","黔西南自治州","铜仁","遵义","仁怀");
Citys[0][7]=new Array("白沙自治县","保亭自治县","昌江自治县","澄迈县","定安县","东方","海口","乐东自治县","临高县","陵水自治县","琼海","琼中自治县","三亚","屯昌县","万宁","文昌","五指山","儋州");
Citys[0][8]=new Array("保定","沧州","承德","邯郸","衡水","廊坊","秦皇岛","石家庄","唐山","邢台","张家口","霸州","泊头","怀来");
Citys[0][9]=new Array("安阳","鹤壁","济源","焦作","开封","洛阳","南阳","平顶山","三门峡","商丘","新乡","信阳","许昌","郑州","周口","驻马店","漯河","濮阳","荥阳","光山","济源","孟州");
Citys[0][10]=new Array("大庆","大兴安岭","哈尔滨","鹤岗","黑河","鸡西","佳木斯","牡丹江","七台河","齐齐哈尔","双鸭山","绥化","伊春");
Citys[0][11]=new Array("鄂州","恩施自治州","黄冈","黄石","荆门","荆州","潜江","神农架林区","十堰","随州","天门","武汉","仙桃","咸宁","襄樊","孝感","宜昌","丹江口");
Citys[0][12]=new Array("常德","长沙","郴州","衡阳","怀化","娄底","邵阳","湘潭","湘西自治州","益阳","永州","岳阳","张家界","株洲");
Citys[0][13]=new Array("白城","白山","长春","吉林","辽源","四平","松原","通化","延边自治州","榆树","梅河口");
Citys[0][14]=new Array("常州","淮安","连云港","南京","南通","苏州","宿迁","泰州","无锡","徐州","盐城","扬州","镇江","启东","东台","宜兴","江阴");
Citys[0][15]=new Array("抚州","赣州","吉安","景德镇","九江","南昌","萍乡","上饶","新余","宜春","鹰潭","樟树","临川","南康");
Citys[0][16]=new Array("鞍山","本溪","朝阳","大连","丹东","抚顺","阜新","葫芦岛","锦州","辽阳","盘锦","沈阳","铁岭","营口","大石桥");
Citys[0][17]=new Array("阿拉善盟","巴彦淖尔盟","包头","赤峰","鄂尔多斯","呼和浩特","呼伦贝尔","通辽","乌海","乌兰察布盟","锡林郭勒盟","兴安盟","临河","包头");
Citys[0][18]=new Array("固原","石嘴山","吴忠","银川");
Citys[0][19]=new Array("果洛自治州","海北自治州","海东","海南自治州","海西自治州","黄南自治州","西宁","玉树自治州");
Citys[0][20]=new Array("滨州","德州","东营","菏泽","济南","济宁","莱芜","聊城","临沂","青岛","日照","泰安","威海","潍坊","烟台","枣庄","淄博","滕州","青州","文登","蓬莱");
Citys[0][21]=new Array("长治","大同","晋城","晋中","临汾","吕梁","朔州","太原","忻州","阳泉","运城");
Citys[0][22]=new Array("安康","宝鸡","汉中","商洛","铜川","渭南","西安","咸阳","延安","榆林","安康");
Citys[0][23]=new Array("上海市");
Citys[0][24]=new Array("阿坝自治州","巴中","成都","达州","德阳","甘孜自治州","广安","广元","乐山","凉山自治州","眉山","绵阳","南充","内江","攀枝花","遂宁","雅安","宜宾","资阳","自贡","泸州");
Citys[0][25]=new Array("天津市");
Citys[0][26]=new Array("阿里","昌都","拉萨","林芝","那曲","日喀则","山南");
Citys[0][27]=new Array("阿克苏","阿拉尔","昌吉自治州","哈密","和田","喀什","克拉玛依","石河子","图木舒克","吐鲁番","乌鲁木齐","五家渠","伊犁");
Citys[0][28]=new Array("保山","楚雄自治州","大理自治州","德宏自治州","迪庆自治州","红河自治州","昆明","丽江","临沧","怒江自治州","曲靖","思茅","文山自治州","西双版纳","玉溪","昭通","个旧");
Citys[0][29]=new Array("杭州","湖州","嘉兴","金华","丽水","宁波","绍兴","台州","温州","舟山","衢州","湖州","瑞安");
Citys[0][30]=new Array("重庆市");


function Area(name,form,co,pr,ci)
{
	this.name=name;
	this.form=form;
	this.Country=co;
	this.Province=pr;
	this.City=ci;
	this.CountryValue="";		//默认值对象
	this.ProvinceValue="";
	this.CityValue="";
}
Area.prototype.Load=function()
{
	for (var i=0; i<Countrys.length; i++)
	{
		this.Country.options[i+1]=new Option(Countrys[i],Countrys[i]);
		if (Countrys[i]==this.CountryValue) this.Country.options[i+1].selected=true;
	}
	this.Province.style.display="none";
	this.City.style.display="none";
	this.ChangeCountry();
}
Area.prototype.ChangeCountry=function()
{
	if (this.Province.options.length>1)
	{
		for (var i=this.Province.options.length-1; i>0; i--)
		{
			this.Province.options[i]=null;
		}
	}
	this.Province.style.display="none";
	this.City.style.display="none";
	if (this.Country.selectedIndex==0) return;
	if (this.Country.selectedIndex>Provinces.length) return;
	for (var i=0; i<Provinces[this.Country.selectedIndex-1].length; i++)
	{
		this.Province.options[i+1]=new Option(Provinces[this.Country.selectedIndex-1][i],Provinces[this.Country.selectedIndex-1][i]);
		if (this.ProvinceValue==Provinces[this.Country.selectedIndex-1][i]) this.Province.options[i+1].selected=true;
	}
	this.Province.style.display="";
	this.ChangeProvince();
}
Area.prototype.ChangeProvince=function()
{
	this.City.style.display="none";
	if (this.City.options.length>1)
	{
		for (var i=this.City.options.length-1; i>0; i--)
		{
			this.City.options[i]=null;
		}
	}
	if (this.Province.selectedIndex==0) return;
	if (this.Country.selectedIndex>Provinces.length) return;
	if (this.Province.selectedIndex>Citys[this.Country.selectedIndex-1].length) return;
	for (var i=0; i<Citys[this.Country.selectedIndex-1][this.Province.selectedIndex-1].length; i++)
	{
		this.City.options[i+1]=new Option(Citys[this.Country.selectedIndex-1][this.Province.selectedIndex-1][i],Citys[this.Country.selectedIndex-1][this.Province.selectedIndex-1][i]);
		if (this.CityValue==Citys[this.Country.selectedIndex-1][this.Province.selectedIndex-1][i]) this.City.options[i+1].selected=true;
	}
	this.City.style.display="";
}
