﻿document.write("<div id=\"Dlg_Code_Area\" Title=\"地区\" style=\"text-align:left;display:none\">");document.write("<div class=\"code_div_title\" style=\"width:622px;\"><strong><span id='code_div_title_local'></span></strong> [<span id=\"code_div_nav_local\"></span>]</div>");document.write("<div id=\"code_div_area_local\"></div>");document.write("<div class=\"code_div_title\" style=\"width:622px;\"><strong><span id='code_div_title_other'></span></strong> [<span id=\"code_div_nav_other\"></span>]</div>");document.write("<div id=\"code_div_area_other\"></div>");document.write("</div>"); var citystring = "430000,湖南省,hu,|430100,长沙市,chang,|430101,长沙芙蓉区,chang,|430102,长沙天心区,chang,|430103,长沙岳麓区,chang,|430104,长沙开福区,chang,|430105,长沙雨花区,chang,|430106,长沙开发区,chang,|430107,长沙县,chang,|430108,望城县,wang,|430109,宁乡县,ning,|430110,浏阳市,yang,|430200,株洲,zhu,|430300,湘潭,xiang,|430400,衡阳,heng,|430500,邵阳,shao,|430600,岳阳,yue,|430700,常德,chang,|430800,张家界,zhang,|430900,益阳,yi,|431000,郴州,chen,|431100,永州,yong,|431200,怀化,huai,|431300,娄底,lou,|431400,湘西自治州,xiang,|110000,北京市,bei,|120000,天津市,tian,|130000,河北省,he,|130100,石家庄市,shi,|140000,山西省,shan,|140100,太原市,tai,|150000,内蒙古自治区,nei,|150100,呼和浩特市,hu,|210000,辽宁省,liao,|210100,沈阳市,shen,|210200,大连市,da,|220000,吉林省,ji,|220100,长春市,chang,|220200,吉林市,ji,|230000,黑龙江省,hei,|230100,哈尔滨市,ha,|310000,上海市,shang,|320000,江苏省,jiang,|320100,南京市,nan,|320200,无锡市,wu,|320300,徐州市,xu,|320400,常州市,chang,|320500,苏州市,su,|320510,常熟市,chang,|320600,南通市,nan,|320700,连云港市,lian,|320800,淮阴市,huai,|320900,盐城市,yan,|321000,扬州市,yang,|321100,镇江市,zhen,|330000,浙江省,zhe,|330100,杭州市,hang,|330200,宁波市,ning,|330300,温州市,wen,|340000,安徽省,ansheng,|340100,合肥市,he,|340200,芜湖市,wu,|340300,蚌埠市,bang,|350000,福建省,fu,|350100,福州市,fu,|350200,厦门市,xia,|360000,江西省,jiang,|360100,南昌市,nan,|370000,山东省,shan,|370100,济南市,ji,|370200,青岛市,qing,|410000,河南省,he,|410100,郑州市,zheng,|420000,湖北省,hu,|420100,武汉市,wu,|440000,广东省,guang,|440100,广州市,guang,|440300,深圳市,shen,|440400,珠海市,zhu,|450000,广西壮族自治区,guang,|450100,南宁市,nan,|460000,海南省,hai,|460100,海口市,hai,|510000,四川省,si,|510100,成都市,cheng,|510200,重庆市,zhong,|520000,贵州省,gui,|520100,贵阳市,gui,|530000,云南省,yun,|530100,昆明市,kun,|540000,西藏自治区,xi,|540100,拉萨市,la,|610000,陕西省,shan,|610100,西安市,xi,|620000,甘肃省,gan,|620100,兰州市,lan,|630000,青海省,qing,|630100,西宁市,xi,|640000,宁夏回族自治区,ning,|640100,银川市,yin,|650000,新疆维吾尔自治区,xin,|650100,乌鲁木齐市,wu,|710000,台湾省,tai,|710100,台北地区,tai,|810000,港、澳地区,gang,|810100,香港特别行政特区,xiang,|810200,澳门特别行政特区,aoxing,|810300,国内,guo,|810400,国外,guo,"; var arraycity = citystring.split("|"); function showarealocal(id) { var tmpstr = ""; for (i = 0; i < arraycity.length; i++) { var tmpcity = arraycity[i].split(","); if (tmpcity[0].substring(0, 2) == "43") { if (id == "") { if (tmpcity[0].substring(4, 6) == "00") tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } else if (id.substring(4, 6) == "00") { if ((tmpcity[0].substring(0, 4) == id.substring(0, 4)) && ((tmpcity[3] == "*") || (tmpcity[3] == ""))) tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } else { if ((tmpcity[0] == id)||(tmpcity[3] == id)) tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } } } if (id == "") id = "430000"; $("#code_div_nav_local").html(getareanav(id)); $("#code_div_area_local").html(tmpstr); } function showareaother(id) { var tmpstr = ""; for (i = 0; i < arraycity.length; i++) { var tmpcity = arraycity[i].split(","); if (tmpcity[0].substring(0, 2) != "43") { if (id == "") { if (tmpcity[0].substring(2, 6) == "0000") tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } else if (id.substring(2, 6) == "0000") { if ((tmpcity[0].substring(0, 2) == id.substring(0, 2)) && (tmpcity[0].substring(4, 6) == "00")) tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } else if (id.substring(4, 6) == "00") { if ((tmpcity[0].substring(0, 4) == id.substring(0, 4)) && ((tmpcity[3] == "*") || (tmpcity[3] == ""))) tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } else { if ((tmpcity[0] == id) || (tmpcity[3] == id)) tmpstr += getareadiv(tmpcity[0], tmpcity[1], tmpcity[2], id); } } } $("#code_div_nav_other").html(getareanav(id)); $("#code_div_area_other").html(tmpstr); } function getareadiv(id, name, nameen, oldid) { if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) { if (oldid != id) return "<button class='code_div_text' onclick=\"changecodearea('" + id + "', $(this).html())\">" + nameen + "</button>"; else return "<button class='code_div_text' onclick=\"SelectCode($('#Dlg_Code_Area'), '" + id + "', $(this).html())\">" + nameen + "</button>"; } else { if (oldid != id) return "<button class='code_div_text' onclick=\"changecodearea('" + id + "', $(this).html())\">" + name + "</button>"; else return "<button class='code_div_text' onclick=\"SelectCode($('#Dlg_Code_Area'), '" + id + "',$(this).html())\">" + name + "</button>"; } } function getareanav(id) { var tmpstr = "<a href=\"javascript:showarealocal('')\">湖南</a>"; if (id.substring(0, 2) != "43") tmpstr = "<a href=\"javascript:showareaother('')\">外省</a>"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) { tmpstr = "<a href=\"javascript:showarealocal('')\">Hunan</a>"; if (id.substring(0, 2) != "43") tmpstr = "<a href=\"javascript:showareaother('')\">Others</a>"; } for (i = 0; i < arraycity.length; i++) { var tmpcity = arraycity[i].split(","); if (id.substring(2, 6) == "0000") { if (id.substring(0, 2) != "43") { if (id == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + id + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; break; } } } else if (id.substring(4, 6) == "00") { if (id.substring(0, 2) != "43") { if (id.substring(0, 2) + "0000" == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + tmpcity[0] + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; } else if (id == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + id + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; break; } } else { if (id == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showarealocal('" + id + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; break; } } } else { if (id.substring(0, 2) != "43") { if (id.substring(0, 2) + "0000" == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + tmpcity[0] + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; } if (id.substring(0, 4) + "00" == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + tmpcity[0] + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; } else if (id == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showareaother('" + id + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; break; } } else { if (id.substring(0, 4) + "00" == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showarealocal('" + tmpcity[0] + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; } else if (id == tmpcity[0]) { tmpstr += " > <a href=\"javascript:showarealocal('" + id + "')\">"; if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) tmpstr += tmpcity[2]; else tmpstr += tmpcity[1]; tmpstr += "</a>"; break; } } } } return tmpstr; } function areaislastitem(id) { var islast = true; for (i = 0; i < arraycity.length; i++) { var tmpcity = arraycity[i].split(","); if (id.substring(2, 6) == "0000") { if ((tmpcity[0].substring(0, 2) == id.substring(0, 2)) && (tmpcity[0] != id)) { islast = false; break; } } else if (id.substring(4, 6) == "00") { if ((tmpcity[0].substring(0, 4) == id.substring(0, 4)) && (tmpcity[0] != id)) { islast = false; break; } } else { if (id == tmpcity[3]) { islast = false; break; } } } return islast; } $(function() { BindDialog($("#Dlg_Code_Area"), 668, "000000", "请选择地区", areaopen); }); function areaopen() { if ($("#Dlg_Code_Area").dialog("option", "LANG") == 1) { $("#code_div_title_local").html("Hunan Province"); $("#code_div_title_other").html("Other Provinces"); $("#Dlg_Code_Area").dialog("option", "title", "Area"); $("#Dlg_Code_Area").dialog("option", "buttons", { "Cancel": function() { Cancel($(this)); }, "Empty options": function() { Empty($(this), "000000", "Please select"); } }); } else { $("#code_div_title_local").html("湖南地区"); $("#code_div_title_other").html("外省"); $("#Dlg_Code_Area").dialog("option", "title", "地区"); $("#Dlg_Code_Area").dialog("option", "buttons", { "取消": function() { Cancel($(this)); }, "清空选项": function() { Empty($(this), "000000", "请选择地区"); } }); } showarealocal(""); showareaother(""); } function changecodearea(id, name) { if (id != "430000") { if (id.substring(0, 2) == "43") { if (areaislastitem(id)) SelectCode($("#Dlg_Code_Area"), id, name); else showarealocal(id); return; } else { if (areaislastitem(id)) SelectCode($("#Dlg_Code_Area"), id, name); else showareaother(id); return; } } SelectCode($("#Dlg_Code_Area"), id, name); }
