 var isIe=(document.all)?true:false;

if("undefined"==typeof citylist){
	var citylist={
	};
}

var layer_index ;

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

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

function citylistBox(){
	var messContent = new Array();
	messContent.push("<div class='hotcitytitle'>热门城市和地区</div>");
	messContent.push("<ul class='hotcityul'>")
	//热点城市 
	for (var h = 0; h < citylist.hot_city.length ; ++ h){
		messContent.push("<li><strong><A class='red' href=\"javascript:setCurrentCity('" + citylist.hot_city[h] + "');\">" + citylist.hot_city[h] + "</A></strong></LI>");
	}
	messContent.push("</ul>")
	messContent.push("<div style='margin-left:10px;position:relative;z-index:1;'><input type='text' class='ch_inpput' id='citySearchInput'  />&nbsp;&nbsp;<input type='button' style='width:60px;'  value='确定' id='citySearchBtn' onclick='search()'/><span style='color:red;margin-left:20px;' id='citysearcherror2' ></span><ul class='inputlist' style='display:none' id='citySearchUl2'><li>sdfsdf</li><li>sdfsdf</li><li>sdfsdf</li></ul></div>")
	messContent.push("<ul class='city_type'><li class='first'>城市列表：</li><li class='or' onclick=\"area('0','1');\" id=\"pin_li1\"><a href=\"javascript:void(0)\">按拼音排序</a></li><li class='' onclick=\"area('1','1');\" id=\"area_li1\" ><a href=\"javascript:void(0);\">按地区排序</a></li></ul>");
	messContent.push("<div class='mesWindowContent' id='mesWindowContent'><div id=\"pin1\" style=\"display:block\">");

	
	//城市列表
		var cities = citylist.city;
		for (var t in cities){
			if (cities[t].length > 0){
				messContent.push("<ul><li class='letters'>" + t + "</li>");
				for (var i = 0;i < cities[t].length; ++i){
					messContent.push("<div style='margin-left:40px;'><li><a href=\"javascript:void(0)\" onclick=\"javascript:setCurrentCity('" + cities[t][i] + "');return false;\">" + cities[t][i] + "</a></li></div>");
				}
				messContent.push("</ul>");
			}
		}
		messContent.push("</div>");
	//按地区排序
		messContent.push("<div id=\"area1\" style=\"display:none\">");

	//城市列表
		var cities = citylist.areacity;
		for (var t in cities){
			if (cities[t].length > 0){
				messContent.push("<ul><li class='letters'>" + t + "</li>");
				for (var i = 0;i < cities[t].length; ++i){
					messContent.push("<div style='margin-left:60px;'><li><a href=\"javascript:void(0)\" onclick=\"javascript:setCurrentCity('" + cities[t][i] + "');return false;\">" + cities[t][i] + "</a></li></div>");
				}
				messContent.push("</ul>");
			}
		}
		messContent.push("</div>");
		messContent.push("</div>");
		//页面层-自定义
		layer_index = layer.open({
		  type: 1,
		  title: false,
		  shadeClose: true,
		  area: ['800px', '500px'],
		  content: messContent.join("")
		});
}

function area(a,i){
	if(a=='0'){
		document.getElementById('area_li'+i).className ="";
		document.getElementById('pin_li'+i).className ="or";
		document.getElementById('area'+i).style.display = "none";
		document.getElementById('pin'+i).style.display = "block";		
	}
	if(a=='1'){
		document.getElementById('area_li'+i).className ="or";
		document.getElementById('pin_li'+i).className ="";
		document.getElementById('area'+i).style.display = "block";
		document.getElementById('pin'+i).style.display = "none";
	}
}

function setCurrentCity(city){
	setMapCity(city);
	layer.close(layer_index);
}


function search(){
	var city = $("#citySearchInput").val();
	setCurrentCity(city)
}

