// 城市列表调用函数　morecity("点击城市名称所调用的函数名")
var cityDragTarget = ".cityH6"
var citylist = {};
citylist.city = {
"华北东北":["2 北京市 bj","36 天津市 tj"],
"华东华中":["3 上海市 sh","42 济南市 jn","43 青岛市 qd","65 威海市 whai","71 潍坊市 wf","73 烟台市 yt","87 日照市 rz","89 淄博市 zb","113 德州市 dz","123 滨州市 bz"],
"特区华南":["1 广州市 gz","6 深圳市 sz","106 香港 hk","80 澳门 macau","4 佛山市 fs","5 中山市 zs","76 惠州市 hzhou","49 南宁市 nn"],
"海    外":["129 奥克兰 auckland","117 吉隆坡 kuala","119 槟城 penang","118 曼谷 bangkok","126 悉尼 sydney","127 墨尔本 melbourne","128 布里斯班 brisbane","130 黄金海岸 goldcoast","131 汤斯维尔 townsville","132 阿德莱德 adelaide"]
}

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){
		window.location.href="http://"+cityid+".snifast.com/";
	}
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();});
}