// JavaScript Document
/*
用法：
	引入此文件，并将sheng shi两个变量初始化 这两个变量主要是编辑的时候提供用的
	比如一开始是 安徽省 合肥市则 var sheng='安徽'; var shi='合肥';
	提供表单: 省份province  城市city
*/
function citys(obj,city_on)
{
    var city_date={};

    city_date['安徽']=new Array("安庆","蚌埠","巢湖","池州","滁州","阜阳","合肥","淮北","淮南","黄山","六安","马鞍山","宿州","铜陵","芜湖","宣城","亳州");
	
    city_date['北京']=new Array("北京");
	
    city_date['福建']=new Array("福州","龙岩","南平","宁德","莆田","泉州","三明","厦门","漳州");
	
    city_date['甘肃']=new Array("白银","定西","甘南藏族自治州","嘉峪关","金昌","酒泉","兰州","临夏回族自治州","陇南","平凉","庆阳","天水","武威","张掖");
	
    city_date['广东']=new Array("广州","潮州","东莞","佛山","河源","惠州","江门","揭阳","茂名","梅州","清远","汕头","汕尾","韶关","深圳","阳江","云浮","湛江","肇庆","中山","珠海");
	
    city_date['广西']=new Array("百色","北海","崇左","防城港","桂林","贵港","河池","贺州","来宾","柳州","南宁","钦州","梧州","玉林");
	
    city_date['贵州']=new Array("安顺","毕节","贵阳","六盘水","黔东南苗族侗族自治州","黔南布依族苗族自治州","黔西南布依族苗族自治州","铜仁","遵义");
	
    city_date['海南']=new Array("白沙黎族自治县","保亭黎族苗族自治县","昌江黎族自治县","澄迈县","定安县","东方","海口","乐东黎族自治县","临高县","陵水黎族自治县","琼海","琼中黎族苗族自治县","三亚","屯昌县","万宁","文昌","五指山","儋州");
	
    city_date['河北']=new Array("保定","沧州","承德","邯郸","衡水","廊坊","秦皇岛","石家庄","唐山","邢台","张家口");
	
    city_date['河南']=new Array("安阳","鹤壁","济源","焦作","开封","洛阳","南阳","平顶山","三门峡","商丘","新乡","信阳","许昌","郑州","周口","驻马店","漯河","濮阳");
	
    city_date['黑龙江']=new Array("大庆","大兴安岭","哈尔滨","鹤岗","黑河","鸡西","佳木斯","牡丹江","七台河","齐齐哈尔","双鸭山","绥化","伊春");
	
    city_date['湖北']=new Array("鄂州","恩施土家族苗族自治州","黄冈","黄石","荆门","荆州","潜江","神农架林区","十堰","随州","天门","武汉","仙桃","咸宁","襄樊","孝感","宜昌");
	
    city_date['湖南']=new Array("常德","长沙","郴州","衡阳","怀化","娄底","邵阳","湘潭","湘西土家族苗族自治州","益阳","永州","岳阳","张家界","株洲");
	
    city_date['吉林']=new Array("长春","白城","白山","吉林","辽源","四平","松原","通化","延边朝鲜族自治州");
	
    city_date['江苏']=new Array("常州","淮安","连云港","南京","南通","苏州","宿迁","泰州","无锡","徐州","盐城","扬州","镇江");
	
    city_date['江西']=new Array("南昌","抚州","赣州","吉安","景德镇","九江","萍乡","上饶","新余","宜春","鹰潭");
	
    city_date['辽宁']=new Array("大连","鞍山","本溪","朝阳","丹东","抚顺","阜新","葫芦岛","锦州","辽阳","盘锦","沈阳","铁岭","营口");
	
    city_date['内蒙古']=new Array("阿拉善盟","巴彦淖尔盟","包头","赤峰","鄂尔多斯","呼和浩特","呼伦贝尔","通辽","乌海","乌兰察布盟","锡林郭勒盟","兴安盟");
	
    city_date['宁夏']=new Array("银川","固原","石嘴山","吴忠");
	
    city_date['青海']=new Array("西宁","果洛藏族自治州","海北藏族自治州","海东","海南藏族自治州","海西蒙古族藏族自治州","黄南藏族自治州","玉树藏族自治州");
	
    city_date['山东']=new Array("青岛","滨州","德州","东营","菏泽","济南","济宁","莱芜","聊城","临沂","日照","泰安","威海","潍坊","烟台","枣庄","淄博");
	
    city_date['山西']=new Array("太原","长治","大同","晋城","晋中","临汾","吕梁","朔州","忻州","阳泉","运城");
    city_date['陕西']=new Array("宝鸡","安康","汉中","商洛","铜川","渭南","西安","咸阳","延安","榆林");
	
    city_date['四川']=new Array("成都","自贡","攀枝花" ,"广汉","江油","广元","遂宁","内江","乐山","峨眉山","南充","阆中","眉山","宜宾","广安","华蓥","达州","万源","雅安","巴中","资阳","简阳","西昌");
	
    city_date['上海']=new Array("上海");
	
    city_date['天津']=new Array("天津");
	
    city_date['西藏']=new Array("拉萨","阿里","昌都","林芝","那曲","日喀则","山南");
	
    city_date['新疆']=new Array("乌鲁木齐","阿克苏","阿拉尔","巴音郭楞蒙古自治州","博尔塔拉蒙古自治州","昌吉回族自治州","哈密","和田","喀什","克拉玛依","克孜勒苏柯尔克孜自治州","石河子","图木舒克","吐鲁番","五家渠","伊犁哈萨克自治州");
	
    city_date['云南']=new Array("昆明","保山","楚雄彝族自治州","大理白族自治州","德宏傣族景颇族自治州","迪庆藏族自治州","红河哈尼族彝族自治州","丽江","临沧","怒江傈傈族自治州","曲靖","思茅","文山壮族苗族自治州","西双版纳傣族自治州","玉溪","昭通");
	
    city_date['浙江']=new Array("杭州","湖州","嘉兴","金华","丽水","宁波","绍兴","台州","温州","舟山","衢州");
	
    city_date['重庆']=new Array("重庆");
	
    city_date['省份']=new Array("城市");
	
    var cityhtml = document.forms['userInfo'].city;
    cityhtml.length=0;  //删除原有的
	
    var citys=obj.value;	
    
    if(citys == ''){
	cityhtml.options.add(new Option("城市",""));	
    }else{
	for(i=0;i<city_date[citys].length;i++)
	{
	    
	    cityhtml.options.add(new Option(city_date[citys][i],city_date[citys][i]));
	    if(city_on==city_date[citys][i])
	    { 	   
		cityhtml.options[i].selected = true;
	    }	
	}
	
    }
	 
    
	
}

function province(_province, _shi)
{
    var provincehtml = document.forms['userInfo'].province;
    var cityhtml = document.forms['userInfo'].city;
    var provices=Array("省份","安徽","北京","福建","甘肃","广东","广西","贵州","海南","河北","河南","黑龙江","湖北","湖南","吉林","江苏","江西","辽宁","内蒙古","宁夏","青海","山东","山西","陕西","上海","四川","天津","西藏","新疆","云南","浙江","重庆");
    for(j=0;j<provices.length;j++)
    {	
	if(provices[j] == "省份"){
	    provincehtml.options.add(new Option(provices[j],""));
	    cityhtml.options.add(new Option("城市",""));
	}else{
	    provincehtml.options.add(new Option(provices[j],provices[j]));
	}
		
	if(_province==provices[j] && _province){			 
	    provincehtml.options[j].selected = true;
	    var provincehtml3 = document.forms['userInfo'].province;
	    citys(provincehtml3,_shi);
	}	
    }
	

}
