//var	citys="北京,上海,广州,天津,深圳,重庆,济南,南京,杭州,成都,武汉,福州,郑州,沈阳,长沙,南宁,西安,银川,拉萨,合肥,太原,昆明,长春,南昌,兰州,贵阳,海口,西宁,大连,唐山,保定,东莞,珠海,佛山,惠州,中山,汕头,江门,苏州,无锡,南通,常州,扬州,温州,宁波,台州,绍兴,金华,青岛,威海,淄博,潍坊,烟台,厦门,泉州,宜昌,绵阳,石家庄,哈尔滨,,乌鲁木齐,呼和浩特";
var C = "#D32A25";
//var citys="<font color='"+C+"'>北京</font>,<font color='"+C+"'>天津</font>,<font color='"+C+"'>上海</font>,<font color='"+C+"'>重庆</font>,<font color='"+C+"'>广州</font>,深圳,宝安,龙岗,珠海,东莞,虎门,佛山,顺德,惠州,中山,汕头,江门,樟木头,<font color='"+C+"'>海口</font>,<font color='"+C+"'>南宁</font>,<font color='"+C+"'>南京</font>,无锡,江阴,南通,常州,扬州,苏州,昆山,张家港,<font color='"+C+"'>杭州</font>,宁波,台州,泉州,温州,绍兴,金华,<font color='"+C+"'>合肥</font>,<font color='"+C+"'>南昌</font>,<font color='"+C+"'>济南</font>,青岛,烟台,威海,淄博,潍坊,<font color='"+C+"'>石家庄</font>,保定,唐山,<font color='"+C+"'>太原</font>,<font color='"+C+"'>呼和浩特</font>,,<font color='"+C+"'>福州</font>,厦门,<font color='"+C+"'>长沙</font>,<font color='"+C+"'>郑州</font>,<font color='"+C+"'>武汉</font>,宜昌,<font color='"+C+"'>沈阳</font>,大连,<font color='"+C+"'>长春</font>,<font color='"+C+"'>哈尔滨</font>,<font color='"+C+"'>银川</font>,<font color='"+C+"'>西安</font>,<font color='"+C+"'>西宁</font>,<font color='"+C+"'>兰州</font>,<font color='"+C+"'>成都</font>,绵阳,<font color='"+C+"'>昆明</font>,<font color='"+C+"'>拉萨</font>,<font color='"+C+"'>贵阳</font>,<font color='"+C+"'>乌鲁木齐</font>";
//var citys="北京,天津,上海,重庆,广州,深圳,宝安,龙岗,珠海,东莞,虎门,佛山,顺德,惠州,中山,汕头,江门,樟木头,海口,南宁,南京,无锡,江阴,南通,常州,扬州,苏州,昆山,张家港,杭州,宁波,台州,泉州,温州,绍兴,金华,合肥,南昌,济南,青岛,烟台,威海,淄博,潍坊,石家庄,保定,唐山,太原,呼和浩特,,福州,厦门,长沙,郑州,武汉,宜昌,沈阳,大连,长春,哈尔滨,银川,西安,西宁,兰州,成都,绵阳,昆明,拉萨,贵阳,乌鲁木齐";
//var citys="江西,南昌,新余,赣州,吉安,九江,抚州,上饶,宜春,萍乡,景德镇,鹰潭";
var citys="江西,南昌,赣州,宜春,吉安,上饶,抚州,九江,景德镇,萍乡,新余,鹰潭";
var names="收费站,服务区,加油站,维修厂,医院,交警大队,路政大队,派出所,旅游景点";
function CityMenu( o , a , img ){
	this.num = 5;
	this.fonts = a.split(",");
	this.obj = ( typeof o == "string" )? document.getElementById(o):o;
	if( this.obj.nextSibling && this.obj.nextSibling.tagName ){
		if( this.obj.nextSibling.tagName.toUpperCase() == "BR" ){
			this.obj.parentNode.removeChild( this.obj.nextSibling );
		}
	}
	this.img = null;
	if( typeof img == "object" ){
		this.img = img;
	}else{
		this.img = new Image();
		this.img.src = img;
	}
	var o = this;
	this.img.onclick = function(){
		o.btnClick();
	}
	/*
	this.img.onmouseover = function(){	//zhb
		o.setVisible(true);
	}
    */
	if( document.all ){
		this.img.style.cursor = "hand";
	}else{
		this.img.style.cursor = "pointer";
	}
	this.tab = document.createElement("table");
	this.tab.cellPadding = 0;
	this.tab.cellSpacing = 0;
	this.tab.border = 0;
	this.obj.parentNode.insertBefore( this.tab , this.obj );
	var newTR = this.tab.insertRow(0);
	var newTD0 = newTR.insertCell(0);
	var newTD1 = newTR.insertCell(1);
	var r = document.createElement("div");
		r.style.position = "relative";
		r.style.fontSize = "0px";
		r.style.width = "100%";
		r.style.height = "0px";
		r.style.zIndex = 1;
	newTD0.appendChild( this.obj.parentNode.removeChild(this.obj) );
	newTD0.appendChild( r );
	newTD1.appendChild(this.img);
	this.menu = document.createElement( "div" );
	this.menu.style.position = "absolute";
	this.menu.style.left = "0px";
	this.menu.style.top = "0px";
	this.menu.style.border = "#7F9DB9 solid 1px";
	this.menu.style.backgroundColor = "white";
	this.menu.style.visibility = "hidden";
	//阴影
	this.shadow = document.createElement("div");
	this.shadow.style.position = "absolute";
	this.shadow.style.backgroundColor = "black";
	this.shadow.style.visibility = "hidden";
	this.shadow.style.left = parseInt(this.menu.style.left)+2+"px";
	this.shadow.style.top = parseInt(this.menu.style.top)+2+"px";
	(document.all)?this.shadow.style.filter = "alpha(opacity=30)":this.shadow.style.MozOpacity = 0.3;
		r.appendChild( this.shadow );
		r.appendChild( this.menu );
		
	this.menu.tab = document.createElement("table");
	this.menu.tab.style.fontSize = "12px";
	this.menu.tab.style.color = "#5E5E5E";
	this.menu.tab.cellPadding = 5;
	this.menu.tab.cellSpacing = 0;
	this.menu.tab.border = 0;
	
	var newTr0 = this.menu.tab.insertRow(0);
	var	newTd0 = newTr0.insertCell(0);
		newTd0.align = "right";
	var img = new Image();
		img.src = "/ls/img/indClose.gif";
		img.style.cursor = (document.all)?"hand":"pointer";
		img.onclick = function(){
			o.setVisible( false );
		}
		newTd0.appendChild( img );
	
	var newTr1 = this.menu.tab.insertRow(1);
	this.user = newTr1.insertCell(0);
	this.user.style.fontSize = "12px";
	
	var newTr2 = this.menu.tab.insertRow(2);
	this.c = newTr2.insertCell(0);
	this.c.noWrap = true;
	this.c.style.lineHeight = "18px";
	this.c.style.fontSize = "12px";
	
	this.menu.appendChild( this.menu.tab );
	this.setNum(this.num);
	
	//zhb add
	//r.onmouseout =function(){o.setVisible(false);}
	//this.menu.tab.onmouseout =function(){o.setVisible(false);}
	this.shadow.onmouseout =function(){o.setVisible(false);}
}
CityMenu.prototype.setNum = function( a ){
	this.c.innerHTML = "";
	var n = parseInt(a);
	this.num = n;
	var o = this;
	for( var i=0;i<this.fonts.length;i++ ){
		var l = document.createElement("a");
			l.style.color = "#2A5B9E";
			//l.style.textDecoration = "none";
			l.href = "javascript:void(0);";
			l.onclick = function(){
				o.obj.value = this.innerHTML;
				o.setVisible(false);
			}
			l.innerHTML = this.fonts[i];
		this.c.appendChild(l);
		if( (i+1)%n == 0 ){
			this.c.appendChild( document.createElement("br") );
		}else{
			this.c.appendChild( document.createTextNode(" ") );
		}
	}
	this.setShadowBounds();
}
CityMenu.prototype.setLabel = function( a ){
	this.user.innerHTML = "<b>历史记录：</b><br>";
	if( typeof a == "object" && a.constructor == Array ){
		var txt = new Array(0);
		for( var i=0;i<a.length;i++ ){
			if( a[i] != "null" ){
				txt.push(a[i]);
			}
		}
		for( var i=0;i<txt.length;i++ ){
			var o = this;
			var l = document.createElement("a");
				l.href = "javascript:void(0);";
				l.style.color = "#6C6C6C";
				l.onclick = function(){
					o.obj.value = this.innerHTML;
					o.setVisible(false);
				}
				l.innerHTML = txt[i];
			this.user.appendChild(l);
			if( (i+1)%this.num == 0 ){
				this.user.appendChild( document.createElement("br") );
			}else{
				this.user.appendChild( document.createTextNode(" ") );
			}
		}
	}else if( typeof a == "object" ){
		this.user.appendChild( a );
	}else if( typeof a == "string" ){
		this.user.innerHTML = a;
	}
	var d = document.createElement("div");
		d.align = "center";
		d.style.fontSize = "0px";
		d.style.borderBottom = "#CE1B14 solid 1px";
		d.style.height = "10px";
	this.user.appendChild(d);
	this.setShadowBounds();
}
CityMenu.prototype.setBorder = function( a ){
	if( typeof a == "string" ){
		this.menu.style.border = a;
	}
}
CityMenu.prototype.setVisible = function( a ){
	if( typeof a == "boolean" ){
		if( a ){
			this.menu.style.visibility = "visible";
			this.shadow.style.visibility = "visible";
		}else{
			this.menu.style.visibility = "hidden";
			this.shadow.style.visibility = "hidden";
		}
	}
}
CityMenu.prototype.setShadowBounds = function(){
	this.shadow.style.width = this.menu.tab.offsetWidth + 2 + "px";
	this.shadow.style.height = this.menu.tab.offsetHeight + 2 + "px";
	this.menu.style.width =  this.menu.tab.offsetWidth + "px";
	this.menu.style.height = this.menu.tab.offsetHeight + "px";
}
CityMenu.prototype.btnClick = function(){
	if( this.menu.style.visibility == "hidden" ){
		this.setVisible(true);
	}else{
		this.setVisible(false);
	}
}