// 城市列表调用函数　morecity("点击城市名称所调用的函数名")
var cityDragTarget = ".cityH6"
var citylist = {};
citylist.city = {
"广东省":["1 广州市 GuangZhou","4 佛山市 FoShan","5 中山市 ZhongShan","6 深圳市 ShenZhen","66 湛江市 ZhanJiang","76 惠州市 HuiZhou","77 清远市 QingYuan","78 珠海市 ZhuHai","81 东莞市 DongGuan","82 江门市 JiangMen","96 肇庆市 ZhaoQing","101 韶关市 ShaoGuan","102 阳江市 YangJiang","110 茂名市 MaoMing","111 汕尾市 ShanWei"],
"北京市":["2 北京市 BeiJing"],
"上海市":["3 上海市 ShangHai"],
"河北省":["7 石家庄 ShiJiaZhuang","8 唐山市 TangShan","9 秦皇岛 QinHuangDao","12 保定市 BaoDing","83 廊坊市 LangFang","105 承德市 ChengDe"],
"山西省":["18 太原市 TaiYuan"],
"内蒙古":["21 包头市 BaoTou","100 兴安盟 XingAnMeng"],
"辽宁省":["22 沈阳市 ShenYang","23 大连市 DaLian","114 锦州市 JinZhou"],
"吉林省":["24 长春市 ChangChun","25 吉林市 JiLin"],
"黑龙江":["26 哈尔滨 HaErBin"],
"江苏省":["27 南京市 NanJing","28 无锡市 WuXi","29 徐州市 XuZhou","30 常州市 ChangZhou","31 苏州市 SuZhou","32 南通市 NanTong","33 连云港 LianYunGang","35 扬州市 YangZhou","69 昆山市 KunShan","72 常熟市 ChangShu","74 镇江市 ZhenJiang","86 盐城市 YanCheng","99 泰州市 TaiZhou","125 泰兴市 TaiXing"],
"天津市":["36 天津市 TianJin"],
"浙江省":["37 杭州市 HangZhou","38 宁波市 NingBo","39 温州市 WenZhou","68 绍兴市 ShaoXing","112 嘉兴市 JiaXing","121 靖江市 JingJiang"],
"安徽省":["40 合肥市 HeFei","90 淮南市 HuaiNan","91 安庆市 AnQing","92 巢湖市 ChaoHu","133 黄山市 HuangShan"],
"江西省":["41 南昌市 NanChang","95 赣州市 GanZhou"],
"山东省":["42 济南市 JiNan","43 青岛市 QingDao","65 威海市 WeiHai","71 潍坊市 WeiFang","73 烟台市 YanTai","87 日照市 RiZhao","89 淄博市 ZiBo","113 德州市 DeZhou","123 滨州市 BinZhou"],
"河南省":["44 郑州市 ZhengZhou","45 洛阳市 LuoYang","84 济源市 JiYuan","85 漯河市 LeiHe","122 濮阳市 PuYang"],
"湖北省":["46 武汉市 WuHan","70 宜昌市 YiChang","97 咸宁市 XianNing","98 随州市 SuiZhou"],
"湖南省":["47 长沙市 ChangSha","88 株洲市 ZhuZhou","93 岳阳市 YueYang"],
"广西省":["49 南宁市 NanNing","50 桂林市 GuiLin","94 玉林市 YuLin"],
"海南省":["51 海口市 HaiKou","79 陵水县 LingShuiXian","103 三亚市 SanYa","108 琼海市 QiongHai","115 万宁市 WanNing"],
"重庆市":["52 重庆市 ZhongQing"],
"四川省":["53 成都市 ChengDu","75 绵阳市 MianYang"],
"贵州省":["54 贵阳市 GuiYang"],
"云南省":["55 昆明市 KunMing","56 丽江市 LiJiang","124 大理市 DaLi"],
"西　藏":[""],
"陕西省":["58 西安市 XiAn"],
"甘肃省":["59 兰州市 LanZhou"],
"青海省":["60 西宁市 XiNing"],
"宁　夏":["120 银川市 YinChuan"],
"新　疆":[""],
"福建省":["64 厦门市 XiaMen","67 福州市 FuZhou"],
"澳　门":["80 澳门 AoMen"],
"香　港":["106 香港 XiangGang"],
"马来西亚":["117 吉隆坡 JiLongPo","119 槟城 BinCheng"],
"泰  国":["118 曼谷 ManGu"],
"澳大利亚":["126 悉尼 XiNi","127 墨尔本 MoErBen","128 布里斯班 BuLiSiBan","130 黄金海岸 HJinHaiAn","131 汤斯维尔 TangSiWeiEr","132 阿德莱德 AdeLaiDe"],
"新西兰":["129 奥克兰 AoKeLan"]}

function showcitylist(theFun){
var citystr = "";
var rowcount = 0;
	for ( var c in citylist.city ){
		rowcount += 1;
		if(rowcount%2==0)
			citystr += "<p class='odd'><span>" + c + "：</span><em>";
		else{
			citystr += "<p class='even'><span>" + c + "：</span><em>";
		}
		for ( var i=0; i<citylist.city[c].length; i++){
			cnStart = citylist.city[c][i].indexOf(" ");
			cnEnd = citylist.city[c][i].lastIndexOf(" ");
			cityNum = citylist.city[c][i].substring(0,cnStart);
			cityName = citylist.city[c][i].substring(cnStart+1,cnEnd);
			cityPy = citylist.city[c][i].substring(cnEnd+1);
			if(theFun=="index"){
				citystr += "<a href="+"javascript:" + theFun +"('" + cityPy + "');>"+cityName+"</a>"
			}else if(theFun=="way1"||theFun=="way2"){
				citystr += "<a href="+"javascript:" + theFun +"('" + cityName + "');>"+cityName+"</a>"
			}else{
				citystr += "<a href="+"javascript:" + theFun +"(" + cityNum + ");>"+cityName+"</a>"
			}
		};
		citystr += "</em></p>";
	}
		return citystr;
}	

function morecity(theFun){
	if(theFun==""|theFun==undefined){theFun="subpage";}
	var string = "<div class=\"more_city\">"+
				 "<p class=\"mc_l\"></p>"+
				 "<p class=\"mc_r\"></p>"+
				 "<div class=\"mc_m\">"+
				 "<h6 class=\"cityH6\"><a href=\"javascript:morecity_cls();\" class=\"mc_close\"></a>城市选择</h6>"+
				 "<div class=\"mc_if\">"+showcitylist(theFun)+"</div>"
				 "</div>"+
				 "</div>"
	jQuery(".city").append(string);
	if(cityDragTarget){cityDrag()}
}

function cityDrag(){
	jQuery("body").append("<script src='/bc/jsfile/core.js' type=\"text/javascript\"></script>")
	jQuery("body").append("<script src='/bc/jsfile/draggable.js' type=\"text/javascript\"></script>")
	setTimeout(function(){
		jQuery(cityDragTarget).css("cursor","pointer")
		jQuery(".more_city").draggable({handle:cityDragTarget})
	},0)
}
function index(cityid){
	if(cityid=='GuangZhou')	
		window.location.href = "http://gz.snifast.com/";
	else if(cityid=='ShenZhen')	
		window.location.href = "http://sz.snifast.com/";
	else if(cityid=='ShangHai')	
		window.location.href = "http://sh.snifast.com/";
	else if(cityid=='BeiJing')	
		window.location.href = "http://bj.snifast.com/";
	else
		window.location.href="http://www.snifast.com/"+cityid;
	
	}
function subpage(cityid){window.location.href="http://"+window.location.hostname+"/bcf.shtml?fr="+cityid;}
function hot(cityid){window.location.href="http://"+window.location.hostname+"/bcf.shtml?hot=hot&fr="+cityid;}
function map(cityid){window.location.href="http://"+window.location.hostname+"/map/map.shtml?m=tomap&fr="+cityid;}
function nmap(cityid){window.location.href="http://"+window.location.hostname+"/map/nmap.shtml?fr="+cityid;}
function bbs(cityid){window.location.href="http://"+window.location.hostname+"/bbs/bbsf.shtml?fr="+cityid;}
function guice(cityid){window.location.href="http://"+window.location.hostname+"/guice.shtml?fr="+cityid;}
function taofang(cityid){window.location.href="http://"+window.location.hostname+"/taofang.shtml?fr="+cityid;}
function qqt(cityid){window.location.href="http://"+window.location.hostname+"/qqt.shtml?fr="+cityid;}
function ngod(cityid){window.location.href="http://"+window.location.hostname+"/ngod.shtml?fr="+cityid;}
function ngodvideo(cityid){window.location.href="http://"+window.location.hostname+"/god.shtml?mtd=moreVideo&fr="+cityid;}
function way1(cityName){$("#way1").val(cityName);morecity_cls();};
function way2(cityName){$("#way2").val(cityName);morecity_cls();};

function morecity_cls(){
	jQuery(".more_city").fadeOut(100,function(){jQuery(".more_city").remove();});
}