$(document).ready(
		function() {
			$(".mianleft p").click(
					function() {
						var id = $(this).attr('id');
						$('#result' + id).css('height',
								document.documentElement.clientHeight - 217);
						$(this).next("div").slideDown('normal').siblings("div")
								.slideUp('normal');
					});
		});
function onCenterChanged(mapId, boundStr, centerStr, zoomStr, centerStrEn,
		centerGridCode) {
	var center = centerStr;
	var city = $('#cityNameId');
	var c = center.split(",");
	var centery = c[0];
	var centerx = c[1];
	if (centery > 116.141335 && centery < 116.705545 && centerx > 39.702295
			&& centerx < 40.123288) {
		city.html('北京');
		TGCN = '北京';
		TGCC = '110000';
	} else if (centery > 116.889891 && centery < 117.581017
			&& centerx > 38.955913 && centerx < 39.270943) {
		city.html('天津');
		TGCN = '天津';
		TGCC = '120000';
	} else if (centery > 119.885674 && centery < 120.02968
			&& centerx > 31.667103 && centerx < 31.87806) {
		city.html('常州');
		TGCN = '常州';
		TGCC = '320400';
	} else if (centery > 121.320577 && centery < 121.71053
			&& centerx > 31.099618 && centerx < 31.405148) {
		city.html('上海');
		TGCN = '上海';
		TGCC = '310000';
	} else if (centery > 114.155149 && centery < 114.457469
			&& centerx > 30.457441 && centerx < 30.676213) {
		city.html('武汉');
		TGCN = '武汉';
		TGCC = '420100';
	} else if (centery > 106.435206 && centery < 106.610225
			&& centerx > 29.422623 && centerx < 29.633525) {
		city.html('重庆');
		TGCN = '重庆';
		TGCC = '500000';
	} else if (centery > 103.976859 && centery < 104.167159
			&& centerx > 30.589639 && centerx < 30.733089) {
		city.html('成都');
		TGCN = '成都';
		TGCC = '510100';
	} else if (centery > 113.804252 && centery < 114.42505
			&& centerx > 22.47675 && centerx < 22.751542) {
		city.html('深圳');
		TGCN = '深圳';
		TGCC = '440300';
	} else if (centery > 118.58479 && centery < 118.907619
			&& centerx > 31.907946 && centerx < 32.255298) {
		city.html('南京');
		TGCN = '南京';
		TGCC = '320100';
	} else if (centery > 121.485425 && centery < 121.700314
			&& centerx > 38.842532 && centerx < 39.02105) {
		city.html('大连');
		TGCN = '大连';
		TGCC = '210200';
	}
	if (selectOpenType == 0) {
		pupoNameByCity();
	}
	showblock();
}
var mapshowImage = 1;
function showLeftLayer(type) {
	var y = $('#resultp' + type).css('display');
	if (y == "none") {
		$('#showMessage' + type).css('height', cqch - 270);
		$('#resultPage' + type).css('top', cqch - 130);
		if (type == 1) {
			pupoNameByCity();
			selectOpenType = 1;
		} else if (type == 2) {
			selectOpenType = 2;
			getEventInfo();
		} else if (type == 3) {
			selectOpenType = 3;
			getParkingInfo();
		} else if (type == 4) {
			selectOpenType = 4;
			if (userName != null && userName != "null" && userName.length > 0) {
				myColltion(1, 1);
			} else {
				var h = "<p style=\"text-align:center; margin-top:10px\">您还未登录，请先<a href=\"login.jsp\" style=\"text-decoration:underline; color:#FF0000\">登录</a>，或者<a href=\"register.jsp\" style=\"text-decoration:underline; color:#FF0000\">注册</a></p>";
				$("#resultp4").html(h);
			}
		}
		var me = $('#mapevent');
		if (type == 2) {
			me.show();
		} else {
			me.hide();
		}
		me = null;
	}
}
function showTable(id, showType) {
	if (id == 'poisearch') {
		$('#' + id).css('display', 'block');
		$('#rotuesearch').css('display', 'none');
		$('#' + showType).removeClass().addClass('tb2');
		$('#t_reping').removeClass().addClass('tb1');
	} else if (id == "rotuesearch") {
		$('#' + id).css('display', 'block');
		$('#poisearch').css('display', 'none');
		$('#' + showType).removeClass().addClass('tb2');
		$('#t_dianji').removeClass().addClass('tb1');
	}
}
function searchKey_entery(event) {
	if (event.keyCode == 13) {
		event.returnValue = false;
		searchKeyWord();
	}
}
function searchLine_entery(event) {
	if (event.keyCode == 13) {
		event.returnValue = false;
		searchLine();
	}
}
function resinit() {
	cqch = document.documentElement.clientHeight;
	var d = $('#leftMenu').css('display'), w = '', h = cqch - 125;
	if (d == "none") {
		w = document.documentElement.clientWidth;
		cqcw = w;
	} else {
		w = document.documentElement.clientWidth - 340;
		cqcw = w;
	}
	var size = w + "," + h;
	mapObj.setMapSize(size);
	leftreset();
}
function leftreset() {
	for ( var i = 1; i < 5; i++) {
		var y = $('#resultp' + i).css('display');
		if (y == "block") {
			$('#resultp' + i).css('height', cqch - 217);
			$('#showMessage' + i).css('height', cqch - 270);
			$('#resultPage' + i).css('top', cqch - 130);
		}
	}
	$('#leftMenu').css('height', cqch - 122);
}
function changeMapSize(id) {
	var coord = mapObj.getMapCenter(), zoom = mapObj.getMapZoom(), d = $(
			'#' + id).css('display'), img = $('#checkImgLay');
	if (d == 'block') {
		$('#' + id).css('display', 'none');
		var w = cqcw, h = cqch - 125;
		mapObj.setMapSize(w + "," + h);
		mapObj.setMapZoom(zoom);
		mapObj.setMapCenter(coord);
		img.attr('src', 'images/z02.gif');
	} else {
		$('#' + id).css('display', 'block');
		var w = cqcw - 340, h = cqch - 125;
		mapObj.setMapSize(w + "," + h);
		mapObj.setMapZoom(zoom);
		mapObj.setMapCenter(coord);
		img.attr('src', 'images/z01.gif');
	}
	img = null;
}
function checkLeftMenu() {
	var d = $('#leftMenu').css('display');
	if (d == "none") {
		$('#leftMenu').css('display', 'block');
		var w = cqcw - 340, h = cqch - 125, coord = mapObj.getMapCenter(), zoom = mapObj
				.getMapZoom();
		mapObj.setMapSize(w + "," + h);
		mapObj.setMapZoom(zoom);
		mapObj.setMapCenter(coord);
		$('#checkImgLay').attr('src', 'images/z01.gif');
	}
}
function showCityInfo() {
	var o = $('#cityNameId'), t = o.offset().top + 17, l = o.offset().left + 33, cc = $('#changeCityDiv');
	if (cc.css("display") == "none") {
		cc.css( {
			'top' :t,
			'left' :l
		}).slideToggle();
	}
	o = null;
	cc = null;
	document.onmouseup = closeShowCity;
}
function closeShowCity() {
	$('#changeCityDiv').slideUp('fast');
}
function closeShowPoiStyle() {
	$('#changePoiDiv').slideUp('fast');
}
function closeShowRouteStyle() {
	$('#routeStyleDiv').slideUp('fast');
}
function changeCityName(cityName, type) {
	closeShowCity();
	document.getElementById("keyWord").value = "";
	document.getElementById("startName").value = "";
	document.getElementById("endName").value = "";
	$('#cityNameId').html(cityName);
	var lf = $('#leftMenu').css('display');
	if (lf == "none") {
		$('#checkImgLay').attr('src', 'images/z01.gif');
		$('#leftMenu').css('display', 'block')
	}
	cqcw = document.documentElement.clientWidth;
	TGCN = cityName;
	TGCC = changeCityOnCode(TGCN);
	changeMapCenter(TGCC);
	
	showblock();
	
	if (blockOpenyb != 0) {
		blockOpenyb = 0;
		mapshowybtraffic++;
		var y = $('#ybdiv'), ym = $('#mapybtraffic');
		y.hide();
		ym.attr('src', 'images/lkyb02.gif');
		y = null;
		ym = null
	}

	$('#colltion').hide();
	$('#messCusImage').hide();
	$('#resultPage1').empty();

	if (selectOpenType == 0 || selectOpenType == 1) {
		pupoNameByCity();
	}

	if (selectOpenType == 2) {
		getEventInfo();
		$('#mapevent').show()
	} else if (selectOpenType == 3) {
		getParkingInfo()
	} else if (selectOpenType == 4) {
		if (userName != null && userName != "null" && userName.length > 0) {
			myColltion(1, 1)
		} else {
			var h = "<p style=\"text-align:center; margin-top:10px\">您还未登录，请先<a href=\"login.jsp\" style=\"text-decoration:underline; color:#FF0000\">登录</a>，或者<a href=\"register.jsp\" style=\"text-decoration:underline; color:#FF0000\">注册</a></p>";
			$("#resultp4").html(h)
		}
	}
	mapshowtraffic = 0;
	mapshowybtraffic = 0;
	mapshowevent = 0;
}
function showblock() {
	if (TGCC == "120000") {
		$('#formtraffic').html("天津中环");
	} else {
		$('#formtraffic')
				.html(
						"<a href=\"http://www.yootu.com\" target=\"_blank\">优途<img src=\"images/youtu.gif\" width=\"78\" height=\"21\" style=\"vertical-align:middle\"/></a>");
	}
	var zoom = mapObj.getMapZoom();
	if (zoom > 10) {
		if (TGCC == "440300" || TGCC == "120000" || TGCC == "320400"
				|| TGCC == "320100" || TGCC == "210200") {
			$('#mapybtraffic').hide();
		} else {
			$('#mapybtraffic').show();
		}
	}
}
function changeMapCenter(c) {
	switch (c) {
	case "110000":
		mapObj.setMapCenter('116.3969, 39.91744');
		mapObj.setMapZoom(11);
		break;
	case "310000":
		mapObj.setMapCenter('121.49936, 31.24334');
		mapObj.setMapZoom(11);
		break;
	case "510100":
		mapObj.setMapCenter('104.066523, 30.657402');
		mapObj.setMapZoom(12);
		break;
	case "500000":
		mapObj.setMapCenter('106.516525, 29.54554166666661');
		mapObj.setMapZoom(12);
		break;
	case "320100":
		mapObj.setMapCenter('118.767528, 32.052053');
		mapObj.setMapZoom(11);
		break;
	case "420100":
		mapObj.setMapCenter('114.305357, 30.593147');
		mapObj.setMapZoom(11);
		break;
	case "440300":
		mapObj.setMapCenter('114.110670,22.556396');
		mapObj.setMapZoom(11);
		break;
	case "120000":
		mapObj.setMapCenter('117.203500,39.131119');
		mapObj.setMapZoom(11);
		break;
	case "320400":
		mapObj.setMapCenter('119.950290,31.783934');
		mapObj.setMapZoom(12);
		break;
	case "320100":
		mapObj.setMapCenter('118.767528,32.052053');
		mapObj.setMapZoom(11);
		break;
	case "210200":
		mapObj.setMapCenter('121.600840,38.917805');
		mapObj.setMapZoom(11);
		break;
	}
	//alert(trafficIsCheck);
	//if(trafficIsCheck == true) {
	//	addTrafficToMap(c);
	//}
	//if(mapshowtraffic % 2 != 0){
	//	addTrafficToMap(c);
	//}
	removeMapInfo();
	$('#maptraffic').show();
	$('#mapybtraffic').show();
}
function initMap(c) {
	switch (c) {
	case "110000":
		pageLoad(116.3969, 39.91744);
		break;
	case "310000":
		pageLoad(121.49936, 31.24334);
		break;
	case "510100":
		pageLoad(104.066523, 30.657402);
		break;
	case "500000":
		pageLoad(106.516525, 29.54554166666661);
		break;
	case "320100":
		pageLoad(118.767528, 32.052053);
		break;
	case "420100":
		pageLoad(114.305357, 30.593147);
		break;
	case "440300":
		pageLoad(114.110670, 22.556396);
		break;
	case "120000":
		pageLoad(117.203500, 39.131119);
		break;
	case "320400":
		pageLoad(119.950290, 31.783934);
		break;
	case "320100":
		pageLoad(118.767528, 32.052053);
		break;
	case "210200":
		pageLoad(121.600840, 38.917805);
		break
	}
	addCustomControl();
	if (TGCC == "440300" || TGCC == "120000" || TGCC == "320400"
			|| TGCC == "320100" || TGCC == "210200") {
		$('#mapybtraffic').hide();
	}
}
function addTrafficToMap(cityCode) {
	mapObj.removeTraffic();
	mapObj.addTraffic();
}
function bxsybtraffic(layerid, cid, timeid, port) {
	delWms();
//	var wmslayer = new WmsTileLayer();
//	var layers11 = 'topp:' + cid + '400_f_' + timeid, layers12 = 'topp:' + cid
//			+ '200_f_' + timeid, laysers13 = 'topp:' + cid + '70_f_' + timeid, otherlaysers = 'topp:'
//			+ cid + '50_f_' + timeid, mapsize = mapObj.getMapZoom();
//	wmslayer.id = layerid;
//	if (mapsize == 11) {
//		wmslayer.layers = layers11
//	} else if (mapsize == 12) {
//		wmslayer.layers = layers12
//	} else if (mapsize == 13) {
//		wmslayer.layers = laysers13
//	} else if (mapsize == 14 || mapsize == 15 || mapsize == 16) {
//		wmslayer.layers = otherlaysers
//	}
//	wmslayer.version = "1.1.1";
//	wmslayer.srs = "EPSG:4326";
//	wmslayer.bgcolor = "0xcfcccc";
//	wmslayer.width = 256;
//	wmslayer.height = 256;
//	wmslayer.transparent = true;
//	wmslayer.format = "image/png";
//	wmslayer.url = 'http://forecast.palmcity.cn:'
//			+ port
//			+ '/geoserver/wms?styles=Traffic&Format=application/openlayers&request=GetMap&date='
//			+ new Date();
//	mapObj.addMapTile(wmslayer);
	mapObj.addTraffic("wid=HF&tid=T"+timeid);
}
function yzybtraffic(layerid, cid, timeid, xq, port) {
	delWms();
//	var wmslayer = new WmsTileLayer();
//	var layers11 = 'topp:' + cid + '400_' + xq + '_' + timeid, layers12 = 'topp:'
//			+ cid + '200_' + xq + '_' + timeid, laysers13 = 'topp:' + cid
//			+ '70_' + xq + '_' + timeid, otherlaysers = 'topp:' + cid + '50_'
//			+ xq + '_' + timeid, mapsize = mapObj.getMapZoom();
//	wmslayer.id = layerid;
//	if (mapsize == 11) {
//		wmslayer.layers = layers11
//	} else if (mapsize == 12) {
//		wmslayer.layers = layers12
//	} else if (mapsize == 13) {
//		wmslayer.layers = laysers13
//	} else if (mapsize == 14 || mapsize == 15 || mapsize == 16) {
//		wmslayer.layers = otherlaysers
//	}
//	wmslayer.version = "1.1.1";
//	wmslayer.srs = "EPSG:4326";
//	wmslayer.bgcolor = "0xcfcccc";
//	wmslayer.width = 256;
//	wmslayer.height = 256;
//	wmslayer.transparent = true;
//	wmslayer.format = "image/png";
//	wmslayer.url = 'http://forecast.palmcity.cn:'
//			+ port
//			+ '/geoserver/wms?styles=Traffic&Format=application/openlayers&request=GetMap&date='
//			+ new Date();
//	mapObj.addMapTile(wmslayer);
	mapObj.addTraffic("wid=W"+xq+"&tid=T"+timeid);
}
function delWms() {
	if (openTrafficType == 1) {
		//mapObj.removeAllMapTile();
		mapObj.removeTraffic();
	} else {
		mapObj.removeTraffic();
	}
}
function initTrafficInMap(cityCode) {
	delWms();
	addTrafficToMap(cityCode);
}
function onZoomChanged(mapId, boundsStr, centerStr, zoomStr, centerStrEn,
		centerGridCode) {
	var z = mapObj.getMapZoom();
	if (z < 11) {
		if (blockOpenyb != 0) {
			var y = $('#ybdiv');
			y.hide();
			y = null
		}
		$('#maptraffic').hide();
		$('#mapybtraffic').hide();
		delWms();
	} else {
		if (blockOpenyb == 1) {
			var y = $('#ybdiv'), my = $('#mapybtraffic');
			y.show();
			my.show();
			y = null;
			my = null;
			bxsybtraffic(cityNameyb, cityNameyb, timeidyd, ybport)
		} else if (blockOpenyb == 2) {
			var y = $('#ybdiv'), my = $('#mapybtraffic');
			y.show();
			my.show();
			y = null;
			my = null;
			yzybtraffic(cityNameyb, cityNameyb, timeidyd, xqyb, ybport)
		} else {
			if (TGCC != "440300" && TGCC != "120000" && TGCC != "320400"
					&& TGCC != "320100" && TGCC != "210200") {
				$('#mapybtraffic').show();
			}
			$('#maptraffic').show();
			if(trafficIsCheck == true) {
			//}
			//if (mapshowtraffic % 2 == 0) {
				addTrafficToMap(TGCC);
			} else {
				delWms();
			}
		}
	}
}// delWms();
function getMapDate() {
	Other.getMapDate(TGCC, getMapDate_do);
}
function getMapDate_do(data) {
	if (data != null && data != "") {
		$('#trafficTime').html(data);
	} else {
		$('#trafficTime').html("暂无数据");
	}
}
function intervalTraffic() {
	if (mapshowtraffic % 2 == 0) {
		if (blockOpenyb == 0) {
			delWms();
			addTrafficToMap(TGCC);
			getMapDate();
		}
	}
}
function addCustomControl() {
	var control = new MctfoToolControl();
	control.isCustom = true;
	control.html = "<img src=\"images/lkyb02.gif\" id='mapybtraffic' border=\"0\" class=\"mapbutton\" width=\"87\" height=\"27\" onclick=\"openMapLayer(1,'mapybtraffic');\"/> <img src=\"images/sslk02.gif\" id='maptraffic' border=\"0\" class=\"mapbutton\" width=\"87\" height=\"27\" onclick=\"openMapLayer(2,'maptraffic');\"/> <img src=\"images/lksj02.gif\" id='mapevent' border=\"0\" class=\"mapbutton\" style=\"display:none\" width=\"87\" height=\"27\" onclick=\"openMapLayer(3,'mapevent');\"/>";
	mapObj.addCustomControl(control);
}
var mapshowtraffic = 0, mapshowybtraffic = 0, mapshowevent = 0, openTrafficType = 0;
var trafficIsCheck = true;
function openMapLayer(type, id) {
	blockOpenyb = 3;
	if (type == 1) {
		openTrafficType = 1;
		if (mapshowybtraffic % 2 == 0) {
			var h = $('#' + id);
			h.attr('src', 'images/lkyb01.gif');
			var t = h.offset().top + 29, l = h.offset().left - 34;
			$('#ybdiv').css( {
				'left' :l,
				'top' :t
			}).show();
			$('#maptraffic').hide();
			mapObj.removeTraffic();
			inityb();
		} else {
			$('#' + id).attr('src', 'images/lkyb02.gif');
			$('#ybdiv').hide();
			$('#maptraffic').show();
			delWms();
			addTrafficToMap(TGCC);
		}
		mapshowybtraffic++;
	} else if (type == 2) {
		openTrafficType = 0;
		if (mapshowtraffic % 2 == 0) {
			trafficIsCheck = false;
			$('#' + id).attr('src', 'images/sslk01.gif');
			delWms();
		} else {
			trafficIsCheck = true;
			$('#' + id).attr('src', 'images/sslk02.gif');
			delWms();
			addTrafficToMap(TGCC);
		}
		mapshowtraffic++;
	} else if (type == 3) {
		if (mapshowevent % 2 == 0) {
			$('#' + id).attr('src', 'images/lksj01.gif');
			mapshowImage = 0;
		} else {
			$('#' + id).attr('src', 'images/lksj02.gif');
			mapshowImage = 1;
		}
		mapshowevent++;
		getEventInfo();
	}
}
function changeComType(checkName, divName) {
	var h = $('#' + checkName), t = h.offset().top + 23, l = h.offset().left - 1;
	var dn = $('#' + divName);
	if (dn.css('display') == "none") {
		dn.css( {
			'left' :l,
			'top' :t
		}).slideToggle();
	}
	h = null;
	if (divName == "changePoiDiv") {
		document.onmouseup = closeShowPoiStyle;
	} else if (divName == "routeStyleDiv") {
		document.onmouseup = closeShowRouteStyle;
	}
}
function changePoiTypeInfo(type, name) {
	if (type == 1) {
		$('#searchTypeName').html(name);
		$('#changePoiDiv').slideUp();
	} else if (type == 2) {
		$('#rotueStyleType').html(name);
		$('#routeStyleDiv').slideUp();
	}
}
function inferDistance() {
	setMeasureAction();
}
function resetMap() {
	mapObj.setMapAction(0);
	mapObj.removePoly("measureline");
}
function setMeasureAction() {
	mapObj.setMapAction(3);
	onPolyDrawn = function(mapId, coords, distance, enCoords) {
		var polyObj = new MctfoPolyObject();
		polyObj.serial_id = "measureline";
		polyObj.coord = coords;
		polyObj.polyStyle.showLabel = true;
		polyObj.polyStyle.stroked = true;
		polyObj.polyStyle.filled = true;
		polyObj.polyStyle.lineWeight = 3;
		polyObj.polyStyle.lineColor = "red";
		polyObj.polyStyle.lineOpacity = 1;
		polyObj.polyStyle.fillColor = "red";
		polyObj.polyStyle.fillOpacity = 1;
		polyObj.polyStyle.offset.labelX = 10;
		polyObj.polyStyle.offset.labelY = 10;
		polyObj.polyStyle.positionNum.label = "1";
		polyObj.polyStyle.labelContent = "<font color='blue'><B>"
				+ Math.round(distance) + "米</B></font>";
		mapObj.addPoly(polyObj);
		mapObj.setMapAction(0);
	}
}
function removeMapInfo() {
	mapObj.removeAllPoint();
	mapObj.removeAllPoly();
}
// ----------------
var poiList = [];// 存储POI对象
var poiPointInfo = {};// 储存poi点对象2
var roadPointInfo = {};// 存储road节点对象
var searchType = '';
var openId = 0;// 操作路况详细信息循环的ID
var golCP = 0;// 分页页数
var collMovePointInfo = []; // 存储route坐标点
var selectOpenType = 1;// 判断打开tip
var checkColltionType = 0;
function checkOpenTips() {
	if (selectOpenType != 1) {
		for ( var i = 1; i < 5; i++) {
			if (i == 1) {
				$("#resultp" + i).css('display', 'block');
			} else {
				$("#resultp" + i).css('display', 'none');
			}
		}
		leftreset();
	}
}
function searchKeyWord() {
	var k = $('#keyWord'), keyWord = k.val();
	if (!$.trim(keyWord)) {
		alert("请输入要查询的道路名或者中心点");
		return false;
	}
	loadImage('loadinit1');
	var rp = $('#resultPage1'), sr = $('#searchResult'), ps = $('#searchTypeName'), type = 1;
	rp.empty();
	sr.empty();
	rp = null;
	sr = null;
	poiSearchType = ps.html();
	ps = null;
	if (escape(keyWord).indexOf("%u") == -1) {
		type = 2;
	}
	if (poiSearchType == "中心位置") {
		searchType = "poi";
		View.getPoi(TGCC, keyWord, type, getPoi_do);
	} else if (poiSearchType == "道路名称") {
		searchType = "road";
		View.getRoad(TGCC, keyWord, type, getPoi_do);
	}
	checkLeftMenu();
	checkOpenTips();
	checkColltionType = 0;
	selectOpenType = 1;
	collectionMap.clear();
	delteSelect();
	checkId = 0;
	k = null;
	var me = $('#mapevent');
	if (me.css('display') == "inline") {
		me.hide();
		removeMapInfo();
	}
	me = null;
}
function getPoi_do(result) {
	if (result != null) {
		removeMapInfo();
		poiList = [];
		poiList = result;
		var cp = 1, tn = poiList.length, tp = Math.round(tn / 15);
		if (tp < 1) {
			tp = 1;
		}
		if (searchType == "poi") {
			poiInfo(cp, tp, tn);
		} else if (searchType == "road") {
			roadInfo(cp);
		}
		if (tp > 1) {
			showPages(cp, tp, tn);
		} else {
			var rp = $('#resultPage1');
			rp.empty();
			rp = null;
		}
	} else {
		var sr = $('#searchResult'), c = $('#colltion'), mc = $('#messCusImage');
		sr
				.append("<p style=\"color:#FF0000; padding-top:10px; height:30px;\" align=\"center\">没有查询到相应的结果！</p>");
		c.hide();
		mc.hide();
		colseLoadImage('loadinit1');
		sr = null;
		c = null;
		mc = null;
	}
}
function poiInfo(cp, tp, tn) {
	loadImage('loadinit1');
	var poiLength = poiList.length, searchhtml = $('#searchResult'), imagenumber = 1, coll = $('#colltion'), mc = $('#messCusImage');
	searchhtml.empty();
	if (poiLength > 0) {
		var start = (cp - 1) * 15, end = cp * 15, pbghight = screenWidth('point');
		golCP = cp;
		for ( var i = start; i < end; i++) {
			if (i < poiLength) {
				var poi = poiList[i], id = poi.id, name = poi.poiName, seldiv = "seldiv"
						+ i, selImage = "selImage" + i, checkInput = "check_"
						+ id, checkName = "ch_" + i;
				if (name.length > 20) {
					name = name.substring(0, 20);
				}
				poiPointInfo[id] = poi;
				message = "<p id="
						+ seldiv
						+ " class="
						+ pbghight
						+ "><span style=\"color:#FF00FF; font-size:12px;\" ><input type=\"checkbox\" id="
						+ checkInput
						+ " value=\"\" name="
						+ checkInput
						+ " style=\"margin-bottom:0px;\" onClick=\"loveCollectionPoi('"
						+ id
						+ "')\" /><span style=\"font-size:12px; color:#000000; font-weight:bold\">"
						+ imagenumber
						+ ".</span><img src=\"images/x_55.gif\" width=\"12\" height=\"12\" style=\"margin-left:5px;\" id="
						+ selImage
						+ "  onClick=\"poiTraffic('"
						+ id
						+ "','"
						+ i
						+ "');openPoiTip('"
						+ id
						+ "');return false\" ><a href=\"#\" onClick=\"poiTraffic('"
						+ id
						+ "','"
						+ i
						+ "');openPoiTip('"
						+ id
						+ "');return false\" style=\"margin-left:5px;\"><span id="
						+ checkName + ">" + name
						+ "</span></a></span></p><p id=open_" + i
						+ " style=\"display:none\"></p>";
				searchhtml.append(message);
				mapAddPoint(poi, imagenumber);
				imagenumber++;
			}
		}
		coll.show('slow');
		mc.show('slow');
	} else {
		searchhtml
				.append("<p style=\"color:#FF0000; padding-top:10px; height:30px;\" align=\"center\">没有查询到相应的结果！</p>");
		coll.hide();
		mc.hide();
	}
	colseLoadImage('loadinit1');
	searchhtml = null;
	coll = null;
	mc = null;
}
function roadInfo(cp) {
	loadImage('loadinit1');
	var roadLength = poiList.length, searchhtml = $('#searchResult'), coll = $('#colltion'), mc = $('#messCusImage');
	searchhtml.empty();
	if (roadLength > 0) {
		var start = (cp - 1) * 15, end = cp * 15, pbghight = screenWidth('point');
		golCP = cp;
		for ( var i = start; i < end; i++) {
			if (i < roadLength) {
				var poi = poiList[i], name = poi.poiName, id = i + "_road", line = i + 1, seldiv = "seldiv"
						+ i, selImage = "selImage" + i, checkInput = "check_"
						+ id, checkName = "ch_" + i;
				if (name.length > 20) {
					name = name.substring(0, 20);
				}
				roadPointInfo[id] = poi.desList;
				message = "<p id="
						+ seldiv
						+ " class="
						+ pbghight
						+ "><span style=\"color:#FF00FF; font-size:12px;\" ><input type=\"checkbox\" id="
						+ checkInput
						+ " value=\"\" name="
						+ checkInput
						+ " style=\"margin-bottom:0px;\" onClick=\"loveCollectionRoad('"
						+ id
						+ "','"
						+ poi.poiName
						+ "')\" /><span style=\"font-size:12px; color:#000000; font-weight:bold\">"
						+ line
						+ ".</span><img src=\"images/x_55.gif\" width=\"12\" height=\"12\" style=\"margin-left:5px;\" id="
						+ selImage
						+ " onClick=\"roadTraffic('"
						+ id
						+ "','"
						+ name
						+ "','"
						+ i
						+ "');return false\"><a href=\"#\" onClick=\"roadTraffic('"
						+ id
						+ "','"
						+ name
						+ "','"
						+ i
						+ "');return false\" style=\"margin-left:5px;\"><span id="
						+ checkName + ">" + name
						+ "</span></a></span></p><p id=open_" + i
						+ " style=\"display:none\"></p>";
				searchhtml.append(message);
			}
		}
		coll.show('slow');
		mc.show('slow');
	} else {
		searchhtml
				.append("<p style=\"color:#FF0000; padding-top:10px; height:30px;\" align=\"center\">没有查询到相应的结果！</p>");
		coll.hide();
		mc.hide();
	}
	colseLoadImage('loadinit1');
	searchhtml = null;
	coll = null;
	mc = null;
}
function showPages(cp, tp, pl) {
	var rp = $('#resultPage1');
	rp.empty();
	if (pl > 0) {
		var start = 0, end = 1;
		if (tp <= 7) {
			start = 0;
			end = tp;
		} else {
			if (cp < 4) {
				start = 0;
				end = 7;
			} else {
				if (cp > tp - 4) {
					start = tp - 7;
					end = tp;
				} else {
					start = cp - 4;
					end = cp + 3;
				}
			}
		}
		var p_html = "<div style=\"width:320px; text-align:center\"><span>";
		if (cp > 1) {
			p_html += "<a href=\"#\" onClick=\"gotoPage(" + cp + "-1,'" + tp
					+ "','" + pl
					+ "');return false\"><font class=\"STYLE4\">上一页</font></a>";
		}
		for ( var i = start; i < end; i++) {
			var c_p = i + 1;
			if (cp == i + 1) {
				p_html += "<a href=\"#\" onClick=\"gotoPage("
						+ c_p
						+ ",'"
						+ tp
						+ "','"
						+ pl
						+ "');return false\" class=\"STYLE4\"  style=\"color:#FF0000\"><font style=\"font-size:12px;\"><span style=\"vertical-align:top; margin-left:2px; margin-right:3px;\">[<span style=\"padding-left:2px; \">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			} else {
				p_html += "<a href=\"#\" onClick=\"gotoPage("
						+ c_p
						+ ",'"
						+ tp
						+ "','"
						+ pl
						+ "');return false\" class=\"STYLE4\" ><font style=\"font-size:12px;\"><span  style=\"vertical-align:top; margin-left:2px;\">[<span style=\"padding-left:2px; padding-rigth:2px;\">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			}
		}
		if (cp < tp) {
			p_html += "<a href=\"#\" onClick=\"gotoPage(" + cp + "+1,'" + tp
					+ "','" + pl
					+ "');return false\"><font class=\"STYLE4\">下一页</font></a>";
		}
		p_html += "</span></div>";
		rp.html(p_html);
	}
	rp = null;
}
function gotoPage(cp, tp, pl) {
	removeMapInfo();
	if (searchType == "poi") {
		poiInfo(cp);
	} else if (searchType == "road") {
		roadInfo(cp);
	}
	showPages(cp, tp, pl);
	collectionMap.clear();
	delteSelect();
	checkId = 0;
}
function poiTraffic(id, forId) {
	var c = $('#open_' + forId).css('display');
	if (c == "block") {
		$("#seldiv" + forId).css('backgroundColor', '');
		$("#open_" + forId).slideUp('slow');
		$('#selImage' + forId).attr('src', 'images/x_55.gif');
		return;
	}
	loadImage('loadinit1');
	var p = poiPointInfo[id];
	openId = forId;
	View.getPoiTraffic(TGCC, p.lat, p.lon, poiTrafficCallBack);
}
function hbstatus(status) {
	var s_h = '';
	switch (status) {
	case "A":
		s_h = "<span style=\"padding-left:2px;color:red\">拥堵</span>";
		break;
	case "B":
		s_h = "<span style=\"padding-left:2px;color:#FF9900\">缓行</span>";
		break;
	case "C":
		s_h = "<span style=\"padding-left:2px;color:green\">畅通</span>";
		break;
	case "Z":
		s_h = "<span style=\"padding-left:2px;\">暂无数据</span>";
		break;
	}
	return s_h;
}
function poiTrafficCallBack(result) {
	var t_html = "<div style=\"background-color:#f0f0f0\">";
	if (result != null) {
		var f = result.FTraffic, r = result.RTraffic;
		if (f != null || r != null) {
			if (f != null && f.length > 0) {
				var flength = f.length;
				t_html += "<p style=\"padding-left:30px; padding-top:5px;\">正向：</p>";
				for ( var i = 0; i < flength; i++) {
					var line_in = i + 1, traffic = result.FTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status);
					}
					var message = "<p style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','1');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></p><br>";
					t_html += message;
				}
			}
			if (r != null && r.length > 0) {
				var rlength = r.length;
				t_html += "<p style=\"padding-left:30px; padding-top:5px;\">反向：</p>";
				for ( var i = 0; i < rlength; i++) {
					var line_in = i + 1, traffic = result.RTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status);
					}
					var message = "<p style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','0');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></p><br>";
					t_html += message;
				}
			}
		} else {
			t_html += "<p style=\"font-size:12px; padding-left:40px; padding-top:10px; height:30px; color:#FF0000\">没有路况信息！</p>";
		}
	} else {
		t_html += "<p style=\"font-size:12px; padding-left:40px; padding-top:10px; height:30px; color:#FF0000\">没有路况信息！</p>";
	}
	t_html += "</div>";
	var start = (golCP - 1) * 15, end = golCP * 15;
	for ( var i = start; i <= end; i++) {
		if (i == openId) {
			var c = $('#open_' + i).css('display');
			if (c == "block") {
				$("#seldiv" + i).css('backgroundColor', '');
				$("#open_" + i).slideUp('slow');
				$('#selImage' + i).attr('src', 'images/x_55.gif');
			} else {
				$("#open_" + i).slideDown('slow').html(t_html);
				$("#seldiv" + i).css('backgroundColor', '#f0f0f0');
				$('#selImage' + i).attr('src', 'images/x_58.gif');
			}
		} else {
			$("#seldiv" + i).css('backgroundColor', '');
			$("#open_" + i).slideUp('slow');
			$('#selImage' + i).attr('src', 'images/x_55.gif');
		}
	}
	colseLoadImage('loadinit1');
}
var golRoadId = '';
function roadTraffic(id, name, forId) {
	var c = $('#open_' + forId).css('display');
	if (c == "block") {
		$("#seldiv" + forId).css('backgroundColor', '');
		$("#open_" + forId).slideUp('slow');
		$('#selImage' + forId).attr('src', 'images/x_55.gif');
		return;
	}
	loadImage('loadinit1');
	openId = forId;
	golRoadId = id;
	View.getRoadTraffic(TGCC, name, roadTrafficCallBack);
}
function roadTrafficCallBack(result) {
	var t_html = "<div style=\"background-color:#f0f0f0\">";
	if (result != null) {
		removeMapInfo();
		var f = result.FTraffic, r = result.RTraffic;
		if (f != null || r != null) {
			if (f != null && f.length > 0) {
				var flength = f.length;
				t_html += "<p style=\"padding-left:30px; padding-top:5px;\">正向：</p>";
				for ( var i = 0; i < flength; i++) {
					var line_in = i + 1, traffic = result.FTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status);
					}
					var message = "<p style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','1');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></p><br>";
					t_html += message;
				}
			}
			if (r != null && r.length > 0) {
				var rlength = r.length;
				t_html += "<p style=\"padding-left:30px; padding-top:5px;\">反向：</p>";
				for ( var i = 0; i < rlength; i++) {
					var line_in = i + 1, traffic = result.RTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status);
					}
					var message = "<p style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','0');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></p><br>";
					t_html += message;
				}
			}
		} else {
			t_html += "<p style=\"font-size:12px; padding-left:40px; padding-top:10px; height:30px; color:#FF0000\">没有路况信息！</p>";
		}
	} else {
		t_html += "<p style=\"font-size:12px; padding-left:40px; padding-top:10px; height:30px; color:#FF0000\">没有路况信息！</p>";
	}
	t_html += "</div>";
	var start = (golCP - 1) * 15, end = golCP * 15;
	for ( var i = start; i <= end; i++) {
		if (i == openId) {
			var c = $('#open_' + i).css('display');
			if (c == "block") {
				$("#seldiv" + i).css('backgroundColor', '');
				$("#open_" + i).slideUp('slow');
				$('#selImage' + i).attr('src', 'images/x_55.gif');
			} else {
				$("#open_" + i).slideDown('slow').html(t_html);
				$("#seldiv" + i).css('backgroundColor', '#f0f0f0');
				$('#selImage' + i).attr('src', 'images/x_58.gif');
			}
		} else {
			$("#seldiv" + i).css('backgroundColor', '');
			$("#open_" + i).slideUp('slow');
			$('#selImage' + i).attr('src', 'images/x_55.gif');
		}
	}
	colseLoadImage('loadinit1');
	addRoadMap();
}
function loadImage(name) {
	var lim = $('#' + name);
	lim
			.html("<span style=\"color:#FF0000\">加载中.....</span> <img src=\"images/loadimage.gif\" width=\"16\" height=\"16\" border=\"0\" align=\"absmiddle\"/>");
	lim = null;
}
function colseLoadImage(name) {
	var lim = $('#' + name);
	lim.empty();
	lim = null;
}
function addCollection() {
	if (checkColltionType == 0) {
		addPointCollection();
	} else {
		addLineCollection();
	}
}
var collectionMap = new Map();
function collectionPoiInfo(lat, lon, poiName, cityCode, address, tel,
		resultType) {
	this.lon = lon;
	this.lat = lat;
	this.poiName = poiName;
	this.cityCode = cityCode;
	this.address = address;
	this.tel = tel;
	this.resultType = resultType;
}
function collectionRoadInfo(cityCode, roadName, resultType, roadWKT) {
	this.cityCode = cityCode;
	this.roadName = roadName;
	this.resultType = resultType;
	this.roadWKT = roadWKT;
}
var checkId = 0;// 判断是否有选择，0为没有选择
function loveCollectionPoi(id) {
	var c = $('#check_' + id).attr('checked');
	if (c) {
		var p = poiPointInfo[id];
		var cInfo = new collectionPoiInfo(p.lat, p.lon, p.poiName, TGCC,
				p.address, p.tel, "poi");
		collectionMap.put(checkId, cInfo);
		checkId = checkId + 1;
	} else {
		if (checkId > 0) {
			collectionMap.remove(checkId - 1);
			checkId = checkId - 1;
		} else {
			checkId = 0;
		}
	}
}
function loveCollectionRoad(id, name) {
	var c = $('#check_' + id).attr('checked');
	if (c) {
		var r = roadPointInfo[id].length, roadWKT = '';
		for ( var i = 0; i < r; i++) {
			var wkt = roadPointInfo[id][i].roadWKT;
			roadWKT += wkt + ";";
		}
		var cInfo = new collectionRoadInfo(TGCC, name, "road", roadWKT);
		collectionMap.put(checkId, cInfo);
		checkId = checkId + 1;
	} else {
		if (checkId > 0) {
			collectionMap.remove(checkId - 1);
			checkId = checkId - 1;
		} else {
			checkId = 0;
		}
	}
}
function addPointCollection() {
	if (checkId == 0) {
		if (userName != null && userName != "null" && userName.length > 0) {
			var html = "<p style=\"text-align:center; color:#FF0000;\">请选择要收藏的路况信息</p>";
			AlertMsg('收藏', html, 250, 200);
			return false;
		} else {
			var html = "<p style=\"text-align:center\">请先<a href=\"login.jsp\" style=\"color:#FF0000; text-decoration:underline\">登录</a>，或者<a href=\"register.jsp\" style=\"color:#FF0000; text-decoration:underline\">注册</a></p>";
			AlertMsg('收藏', html, 250, 200);
		}
	} else {
		if (userName != null && userName != "null" && userName.length > 0) {
			var message = '', length = collectionMap.size();
			if (searchType == "poi") {
				for ( var i = 0; i < length; i++) {
					var c = collectionMap.get(i);
					message += c.lat + "," + c.lon + "," + c.poiName + ","
							+ c.cityCode + "," + c.address + "," + c.tel + ","
							+ c.resultType + "%%";
				}
				Custom.addPoiCollection(userName, message,
						addPointCollection_do);
			} else if (searchType == "road") {
				var wkt = '';
				for ( var i = 0; i < length; i++) {
					var c = collectionMap.get(i);
					message += c.roadName + "," + c.cityCode + ","
							+ c.resultType + "%%";
					wkt += c.roadWKT + "#";
				}
				Custom.addRoadCollection(userName, message, wkt,
						addPointCollection_do);
			}
		} else {
			var html = "<p style=\"text-align:center\">请先<a href=\"login.jsp\" style=\"color:#FF0000; text-decoration:underline\">登录</a>，或者<a href=\"register.jsp\" style=\"color:#FF0000; text-decoration:underline\">注册</a></p>";
			AlertMsg('收藏', html, 250, 200);
		}
	}
}
function addLineCollection() {
	if (userName != null && userName != "null" && userName.length > 0) {
		Custom.addLineCollection(TGCC, userName, golStartName, golEndName,
				startRouteLat, startRouteLon, endRouteLat, endRouteLon,
				golRouteSytle, selectCheckType, addRouteCallBack);
	} else {
		var html = "<p style=\"text-align:center\">请先<a href=\"login.jsp\" style=\"color:#FF0000; text-decoration:underline\">登录</a>，或者<a href=\"register.jsp\" style=\"color:#FF0000; text-decoration:underline\">注册</a></p>";
		AlertMsg('收藏', html, 250, 200);
	}
}
function addPointCollection_do(info) {
	var message = "";
	if (info == "fail") {
		message = "收藏失败";
	} else if (info == "success") {
		message = "已将勾选添加至“我的关注”";
	} else if (info == "subsist") {
		message = "您已收藏了此路况";
	}
	var img = $('#colltion'), t = img.offset().top - 11, l = img.offset().left + 154;
	img = null;
	opTipInfo(message, l, t);
	window.setTimeout(closeTipInfo, 2000);
	collectionMap.clear();
	delteSelect();
	checkId = 0;
}
function addRouteCallBack(info) {
	var message = "";
	if (info == "fail") {
		message = "收藏失败";
	} else if (info == "success") {
		message = "已成功添加至“我的关注”";
	} else if (info == "subsist") {
		message = "您已收藏了此路线";
	}
	var img = $('#colltion'), t = img.offset().top - 11, l = img.offset().left + 154;
	img = null;
	opTipInfo(message, l, t);
	window.setTimeout(closeTipInfo, 2000);
}
function delteSelect() {
	var a = document.getElementsByTagName("input");
	for (i = 0; i < a.length; i++) {
		if (a[i].type == "checkbox") {
			a[i].checked = false;
		}
	}
	a = null;
}
var selectCheckType = 1, golRouteSytle = 'Fastest', mapcity = '', golStartName = "", golEndName = "";
function getRouteStyle() {
	var n = $('#rotueStyleType'), name = n.html();
	n = null;
	var styleName = "Fastest";
	if (name == "最短路线") {
		styleName = "Shortest";
	}
	return styleName;
}
function searchLine() {
	var s = $('#startName'), e = $('#endName'), startName = s.val(), endName = e
			.val();
	if (!$.trim(startName)) {
		alert("请输入起点");
		return false;
	}
	if (!$.trim(endName)) {
		alert("请输入终点");
		return false;
	}
	var type = 1, type2 = 1;
	if (escape(startName).indexOf("%u") == -1) {
		type = 2;
	}
	if (escape(endName).indexOf("%u") == -1) {
		type2 = 2;
	}
	loadImage('loadinit1');
	golRouteSytle = getRouteStyle();
	dwr.engine.beginBatch();
	View.getPoi(TGCC, startName, type, startPoiCallback);
	View.getPoi(TGCC, endName, type2, endPoiCallback);
	dwr.engine.endBatch();
	var coll = $('#colltion'), mc = $('#messCusImage'), sr = $('#searchResult'), rp = $('#resultPage1');
	coll.hide();
	mc.hide();
	sr.empty();
	rp.empty();
	coll = null;
	mc = null;
	sr = null;
	rp = null;
	removeMapInfo();
	checkLeftMenu();
	checkOpenTips();
	selectOpenType = 1;
	golStartName = startName;
	golEndName = endName;
	selectCheckType = 1;
	clearInterval();
}
var selectResult = 0, startRouteLat = '', startRouteLon = '', endRouteLat = '', endRouteLon = '';
var selectPoiSInfo = {};
var selectPoiEInfo = {};
function startPoiCallback(startPoiList) {
	var startLength = startPoiList.length, startName = $('#startName').val(), result = $('#searchResult'), startTitle = "<p style=\"margin-left:30px; margin-top:10px; \">起点：<input name=\"sName\" id=\"sName\" value="
			+ startName
			+ " type=\"text\" disabled=\"disabled\" style=\"height:13px;\" / ></p><p style=\"margin-left:30px; padding-top:5px; height:20px; color:#666\">请选择准确的起点地址：</p>";
	result.append(startTitle);
	if (startLength > 0) {
		selectResult = 1;
		var h = "<p style=\"margin-left:30px;\"><select name=\"startPoi\" id=\"startPoi\" onclick=\"selctStartNameType()\"  size='2' style=\"height:110px; width:250px\">", o = "";
		for ( var i = 0; i < startLength; i++) {
			var startpoi = startPoiList[i], s_poi_id = "s_poi_" + i;
			selectPoiSInfo[s_poi_id] = startpoi;
			if (i == 0) {
				startRouteLat = startpoi.lat;
				startRouteLon = startpoi.lon;
				mapcity = startpoi.province;
				golStartName = startpoi.poiName;
				addPointInRoute(startpoi.id, startpoi.lat, startpoi.lon,
						startpoi.poiName, startpoi.province, 'start');
				o += "<option id=" + s_poi_id + " value='" + startpoi.poiName
						+ "' selected=\"selected\">" + startpoi.poiName
						+ "</option>";
			} else {
				o += "<option id=" + s_poi_id + " value='" + startpoi.poiName
						+ "'>" + startpoi.poiName + "</option>";
			}
		}
		result.append(h + o + "</select></p>");
	} else {
		selectResult = 0;
		result
				.append("<p style=\"padding-top:5px; padding-left:30px; color:#FF0000\">没有找到相关的地点，请您更换关键词再尝试</p>");
	}
	result = null;
}
function endPoiCallback(endPoiList) {
	var endLength = endPoiList.length, endName = $('#endName').val(), result = $('#searchResult'), endTitle = "<p style=\"margin-left:30px; margin-top:5px; height:20px;\">终点：<input name=\"eName\" id=\"eName\" value="
			+ endName
			+ " type=\"text\" disabled=\"disabled\" style=\"height:13px;\" / ></p><p style=\"margin-left:30px; padding-top:5px; height:20px; color:#666\">请选择准确的终点地址：</p>";
	result.append(endTitle);
	if (endLength > 0) {
		var h = "<p style=\"margin-left:30px;\"><select name=\"endPoi\" id=\"endPoi\" onclick=\"selctEndNameType()\"  size='2' style=\"height:110px; width:250px\">", o = "";
		for ( var i = 0; i < endLength; i++) {
			var endpoi = endPoiList[i], e_poi_id = "e_poi_" + i;
			selectPoiEInfo[e_poi_id] = endpoi;
			if (i == 0) {
				endRouteLat = endpoi.lat;
				endRouteLon = endpoi.lon;
				golEndName = endpoi.poiName;
				addPointInRoute(endpoi.id, endpoi.lat, endpoi.lon,
						endpoi.poiName, endpoi.province, 'end');
				o += "<option id=" + e_poi_id + " value='" + endpoi.poiName
						+ "' selected=\"selected\">" + endpoi.poiName
						+ "</option>";
			} else {
				o += "<option id=" + e_poi_id + " value='" + endpoi.poiName
						+ "' >" + endpoi.poiName + "</option>";
			}
		}
		result.append(h + o + "</select></p>");
		if (selectResult == 1) {
			result
					.append("<p style=\"padding-top:5px; padding-left:100px;\" id=\"subStartEnd\"><span style=\"heigth:30px; \" id=\"sel_subLine\"><input name=\"subs\" type=\"button\" value=\"提 交\" class=\"buttoms1\" style=\"width:60px;\" onmouseover=\"this.className='buttoms2';\" onmouseout=\"this.className='buttoms1';\" onclick=\"searchRoute();return false\"/></span></p>");
		} else {
			result
					.append("<p style=\"padding-top:5px; padding-left:100px;\" id=\"subStartEnd\"><span style=\"heigth:30px; \" id=\"sel_subLine\"><input name=\"subs\" type=\"button\" value=\"提 交\" class=\"buttoms1\" style=\"width:60px; background-color:#999999\"/></span></p>");
		}
	} else {
		result
				.append("<p style=\"padding-top:5px; padding-left:30px; color:#FF0000\">没有找到相关的地点，请您更换关键词再尝试</p>");
		result
				.append("<p style=\"padding-top:5px; padding-left:100px;\" id=\"subStartEnd\"><span style=\"heigth:30px; \" id=\"sel_subLine\"><input name=\"subs\" type=\"button\" value=\"提 交\" class=\"buttoms1\" style=\"width:60px; background-color:#999999\"/></span></p>");
	}
	colseLoadImage('loadinit1');
	result = null;
}
function selctStartNameType() {
	var obj = document.getElementById("startPoi");
	if (obj.options[obj.selectedIndex].value != 0) {
		var id = obj.options[obj.selectedIndex].id;
		var s = selectPoiSInfo[id];
		selectStartName(s.lat, s.lon, s.poiName);
		addPointInRoute(s.id, s.lat, s.lon, s.poiName, s.province, 'start');
	}
	obj = null;
}
function selctEndNameType() {
	var obj = document.getElementById("endPoi");
	if (obj.options[obj.selectedIndex].value != 0) {
		var id = obj.options[obj.selectedIndex].id;
		var s = selectPoiEInfo[id];
		selectEndName(s.lat, s.lon, s.poiName);
		addPointInRoute(s.id, s.lat, s.lon, s.poiName, s.province, 'end');
	}
	obj = null;
}
function selectStartName(lat, lon, name) {
	var s = $('#startName'), st = $('#sName');
	s.val(name);
	st.val(name);
	s = null;
	st = null;
	startRouteLat = lat;
	startRouteLon = lon;
	golStartName = name;
}
function selectEndName(lat, lon, name) {
	var e = $('#endName'), et = $('#eName');
	e.val(name);
	et.val(name);
	e = null;
	et = null;
	endRouteLat = lat;
	endRouteLon = lon;
	golEndName = name;
}
function searchRoute() {
	if($('#startName').val() == $('#endName').val()) {
		alert('起点与终点相同,请更换选择!')
		return false;
	}
	loadImage('loadinit1');
	var block = 'false';
	if (selectCheckType == 1) {
		block = 'true';
	}
	View.getRoute(startRouteLat, startRouteLon, endRouteLat, endRouteLon,
			block, golRouteSytle, routeCallBack);
}
var mapcoords = {};
function routeCallBack(route) {
	var result = $('#searchResult'), coll = $('#colltion');
	result.empty();
	if (route != null) {
		checkColltionType = 1;
		var routeLength = route.routeLength, cost = route.cost;
		if (routeLength > 0) {
			var l = "，全程约<span style=\"color:#FF0000;font-weight:bold\">"
					+ routeLength
					/ 1000
					+ "</span>公里，约<span style=\"color:#FF0000;font-weight:bold\">"
					+ cost + "</span>分钟到达。", stylehtml = "<input id=\"routeStyle\" name=\"routeStyle\" type=\"radio\" value=\"Fastest\" align=\"absmiddle\" checked=\"checked\" onclick=\"searchRouteByType('1')\">最快路线<input id=\"routeStyle\" name=\"routeStyle\" type=\"radio\" value=\"Shortest\" align=\"absmiddle\" onclick=\"searchRouteByType('2')\">最短路线", checkhtml = "<input type=\"checkbox\" value=\"\" name=\"checkTypeYD\" id=\"checkTypeYD\" onclick=\"searchRouteByType();return false\"/>";
			if (golRouteSytle == "Shortest") {
				stylehtml = "<input id=\"routeStyle\" name=\"routeStyle\" type=\"radio\" value=\"Fastest\" align=\"absmiddle\" onclick=\"searchRouteByType('1')\">最快路线<input id=\"routeStyle\" name=\"routeStyle\" type=\"radio\" value=\"Shortest\" align=\"absmiddle\" checked=\"checked\" onclick=\"searchRouteByType('2')\">最短路线";
			}
			if (selectCheckType == 1) {
				checkhtml = "<input type=\"checkbox\" value=\"\" name=\"checkTypeYD\" id=\"checkTypeYD\" onclick=\"searchRouteByType('3');return false\" checked=\"checked\"/>";
			}
			var st = "<p style=\"background-color:#D5DDF3; height:22px; \">"
					+ stylehtml + "<span style=\"padding-left:50px;\">"
					+ checkhtml + "避开拥堵</span></p>", tops = "<p style=\"margin:5px 10px 5px 10px; line-height:20px; \"><span style=\"font-weight:bold;color:#3366CC\">"
					+ golStartName
					+ "</span>到<span style=\"font-weight:bold;color:#3366CC\">"
					+ golEndName + "</span>" + l + "</p>";
			result.append(st);
			result.append(tops);
			if (selectCheckType == 1) {
				$('#checkTypeYD').attr('checked', 'checked');
			}
			var routeNum = route.routeLength, routeD = route.routeDes;
			if (routeD != null) {
				var dlength = routeD.length;
				for ( var i = 0; i < dlength; i++) {
					var lineNum = i + 1, s_h = "", status = routeD[i].description, prouteId = "proute"
							+ i, fid = i;
					if (status != null && status.length > 0) {
						if (status.indexOf('|') != -1) {
							var sa = status.split("A").length - 1, sb = status
									.split("B").length - 1, sc = status
									.split("C").length - 1, sz = status
									.split("Z").length - 1, a = [ sa, sb, sc,
									sz ], n = a.sort().pop();
							if (sa == n) {
								s_h = "<span style=\"color:red\">拥堵</span>";
							} else if (sb == n) {
								s_h = "<span style=\"color:#FF9900\">缓行</span>";
							} else if (sc == n) {
								s_h = "<span style=\"color:green\">畅通</span>";
							} else {
								s_h = "<span style=\"color:green\">暂无数据</span>";
							}
						}
					}
					var routeLen = "", rl = routeD[i].roadLength;
					if (rl >= 1000) {
						routeLen = "<span style=\"color:red;padding-left:2px;\">"
								+ rl / 1000 + "</span>公里";
					} else {
						routeLen = "<span style=\"color:red;padding-left:2px;\">"
								+ rl + "</span>米";
					}
					var message = "<p id="
							+ prouteId
							+ " style=\"margin-left:5px;font-size:12px; line-height:25px;\"><span style=\"font-weight:bold\">"
							+ lineNum
							+ ".</span><span style=\"color:#0066FF\">"
							+ routeD[i].roadName
							+ "</span><span style=\"color:#666;padding-left:2px;\">行驶"
							+ routeLen
							+ "</span><span style=\"color:#666;padding-left:2px;\">"
							+ routeD[i].turnType
							+ "</span><span style=\"color:#0066FF;padding-left:2px;\">"
							+ routeD[i].nextRoadName
							+ "</span><span style=\"padding-left:5px;\">" + s_h
							+ "</span></p>";
					result.append(message);
				}
			}
	/*		
			var routeE = route.routeExplain, elength = routeE.length, coords = "";
			movePointInfo = [];
			for ( var j = 0; j < elength; j++) {
				var kwt = routeE[j].vertexesString;
				mapcoords[j] = kwt;
				coords += kwt + ";";
				if (kwt.indexOf(";")) {
					var k = kwt.split(";");
					var klength = k.length;
					for ( var c = 0; c < klength; c++) {
						movePointInfo.push(k[c]);
					}
				}
			}
	*/		
			var coords= route.coords;
			var k = coords.split(";");
			movePointInfo =[];
			var klength = k.length;
			for(var c=0; c<klength;c++){
				movePointInfo.push(k[c]);
			}		
			addPoly(coords, 'route');
			movePoint();
			coll.show('slow');
		} else {
			result
					.append("<p style=\"padding-top:5px; padding-left:20px;\"><span style=\"color:#ff0000\">没有找到相关的结果！</span></p>");
			coll.hide();
		}
	} else {
		result
				.append("<p style=\"padding-top:5px; padding-left:20px;\"><span style=\"color:#ff0000\">没有找到相关的结果！</span></p>");
		coll.hide();
	}
	colseLoadImage('loadinit1');
	result = null;
	coll = null;
}
function searchRouteByType(type) {
	loadImage('loadinit1');
	clearInterval();
	var block = "", check = $('#checkTypeYD').attr('checked');
	if (check) {
		block = 'true';
		selectCheckType = 1;
	} else {
		block = 'false';
		selectCheckType = 0;
	}
	var routeStyle = document.getElementsByName("routeStyle");
	if (type == 1) {
		golRouteSytle = "Fastest";
	} else if (type == 2) {
		golRouteSytle = "Shortest";
	} else {
		for ( var i = 0; i < routeStyle.length; i++) {
			if (routeStyle[i].checked) {
				golRouteSytle = routeStyle[i].value;
			}
		}
	}
	removeMapInfo();
	View.getRoute(startRouteLat, startRouteLon, endRouteLat, endRouteLon,
			block, golRouteSytle, routeCallBack);
	addPointInRouteType('start', golStartName, startRouteLat, startRouteLon);
	addPointInRouteType('end', golEndName, endRouteLat, endRouteLon);
	routeStyle = null;
}
function addRouteBG(id, cid) {
	var n = $('#' + id);
	n.addClass('routeBGColor');
	n = null;
}
function removeRouteBG(id, cid) {
	var rn = $('#' + id);
	rn.removeClass('routeBGColor');
	rn = null;
}
var golEventInfo = [];// 存储事件对象
var eventexplain = [];
var selectType1 = 1; // 道路施工
var selectType2 = 1; // 交通事故
var selectType3 = 1; // 交通管制
function getEventInfo() {
	loadImage('loadinit2');
	selectOpenType = 2;
	removeMapInfo();
	var rp = $('#resultPage2');
	rp.empty();
	rp = null;
	Other.eventList(TGCC, selectType1, selectType2, selectType3, '',
			eventCallBack);
}
function eventCallBack(result) {
	if (result != null) {
		var roadConstruct = $('#roadConstruct'), trafficAccident = $('#trafficAccident'), trafficContol = $('#trafficContol');
		if (selectType1 == 1) {
			roadConstruct.attr('checked', true);
		} else {
			roadConstruct.attr('checked', false);
		}
		if (selectType2 == 1) {
			trafficAccident.attr('checked', true);
		} else {
			trafficAccident.attr('checked', false);
		}
		if (selectType3 == 1) {
			trafficContol.attr('checked', true);
		} else {
			trafficContol.attr('checked', false);
		}
		golEventInfo = [];
		golEventInfo = result;
		var cp = 1, tn = golEventInfo.length, s = tn % 15, tp = (tn - s) / 15
				+ (s > 0 ? 1 : 0);
		if (tp < 1) {
			tp = 1;
		}
		eventInfo(cp);
		if (tp > 1) {
			showOhterPages(cp, tp, tn, 'events');
		} else {
			$('#resultPage2').empty();
		}
		roadConstruct = null;
		trafficAccident = null;
		trafficContol = null;
	} else {
		var er = $('#eventResult');
		er
				.append("<p style=\"padding-top:5px;\" align=\"center\"><span style=\"color:#ff0000\">没有找到相关的结果！</span></p>");
		er = null;
	}
}
function eventInfo(cp) {
	var eventhtml = $('#eventResult'), elength = golEventInfo.length, eventclass = screenWidth('events');
	eventhtml.empty();
	if (elength > 0) {
		var start = (cp - 1) * 15, end = cp * 15;
		for ( var i = start; i < end; i++) {
			if (i < elength) {
				var e = golEventInfo[i], line = i + 1, shortTitle = e.shortTitle, eId = e.eventId, mId = "events"
						+ eId;
				eventexplain[eId] = e;
				var eh = "<p class="
						+ eventclass
						+ "><nobr><span style=\"font-size:12px; color:#000000; font-weight:bold\">"
						+ line
						+ ".</span><span style=\"padding-left:3px; word-break:keep-all; overflow:hidden; \" ><a href=\"#\" onclick=\"addEventPoint('"
						+ eId + "');openPoiTip('" + mId + "');\">" + shortTitle
						+ "</a></span></nobr></p>";
				eventhtml.append(eh);
				if (mapshowImage == 1) {
					addEventPoint(e.eventId);
				}
			}
		}
	} else {
		eventhtml
				.append("<p style=\"padding-top:5px;\" align=\"center\"><span style=\"color:#ff0000\">没有事件信息！</span></p>");
	}
	colseLoadImage('loadinit2');
	eventhtml = null;
}
function showOhterPages(cp, tp, pl, type) {
	if (pl > 0) {
		var start = 0, end = 1;
		if (tp <= 7) {
			start = 0;
			end = tp;
		} else {
			if (cp < 4) {
				start = 0;
				end = 7;
			} else {
				if (cp > tp - 4) {
					start = tp - 7;
					end = tp;
				} else {
					start = cp - 4;
					end = cp + 3;
				}
			}
		}
		var p_html = "<div style=\"width:320px; text-align:center\"><span>";
		if (cp > 1) {
			p_html += "<a href=\"#\" onClick=\"gotoOtherPage(" + cp + "-1,'"
					+ tp + "','" + pl + "','" + type
					+ "');return false\"><font class=\"STYLE4\">上一页</font></a>";
		}
		for ( var i = start; i < end; i++) {
			var c_p = i + 1;
			if (cp == i + 1) {
				p_html += "<a href=\"#\" onClick=\"gotoOtherPage("
						+ c_p
						+ ",'"
						+ tp
						+ "','"
						+ pl
						+ "','"
						+ type
						+ "');return false\" class=\"STYLE4\"  style=\"color:#FF0000\"><font style=\"font-size:12px;\"><span style=\"vertical-align:top; margin-left:2px; margin-right:3px;\">[<span style=\"padding-left:2px; \">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			} else {
				p_html += "<a href=\"#\" onClick=\"gotoOtherPage("
						+ c_p
						+ ",'"
						+ tp
						+ "','"
						+ pl
						+ "','"
						+ type
						+ "');return false\" class=\"STYLE4\"><font style=\"font-size:12px;\"><span  style=\"vertical-align:top; margin-left:2px;\">[<span style=\"padding-left:2px; padding-rigth:2px;\">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			}
		}
		if (cp < tp) {
			p_html += "<a href=\"#\" onClick=\"gotoOtherPage(" + cp + "+1,'"
					+ tp + "','" + pl + "','" + type
					+ "');return false\"><font class=\"STYLE4\">下一页</font></a>";
		}
		p_html += "</span></div>";
		var pag = '';
		if (type == 'events') {
			pag = 'resultPage2';
		} else if (type == 'parks') {
			pag = 'resultPage3';
		}
		$('#' + pag).html(p_html);
	}
}
function EventInfoByCondition() {
	var roadConstruct = $('#roadConstruct'), trafficAccident = $('#trafficAccident'), trafficContol = $('#trafficContol');
	if (roadConstruct.attr('checked')) {
		selectType1 = 1;
		roadConstruct.attr('checked', true);
	} else {
		selectType1 = 0;
		roadConstruct.attr('checked', false);
	}
	if (trafficAccident.attr('checked')) {
		selectType2 = 1;
		trafficAccident.attr('checked', true);
	} else {
		selectType2 = 0;
		trafficAccident.attr('checked', false);
	}
	if (trafficContol.attr('checked')) {
		selectType3 = 1;
		trafficContol.attr('checked', true);
	} else {
		selectType3 = 0;
		trafficContol.attr('checked', false);
	}
	getEventInfo();
	roadConstruct = null;
	trafficAccident = null;
	trafficContol = null;
}
function gotoOtherPage(cp, tp, pl, type) {
	if (type == "events") {
		eventInfo(cp);
	} else if (type == "parks") {
		parkInfo(cp);
	}
	showOhterPages(cp, tp, pl, type);
}
function addEventPoint(id) {
	var e = eventexplain[id];
	var coords = e.situation;
	if (coords != null && coords.length > 0) {
		commonAddPoint(id);
	}
}
function getParkingInfo() {
	loadImage('loadinit3');
	removeMapInfo();
	selectOpenType = 3;
	Other.getParkingResult(TGCC, parkCallBack);
}
var golParkInfo = [];
function parkCallBack(result) {
	if (result != null) {
		golParkInfo = [];
		golParkInfo = result;
		var cp = 1, tn = golParkInfo.length, s = tn % 13, tp = (tn - s) / 13
				+ (s > 0 ? 1 : 0);
		if (tp < 1) {
			tp = 1;
		}
		parkInfo(cp);
		if (tp > 1) {
			showOhterPages(cp, tp, tn, 'parks');
		} else {
			$('#resultPage3').empty();
		}
	} else {
		var pr = $('#parkResult');
		pr
				.append("<p style=\"padding-top:5px;\" align=\"center\"><span style=\"color:#ff0000\">没有找到相关的结果！</span></p>");
		pr = null;
	}
}
var parkCheckInfo = {};
function parkInfo(cp) {
	var parkhtml = $('#parkResult'), parkclass = screenWidth('park');
	plength = golParkInfo.length;
	parkhtml.empty();
	if (plength > 0) {
		var th = "<div style=\"height:20px; padding-top:5px;\"><div style=\"width:80px; float:left; margin-left:10px;\">名称</div><div style=\"width:120px; float:left;\">地址</div><div style=\"float:left;\">车位数(<span style=\"color:#ffb400\">空位</span>/总数)</div></div>";
		parkhtml.append(th);
		var start = (cp - 1) * 13, end = cp * 13;
		for ( var i = start; i < end; i++) {
			if (i < plength) {
				var park = golParkInfo[i], parkName = golParkInfo[i].parkingName, address = golParkInfo[i].parkingAddr, totalSpace = golParkInfo[i].totalSpace, currentSpace = golParkInfo[i].currentSpace;
				if (address.length > 13) {
					subaddress = address.substring(0, 13) + "...";
				} else {
					subaddress = address;
				}
				parkCheckInfo[i] = park;
				var ph = "<div class="
						+ parkclass
						+ "><div style=\"width:80px; float:left\"><a href=\"javascript:void(0)\" onClick=\"parkAddMap('"
						+ i
						+ "')\" >"
						+ parkName
						+ "</a></div><div style=\"width:160px; float:left\" title="
						+ address
						+ ">"
						+ subaddress
						+ "</div><div style=\"width:50px; float:left\"><span style=\"color:#ffb400\">"
						+ currentSpace + "</span>/" + totalSpace
						+ "</div></div>";
				parkhtml.append(ph);
			}
		}
	} else {
		parkhtml
				.append("<p style=\"padding-top:5px; \" align=\"center\"><span style=\"color:#ff0000\">没有停车场信息！</span></p>");
	}
	colseLoadImage('loadinit3');
	parkhtml = null;
}
var golCurPage = 1, golTotalPage = 0, golPageSize = 15, openLayer = 1, golLength = 0, collPoiInfo = {}, collRouteInfo = {}, golCollId = 1, collPoiMap = {};
function myColltion(id, curp) {
	loadImage('loadinit4');
	selectOpenType = 4;
	golCollId = id;
	collOpenId = 1;
	golCurPage = curp;
	var type = 'point';
	if (id == 1) {
		type = "point";
		openLayer = 1;
		document.getElementById('cpsid').className = "colltop";
		document.getElementById('crsid').className = "";
	} else if (id == 2) {
		type = 'line';
		openLayer = 2;
		document.getElementById('crsid').className = "colltop";
		document.getElementById('cpsid').className = "";
	}
	Custom.getCollectionList(TGCC, userName, type, 'desc', golCurPage,
			golPageSize, collectionList_do);
}
function collectionList_do(pageList) {
	var list = pageList.data, collhtml = $('#collResult');
	golLength = list.length;
	golTotalPage = pageList.totalPageCount;
	collhtml.empty();
	if (openLayer == 1) {
		if (golLength > 0) {
			var cn = screenWidth('colltion');
			for ( var i = 0; i < golLength; i++) {
				var poi = list[i], id = poi.pointId, name = poi.pointName == null
						|| poi.pointName == "" ? "" : poi.pointName, line = i + 1, seldiv = "collseldiv"
						+ line, selImage = "collselImage" + line, message = "", resultType = poi.resultType, pointId = "collpoint"
						+ id, zopdiv = 'collopen_' + line;
				collPoiInfo[id] = poi;
				if (resultType == "poi") {
					message = "<p id="
							+ seldiv
							+ " class="
							+ cn
							+ "><nobr><span style=\"color:#FF00FF; font-size:12px; float:left\" ><span style=\"font-size:12px; color:#000000; font-weight:bold\">"
							+ line
							+ ".</span><img src=\"images/x_55.gif\" style=\"margin-left:5px;\" width=\"12\" height=\"12\" id="
							+ selImage
							+ " onClick=\"collPoiTraffic('"
							+ id
							+ "','"
							+ line
							+ "','point');return false\"><a href=\"#\" onClick=\"collPoiTraffic('"
							+ id
							+ "','"
							+ line
							+ "','point');return false\" style=\"margin-left:5px;\">"
							+ name
							+ "</a></span><span style=\"float:right; padding-right:5px;\"><a href=\"javascript:void(0)\" onclick=\"deleteColltionPoint('point','"
							+ id
							+ "','"
							+ seldiv
							+ "','"
							+ zopdiv
							+ "');return false\" style=\"color:#ff0000\">删除</a></span></nobr></p><p id="
							+ zopdiv + " style=\"display:none\"></p>";
				} else if (resultType == "road") {
					message = "<p id="
							+ seldiv
							+ " class="
							+ cn
							+ "><nobr><span style=\"color:#FF00FF; font-size:12px; float:left\" ><span style=\"font-size:12px; color:#000000; font-weight:bold\">"
							+ line
							+ ".</span><img src=\"images/x_55.gif\" width=\"12\" height=\"12\" style=\"margin-left:5px;\" id="
							+ selImage
							+ " onClick=\"collRoadTraffic('"
							+ id
							+ "','"
							+ poi.city
							+ "','"
							+ name
							+ "','"
							+ line
							+ "','poi');return false\"><a href=\"#\" onClick=\"collRoadTraffic('"
							+ id
							+ "','"
							+ poi.city
							+ "','"
							+ name
							+ "','"
							+ line
							+ "','poi');return false\" style=\"margin-left:5px;\">"
							+ name
							+ "</a></span><span style=\"float:right; padding-right:5px;\"><a href=\"javascript:void(0)\" onclick=\"deleteColltionPoint('point','"
							+ id
							+ "','"
							+ seldiv
							+ "','"
							+ zopdiv
							+ "');return false\" style=\"color:#ff0000\">删除</a></span></nobr></p><p id="
							+ zopdiv + " style=\"display:none\"></p>";
				}
				collhtml.append(message);
			}
		} else {
			collhtml
					.append("<p style=\"padding-top:5px; \" align=\"center\"><span style=\"color:#ff0000\">目前没有我的热点信息！</span></p>");
		}
	} else if (openLayer == 2) {
		if (golLength > 0) {
			var cn = screenWidth('colltion');
			for ( var i = 0; i < golLength; i++) {
				var route = list[i], id = route.lineId, csName = route.startName, ceName = route.endName, titles = "从"
						+ csName + "到" + ceName, line = i + 1, seldiv = "colllineSeldiv"
						+ line, selImage = "colllineSelImage" + line, subject = "从"
						+ csName + "到" + ceName, zordiv = 'colllineOpen_' + line;
				if (subject.length > 20) {
					subject = subject.substring(0, 20);
				}
				collRouteInfo[id] = route;
				var message = "<p id="
						+ seldiv
						+ " class="
						+ cn
						+ "><nobr><span style=\"color:#FF00FF; font-size:12px;float:left\" ><span style=\"font-size:12px; color:#000000; padding-left:2px; font-weight:bold\">"
						+ line
						+ ".</span><span style=\"padding-left:2px;\"><img src=\"images/x_55.gif\" width=\"12\" height=\"12\" id="
						+ selImage
						+ "  onClick=\"searchCollRoute('"
						+ id
						+ "','"
						+ line
						+ "');return false\"></span><a href=\"#\"  onClick=\"searchCollRoute('"
						+ id
						+ "','"
						+ line
						+ "');return false\"><span id=\"ch_"
						+ line
						+ "\">"
						+ subject
						+ "</span></a></span><span style=\"float:right; padding-right:5px;\"><a href=\"javascript:void(0)\" onclick=\"deleteColltionPoint('line','"
						+ id
						+ "','"
						+ seldiv
						+ "','"
						+ zordiv
						+ "');return false\" style=\"color:#ff0000\">删除</a></span></nobr></p><p id="
						+ zordiv + " style=\"display:none\"></p>";
				collhtml.append(message);
			}
		} else {
			collhtml
					.append("<p style=\"padding-top:5px; \" align=\"center\"><span style=\"color:#ff0000\">目前没有我的路线信息！</span></p>");
		}
	}
	showCollectionPage();
	colseLoadImage('loadinit4');
	collhtml = null;
}
function showCollectionPage() {
	if (golLength > 0) {
		var start = 0, end = 1;
		if (golTotalPage <= 7) {
			start = 0, end = golTotalPage;
		} else {
			if (golCurPage < 4) {
				start = 0, end = 7;
			} else {
				if (golCurPage > golTotalPage - 4) {
					start = golTotalPage - 7, end = golTotalPage;
				} else {
					start = golCurPage - 4, end = golCurPage + 3;
				}
			}
		}
		var p_html = "<div style=\"width:320px; text-align:center\"><span>";
		if (golCurPage > 1) {
			p_html += "<a href=\"#\" onClick=\"goCollectionPage("
					+ golCurPage
					+ "-1);return false\"><font class=\"STYLE4\">上一页</font></a>";
		}
		for ( var i = start; i < end; i++) {
			var c_p = i + 1;
			if (golCurPage == i + 1) {
				p_html += "<a href=\"#\" onClick=\"goCollectionPage("
						+ c_p
						+ ");return false\" class=\"STYLE4\"  style=\"color:#FF0000\"><font style=\"font-size:12px;\"><span style=\"vertical-align:top; margin-left:2px; margin-right:3px;\">[<span style=\"padding-left:2px; \">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			} else {
				p_html += "<a href=\"#\" onClick=\"goCollectionPage("
						+ c_p
						+ ");return false\" class=\"STYLE4\"><font style=\"font-size:12px;\"><span  style=\"vertical-align:top; margin-left:2px;\">[<span style=\"padding-left:2px; padding-rigth:2px;\">"
						+ c_p
						+ "</span><span style=\"padding-left:2px; \">]</span></span></font></a>";
			}
		}
		if (golCurPage < golTotalPage) {
			p_html += "<a href=\"#\" onClick=\"goCollectionPage("
					+ golCurPage
					+ "+1);return false\"><font class=\"STYLE4\">下一页</font></a>";
		}
	}
	p_html += "</span></div>";
	var rp = $("#resultPage4");
	if (golTotalPage > 1) {
		rp.html(p_html);
	} else {
		rp.empty();
	}
	rp = null;
}
function goCollectionPage(page) {
	removeMapInfo();
	golCurPage = page;
	myColltion(golCollId, page);
}
var collOpenId = 1;
function collPoiTraffic(id, forId, type) {
	var c = $('#collopen_' + forId).css('display');
	if (c == "block") {
		$("#collseldiv" + forId).removeClass('seldiv');
		$("#collopen_" + forId).slideUp('slow');
		$('#collselImage' + forId).attr('src', 'images/x_55.gif');
		return;
	}
	loadImage('loadinit4');
	var p = collPoiInfo[id];
	collOpenId = forId;
	View.getPoiTraffic(p.city, p.lat, p.lon, poiCollTrafficCallBack);
	mapAddCollPoint(id, 'poi', 'poi');
}
function poiCollTrafficCallBack(result) {
	var t_html = "";
	if (result != null) {
		var f = result.FTraffic, r = result.RTraffic;
		if (f != null || r != null) {
			if (f != null && f.length > 0) {
				var flength = f.length;
				t_html = "<span style=\"padding-left:30px;\">正向：</span><br>";
				for ( var i = 0; i < flength; i++) {
					var line_in = i + 1, traffic = result.FTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status)
					}
					var message = "<div style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','1');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></div><br>";
					t_html += message
				}
			}
			if (r != null && r.length > 0) {
				var rlength = r.length;
				t_html += "<span style=\"padding-left:30px;\">反向：</span><br>";
				for ( var i = 0; i < rlength; i++) {
					var line_in = i + 1, traffic = result.RTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status)
					}
					var message = "<div style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','0');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></div><br>";
					t_html += message
				}
			}
		} else {
			t_html = "<span style=\"font-size:12px; padding-left:20px; color:#666fff\">没有路况信息！</span>"
		}
	} else {
		t_html = "<span style=\"font-size:12px; padding-left:20px; color:#666fff\">没有路况信息！</span>"
	}
	for ( var i = 1; i <= golLength; i++) {
		if (i == collOpenId) {
			var c = $('#collopen_' + i).css('display');
			if (c == "block") {
				$("#collseldiv" + i).removeClass('seldiv');
				$("#collopen_" + i).slideUp('slow');
				$('#collselImage' + i).attr('src', 'images/x_55.gif')
			} else {
				$("#collopen_" + i).slideDown('slow').html(t_html);
				$("#collseldiv" + i).addClass('seldiv');
				$('#collselImage' + i).attr('src', 'images/x_58.gif')
			}
		} else {
			$("#collseldiv" + i).removeClass('seldiv');
			$("#collopen_" + i).slideUp('slow');
			$('#collselImage' + i).attr('src', 'images/x_55.gif')
		}
	}
	colseLoadImage('loadinit4');
}
var golRoadMapId = '';// 存储roadId用于定位地图显
function collRoadTraffic(id, cityCode, name, forId, type) {
	golRoadMapId = id;
	var c = $('#collopen_' + forId).css('display');
	if (c == "block") {
		$("#collseldiv" + forId).removeClass('seldiv');
		$("#collopen_" + forId).slideUp('slow');
		$('#collselImage' + forId).attr('src', 'images/x_55.gif');
		return
	}
	loadImage('loadinit4');
	collOpenId = forId;
	View.getRoadTraffic(TGCC, name, roadCollTrafficCallBack);
}
function roadCollTrafficCallBack(result) {
	var t_html = "";
	if (result != null) {
		var f = result.FTraffic, r = result.RTraffic;
		if (f != null || r != null) {
			if (f != null && f.length > 0) {
				var flength = f.length;
				t_html = "<span style=\"padding-left:30px;\">正向：</span><br>";
				for ( var i = 0; i < flength; i++) {
					var line_in = i + 1, traffic = result.FTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status)
					}
					var message = "<div style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','1');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></div><br>";
					t_html += message
				}
			}
			if (r != null && r.length > 0) {
				var rlength = r.length;
				t_html += "<span style=\"padding-left:30px;\">反向：</span><br>";
				for ( var i = 0; i < rlength; i++) {
					var line_in = i + 1, traffic = result.RTraffic[i], status = traffic.state, s_h = "";
					if (status != null) {
						s_h = hbstatus(status)
					}
					var message = "<div style=\"height:20px; display:inline; padding-left:30px;\" nowrap='nowrap'><nobr><span style=\"width:15px;\">&nbsp;</span><span style=\"font-size:12px; color:#00349a; line-height:20px;\">"
							+ line_in
							+ ".<a href=\"void(0)\" onclick=\"trafficPoly('"
							+ traffic.roadWKT
							+ "','0');return false\" style=\" color:#00349a;\">"
							+ traffic.startName
							+ "--->"
							+ traffic.endName
							+ "</a><span style=\"padding-left:3px;\">"
							+ s_h
							+ "</span></span></nobr></div><br>";
					t_html += message
				}
			}
		} else {
			t_html = "<span style=\"font-size:12px; padding-left:20px; color:#666fff\">没有路况信息！</span>"
		}
	} else {
		t_html = "<span style=\"font-size:12px; padding-left:20px; color:#666fff\">没有路况信息！</span>"
	}
	for ( var i = 1; i <= golLength; i++) {
		if (i == collOpenId) {
			var c = $('#collopen_' + i).css('display');
			if (c == "block") {
				$("#collseldiv" + i).removeClass('seldiv');
				$("#collopen_" + i).slideUp('normal');
				$('#collselImage' + i).attr('src', 'images/x_55.gif')
			} else {
				$("#collopen_" + i).slideDown('normal').html(t_html);
				$("#collseldiv" + i).addClass('seldiv');
				$('#collselImage' + i).attr('src', 'images/x_58.gif')
			}
		} else {
			$("#collseldiv" + i).removeClass('seldiv');
			$("#collopen_" + i).slideUp('normal');
			$('#collselImage' + i).attr('src', 'images/x_55.gif')
		}
	}
	colseLoadImage('loadinit4');
	mapAddCollPoint(golRoadMapId, 'poi', 'road');
}
var collOpenRoutId = 1;
var routeId = 0; // 当前路线Id
function searchCollRoute(id, forId) {
	clearInterval();
	removeMapInfo();
	var c = $('#colllineOpen_' + forId).css('display');
	if (c == "block") {
		$('#colllineOpen_' + forId).hide('slow');
		$('#colllineSeldiv' + forId).removeClass('seldiv');
		$('#colllineSelImage' + forId).attr('src', 'images/x_55.gif');
		return
	}
	loadImage('loadinit4');
	collOpenRoutId = forId;
	routeId = id;
	var r = collRouteInfo[id], block = "false";
	var routeStyle = (r.routeStyle == null && r.routeStyle.length < 0) ? "Fastest"
			: r.routeStyle;
	if (r.block == "1") {
		block = "true"
	}
	View.getRoute(r.startLat, r.startLon, r.endLat, r.endLon, block,
			routeStyle, routeCollCallBack);
}
function routeCollCallBack(route) {
	var routeHTML = "", topHTML = "", sdivRouteHTML = "<div class=\"overfollows\">", edivRouteHTML = "</div>";
	if (route != null) {
		var routeLength = route.routeLength, routeNum = route.routeLength, routeD = route.routeDes, l = "总里程约"
				+ routeLength / 1000 + "公里";
		topHTML = "<p><span id=\"glId\" style=\"padding-left:30px;color:#ff0000; font-weight:bold\">"
				+ l + "</span></p>";
		if (routeD != null) {
			var dlength = routeD.length;
			for ( var i = 0; i < dlength; i++) {
				var lineNum = i + 1, s_h = "", status = routeD[i].description;
				if (status != null && status.length > 0) {
					if (status.indexOf('|') != -1) {
						var sa = status.split("A").length - 1, sb = status
								.split("B").length - 1, sc = status.split("C").length - 1, a = [
								sa, sb, sc ], n = a.sort().pop(), tname = '';
						if (sa == n) {
							s_h = "<span style=\"color:red\">拥堵</span>";
							tname = "拥堵"
						} else if (sb == n) {
							s_h = "<span style=\"color:#FF9900\">缓行</span>";
							tname = "缓行"
						} else if (sc == n) {
							s_h = "<span style=\"color:green\">畅通</span>";
							tname = "畅通"
						}
					}
				}
				var routeLen = "", rl = routeD[i].roadLength;
				if (rl >= 1000) {
					routeLen = "<span style=\"color:red;padding-left:2px;\">"
							+ rl / 1000 + "</span>公里"
				} else {
					routeLen = "<span style=\"color:red;padding-left:2px;\">"
							+ rl + "</span>米"
				}
				var title = routeD[i].roadName + "&nbsp;至&nbsp;"
						+ routeD[i].nextRoadName + "&nbsp;" + tname;
				var message = "<div style=\" font-size:12px; line-height:25px; padding-left:30px\" title="
						+ title
						+ "><font color=\"#000000\">"
						+ lineNum
						+ ".</font><span style=\"color:#0066FF\">"
						+ routeD[i].roadName
						+ "</span><span style=\"color:#666;padding-left:2px;\">行驶"
						+ routeLen
						+ "</span><span style=\"color:#666;padding-left:2px;\">"
						+ routeD[i].turnType
						+ "</span><span style=\"color:#0066FF;padding-left:2px;\">"
						+ routeD[i].nextRoadName
						+ "</span><span style=\"padding-left:5px;\">"
						+ s_h
						+ "</span></div>";
				routeHTML += message
			}
		}
/*		var routeE = route.routeExplain, elength = routeE.length, coords = "";
		collMovePointInfo = [];
		for ( var j = 0; j < elength; j++) {
			var kwt = routeE[j].vertexesString;
			coords += kwt + ";";
			if (kwt.indexOf(";")) {
				var k = kwt.split(";");
				for ( var c = 0; c < k.length; c++) {
					collMovePointInfo.push(k[c])
				}
			}
		} */
		var coords= route.coords;
		var k = coords.split(";");
		movePointInfo =[];
		var klength = k.length;
		for(var c=0; c<klength;c++){
			movePointInfo.push(k[c]);
		}		
		addCollPointInRoute();
		addPoly(coords);
		moveCollPoint()
	} else {
		routeHTML = "<span style=\"font-size:12px; padding-left:20px; color:#666fff\">没有路径规划信息！</span>"
	}
	for ( var i = 1; i <= golLength; i++) {
		if (i == collOpenRoutId) {
			var c = $('#colllineOpen_' + i).css('display');
			if (c == "block") {
				$('#colllineOpen_' + i).hide('slow');
				$('#colllineSeldiv' + i).removeClass('seldiv');
				$('#colllineSelImage' + i).attr('src', 'images/x_55.gif')
			} else {
				$('#colllineOpen_' + i).show('slow').html(
						sdivRouteHTML + topHTML + routeHTML + edivRouteHTML);
				$('#colllineSeldiv' + i).addClass('seldiv');
				$('#colllineSelImage' + i).attr('src', 'images/x_58.gif')
			}
		} else {
			$('#colllineOpen_' + i).hide('slow');
			$('#colllineSeldiv' + i).removeClass('seldiv');
			$('#colllineSelImage' + i).attr('src', 'images/x_55.gif')
		}
	}
	colseLoadImage('loadinit4');
}
var deletepid = '';
function deleteColltionPoint(type, id, lid, lpid) {
	if (window.confirm("确定要删除这条信息吗？")) {
		deletepid = lid;
		$('#' + lpid).remove();
		Custom.deleteCollection(type, id, deleteCollection_do);
	}
}
function deleteCollection_do(info) {
	var message = "";
	if (info == "fail") {
		message = "删除失败"
	} else if (info == "success") {
		message = "删除成功";
		$('#' + deletepid).remove()
	}
	var img = $('#cpsid'), t = img.offset().top + 30, l = img.offset().left + 2;
	img = null;
	opTipInfo(message, l, t);
	window.setTimeout(closeTipInfo, 2000);
}
function opTipInfo(message, l, t) {
	var tm = $('#TipMess'), tinfo = $('#tipInfo');
	tm.html(message);
	tinfo.css( {
		'top' :t,
		'left' :l
	}).slideDown('slow');
	tm = null;
	tinfo = null;
}
function closeTipInfo() {
	var t = $('#tipInfo');
	t.slideUp('slow');
	t = null;
}
function screenWidth(opentype) {
	var cssSheet = 'info_search7ie768', h = screen.height, type = getNavType(), cn = "info_search";
	if (opentype == "colltion") {
		cn = "info_coll"
	} else if (opentype == "park") {
		cn = "info_park"
	} else if (opentype == "point") {
		cn = "info_search"
	} else if (opentype == "events") {
		cn = "info_event"
	}
	if (type == 'ie6') {
		if (h == 768) {
			cssSheet = cn + '6ie768'
		} else if (h == 800) {
			cssSheet = cn + '6ie800'
		} else if (h == 900) {
			cssSheet = cn + '6ie900'
		} else if (h == 864) {
			cssSheet = cn + '6ie864'
		} else if (h == 1024) {
			cssSheet = cn + '6ie1024'
		} else {
			cssSheet = cn + '6ie768'
		}
	} else if (type == 'firefox') {
		if (h == 768) {
			cssSheet = cn + 'ff768'
		} else if (h == 800) {
			cssSheet = cn + 'ff800'
		} else if (h == 900) {
			cssSheet = cn + 'ff900'
		} else if (h == 864) {
			cssSheet = cn + 'ff864'
		} else if (h == 1024) {
			cssSheet = cn + 'ff1024'
		} else {
			cssSheet = cn + 'ff768'
		}
	} else if (type == "ie7") {
		if (h == 768) {
			cssSheet = cn + '7ie768'
		} else if (h == 800) {
			cssSheet = cn + '7ie800'
		} else if (h == 900) {
			cssSheet = cn + '7ie900'
		} else if (h == 864) {
			cssSheet = cn + '7ie864'
		} else if (h == 1024) {
			cssSheet = cn + '7ie1024'
		} else {
			cssSheet = cn + '7ie768'
		}
	} else {
		cssSheet = cn + '7ie768'
	}
	return cssSheet;
}
function pupoNameByCity() {
	selectOpenType = 0;
	var sr = $('#searchResult'), cityName = TGCN, pupoHTML = "", tophtml = "";
	sr.empty();
	if ($.trim(cityName) == "北京") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('116.437107','39.908856','东二环','12');return false\" onFocus=\"this.blur()\">东二环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.355493','39.907432','西二环','12');return false\" onFocus=\"this.blur()\">西二环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.394031','39.870848','南二环','13');return false\" onFocus=\"this.blur()\">南二环</a> <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.392819','39.949237','北二环','13');return false\" onFocus=\"this.blur()\">北二环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.462988','39.908771','东三环','12');return false\" onFocus=\"this.blur()\">东三环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.307119','39.907821','西三环','12');return false\" onFocus=\"this.blur()\">西三环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.396445','39.856639','南三环','12');return false\" onFocus=\"this.blur()\">南三环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.391687','39.968947','北三环','12');return false\" onFocus=\"this.blur()\">北三环</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.395890','39.907399','长安街','14');return false\" onFocus=\"this.blur()\">长安街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.394602','39.933573','平安大街','14');return false\" onFocus=\"this.blur()\">平安大街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.316040','39.979192','中关村','15');return false\" onFocus=\"this.blur()\">中关村</a> <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.460153','39.909979','国贸','15');return false\" onFocus=\"this.blur()\">国贸</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.374478','39.913098','西单','15');return false\" onFocus=\"this.blur()\">西单</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.410899','39.914234','王府井','15');return false\" onFocus=\"this.blur()\">王府井</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.427151','39.904905','北京站','14');return false\" onFocus=\"this.blur()\">北京站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.321587','39.895526','北京西站','14');return false\" onFocus=\"this.blur()\">北京西站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.381304','39.864133','北京南站','14');return false\" onFocus=\"this.blur()\">北京南站</a>";
		tophtml = "* 中心位置支持首字母查询，西直门可输入“xzm”"
	} else if ($.trim(cityName) == "上海") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('121.439851','31.192642','徐家汇','15');return false\" onFocus=\"this.blur()\">徐家汇</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.416357','31.196267','中山西路','13');return false\" onFocus=\"this.blur()\">中山西路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.449845','31.258422','内环高架路','12');return false\" onFocus=\"this.blur()\">内环高架路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.425270','31.209828','延安高架路','12');return false\" onFocus=\"this.blur()\">延安高架路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.390927','31.250094','中环路','11');return false\" onFocus=\"this.blur()\">中环路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.525982','31.22922','世纪大道','13');return false\" onFocus=\"this.blur()\">世纪大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.554649','31.254368','浦东大道','13');return false\" onFocus=\"this.blur()\">浦东大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.481232','31.27867','中山北一路','13');return false\" onFocus=\"this.blur()\">中山北一路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.455424','31.186445','中山南二路','13');return false\" onFocus=\"this.blur()\">中山南二路</a> <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.546638','31.199730','龙阳路','13');return false\" onFocus=\"this.blur()\">龙阳路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.449957','31.291974','共和新路','12');return false\" onFocus=\"this.blur()\">共和新路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.409220','31.244943','曹杨路','13');return false\" onFocus=\"this.blur()\">曹杨路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.502674','31.29632','邯郸路','14');return false\" onFocus=\"this.blur()\">邯郸路</a>";
		tophtml = "* 中心位置支持首字母查询，人民广场可输入“rmgc”"
	} else if ($.trim(cityName) == "武汉") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('114.287789','30.549363','长江大桥','14');return false\" onFocus=\"this.blur()\">长江大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.324074','30.602717','长江二桥','14');return false\" onFocus=\"this.blur()\">长江二桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.294604','30.591099','大智路','15');return false\" onFocus=\"this.blur()\">大智路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.357129','30.603234','友谊大道','12');return false\" onFocus=\"this.blur()\">友谊大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.354225','30.609321','和平大道','12');return false\" onFocus=\"this.blur()\">和平大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.292697','30.595022','解放大道','12');return false\" onFocus=\"this.blur()\">解放大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.348069','30.561647','中北路','13');return false\" onFocus=\"this.blur()\">中北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.327322','30.535815','武珞路','14');return false\" onFocus=\"this.blur()\">武珞路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.317969','30.529274','武昌火车站','15');return false\" onFocus=\"this.blur()\">武昌火车站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.328904','30.59419','武昌北站','15');return false\" onFocus=\"this.blur()\">武昌北站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.264507','30.620519','汉口火车站','15');return false\" onFocus=\"this.blur()\">汉口火车站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.297651','30.575009','武汉关','15');return false\" onFocus=\"this.blur()\">武汉关</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.271795','30.596483','建设大道','13');return false\" onFocus=\"this.blur()\">建设大道</a>";
		tophtml = "* 中心位置支持首字母查询，长江大桥可输入“cjdq”"
	} else if ($.trim(cityName) == "成都") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('104.073009','30.686047','人民北路','14');return false\" onFocus=\"this.blur()\">人民北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.066754','30.633673','人民南路','13');return false\" onFocus=\"this.blur()\">人民南路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.082252','30.657715','红星路','14');return false\" onFocus=\"this.blur()\">红星路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.067663','30.658595','蜀都大道','13');return false\" onFocus=\"this.blur()\">蜀都大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.060781','30.661827','东城根街','14');return false\" onFocus=\"this.blur()\">东城根街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.065593','30.651912','红照壁','15');return false\" onFocus=\"this.blur()\">红照壁</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.065751','30.657323','天府广场','15');return false\" onFocus=\"this.blur()\">天府广场</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.073830','30.696687','火车北站','15');return false\" onFocus=\"this.blur()\">火车北站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.070922','30.663786','顺城大街','14');return false\" onFocus=\"this.blur()\">顺城大街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.068497','30.654430','盐市口','15');return false\" onFocus=\"this.blur()\">盐市口</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.078226','30.652660','东大街','15');return false\" onFocus=\"this.blur()\">东大街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.078703','30.657831','春熙路','15');return false\" onFocus=\"this.blur()\">春熙路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('104.075946','30.633569','磨子桥','15');return false\" onFocus=\"this.blur()\">磨子桥</a>";
		tophtml = "* 中心位置支持首字母查询，春熙路可输入“cxl”"
	} else if ($.trim(cityName) == "重庆") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('106.480385','29.561956','石门大桥','15');return false\" onFocus=\"this.blur()\">石门大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.57706','29.557252','解放碑','15');return false\" onFocus=\"this.blur()\">解放碑</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.541044','29.562082','重庆嘉陵江大桥','15');return false\" onFocus=\"this.blur()\">重庆嘉陵江大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.584914','29.603648','大佛寺长江大桥','14');return false\" onFocus=\"this.blur()\">大佛寺长江大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.550839','29.54083','菜园坝长江大桥','15');return false\" onFocus=\"this.blur()\">菜园坝长江大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.532418','29.520582','鹅公岩长江大桥','15');return false\" onFocus=\"this.blur()\">鹅公岩长江大桥</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.567774','29.528065','江南大道','14');return false\" onFocus=\"this.blur()\">江南大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.568917','29.548848','长江滨江路','14');return false\" onFocus=\"this.blur()\">长江滨江路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.564151','29.563458','嘉陵江滨江路','14');return false\" onFocus=\"this.blur()\">嘉陵江滨江路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('106.593124','29.554623','南滨路','13');return false\" onFocus=\"this.blur()\">南滨路</a>";
		tophtml = "* 中心位置支持首字母查询，解放碑可输入“jfb”"
	} else if ($.trim(cityName) == "深圳") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('114.028033','22.536907','深南大道','13');return false\" onFocus=\"this.blur()\">深南大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.004695','22.553133','北环大道','13');return false\" onFocus=\"this.blur()\">北环大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('113.971291','22.520012','滨海大道','14');return false\" onFocus=\"this.blur()\">滨海大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.086312','22.555719','笋岗西路','14');return false\" onFocus=\"this.blur()\">笋岗西路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.076879','22.548565','红荔路','14');return false\" onFocus=\"this.blur()\">红荔路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.072990','22.536491','皇岗路','14');return false\" onFocus=\"this.blur()\">皇岗路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.083185','22.551091','华富路','15');return false\" onFocus=\"this.blur()\">华富路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.086798','22.546605','华强北路','15');return false\" onFocus=\"this.blur()\">华强北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.067582','22.549962','彩田路','14');return false\" onFocus=\"this.blur()\">彩田路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.049311','22.536798','新洲路','14');return false\" onFocus=\"this.blur()\">新洲路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.025522','22.544923','香蜜湖路','15');return false\" onFocus=\"this.blur()\">香蜜湖路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('113.723651','22.819480','广深高速','12');return false\" onFocus=\"this.blur()\">广深高速</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('113.824606','22.646972','宝安大道','14');return false\" onFocus=\"this.blur()\">宝安大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('113.924325','22.535524','南山大道','14');return false\" onFocus=\"this.blur()\">南山大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('114.117179','22.532442','深圳火车站','15');return false\" onFocus=\"this.blur()\">深圳火车站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('113.980553','22.539562','欢乐谷','12');return false\" onFocus=\"this.blur()\">欢乐谷</a>";
		tophtml = "* 中心位置支持首字母查询，深南大道可输入“sndd”"
	} else if ($.trim(cityName) == "天津") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('117.175627','39.074144','奥林匹克','12');return false\" onFocus=\"this.blur()\">奥林匹克</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.201725','39.158293','十八街麻花','15');return false\" onFocus=\"this.blur()\">十八街麻花</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.170048','39.087636','水上乐园','12');return false\" onFocus=\"this.blur()\">水上乐园</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.274246','40.106174','小盘山','12');return false\" onFocus=\"this.blur()\">小盘山</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.209916','39.135836','天津火车站','15');return false\" onFocus=\"this.blur()\">天津火车站</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.445403','40.243993','黄崖关长城','14');return false\" onFocus=\"this.blur()\">黄崖关长城</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.235451','39.068780','解放南路','14');return false\" onFocus=\"this.blur()\">解放南路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.243004','39.086637','大沽南路','15');return false\" onFocus=\"this.blur()\">大沽南路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.146949','39.098261','复康路','14');return false\" onFocus=\"this.blur()\">复康路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.077351','39.150497','西青道','14');return false\" onFocus=\"this.blur()\">西青道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('116.975555','39.581878','京津快速路','10');return false\" onFocus=\"this.blur()\">京津快速路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.250385','39.184103','金钟河大街','14');return false\" onFocus=\"this.blur()\">金钟河大街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.428656','39.052918','津塘公路','14');return false\" onFocus=\"this.blur()\">津塘公路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('117.175101','39.089535','水上公园东路','15');return false\" onFocus=\"this.blur()\">水上公园东路</a>";
		tophtml = "* 中心位置支持首字母查询，大沽南路可输入“dgnl”"
	} else if ($.trim(cityName) == "常州") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('119.998598','31.826022','中华恐龙园','14');return false\" onFocus=\"this.blur()\">中华恐龙园</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.415293','31.292377','天目湖','11');return false\" onFocus=\"this.blur()\">天目湖</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.920964','31.696843','春秋淹城','15');return false\" onFocus=\"this.blur()\">春秋淹城</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.969888','31.774987','天宁寺','13');return false\" onFocus=\"this.blur()\">天宁寺</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.978685','31.765574','东坡公园','15');return false\" onFocus=\"this.blur()\">东坡公园</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.953837','31.794577','万福路','13');return false\" onFocus=\"this.blur()\">万福路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.989436','31.828164','汉江路','15');return false\" onFocus=\"this.blur()\">汉江路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.946928','31.772944','劳动西路','13');return false\" onFocus=\"this.blur()\">劳动西路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.943892','31.760748','迎宾路','15');return false\" onFocus=\"this.blur()\">迎宾路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.931908','31.778307','怀德中路','13');return false\" onFocus=\"this.blur()\">怀德中路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.945297','31.758787','兰陵北路','15');return false\" onFocus=\"this.blur()\">兰陵北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.950072','31.697464','延政中路','15');return false\" onFocus=\"this.blur()\">延政中路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.989157','31.748131','中吴大道','13');return false\" onFocus=\"this.blur()\">中吴大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.970531','31.949395','长江路','15');return false\" onFocus=\"this.blur()\">长江路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('119.912767','31.669381','淹城路','13');return false\" onFocus=\"this.blur()\">淹城路</a>";
		tophtml = "* 中心位置支持首字母查询，天目湖可输入“tmh”"
	} else if ($.trim(cityName) == "大连") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('121.716886','39.014349','金石滩','12');return false\" onFocus=\"this.blur()\">金石滩</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.588011','38.882314','星海广场','13');return false\" onFocus=\"this.blur()\">星海广场</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.788340','39.090767','大黑山风景区','12');return false\" onFocus=\"this.blur()\">大黑山风景区</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.635110','38.911072','大连劳动公园','15');return false\" onFocus=\"this.blur()\">大连劳动公园</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.706779','38.911472','海之韵广场','13');return false\" onFocus=\"this.blur()\">海之韵广场</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('122.925296','40.045752','冰峪沟风景区','12');return false\" onFocus=\"this.blur()\">冰峪沟风景区</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.652432','38.923885','人民路','13');return false\" onFocus=\"this.blur()\">人民路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.589261','38.901713','中山路','13');return false\" onFocus=\"this.blur()\">中山路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.554558','38.955438','迎客路','13');return false\" onFocus=\"this.blur()\">迎客路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.726810','39.099381','解放路','13');return false\" onFocus=\"this.blur()\">解放路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.569890','38.983565','华北路','13');return false\" onFocus=\"this.blur()\">华北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.553518','38.969403','松江路','13');return false\" onFocus=\"this.blur()\">松江路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('121.600907','38.979312','东北路','10');return false\" onFocus=\"this.blur()\">东北路</a>";
		tophtml = "* 中心位置支持首字母查询，人民路可输入“rml”"
	} else if ($.trim(cityName) == "南京") {
		pupoHTML = "<a href=\"void(0)\" onClick=\"pupoAddPointMap('118.616037','32.030017','纬三路','15');return false\" onFocus=\"this.blur()\">纬三路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.768644','32.054936','汉口西路','15');return false\" onFocus=\"this.blur()\">汉口西路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.831338','32.029446','苜蓿园大街','13');return false\" onFocus=\"this.blur()\">苜蓿园大街</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.847651','32.009786','石杨路','15');return false\" onFocus=\"this.blur()\">石杨路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.764653','32.077175','中山北路','13');return false\" onFocus=\"this.blur()\">中山北路</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.719152','32.032527','扬子江大道','13');return false\" onFocus=\"this.blur()\">扬子江大道</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.744783','32.092046','南京市静海寺纪念馆','13');return false\" onFocus=\"this.blur()\">南京市静海寺纪念馆</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.802290','32.065738','玄武湖','12');return false\" onFocus=\"this.blur()\">玄武湖</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.832502','32.066792','紫金山天文台','12');return false\" onFocus=\"this.blur()\">紫金山天文台</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.818002','32.042100','明故宫遗址公园','15');return false\" onFocus=\"this.blur()\">明故宫遗址公园</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.724431','31.772059','上国安寺','13');return false\" onFocus=\"this.blur()\">上国安寺</a>  <a href=\"void(0)\" onClick=\"pupoAddPointMap('118.824552','32.040013','南京博物院','14');return false\" onFocus=\"this.blur()\">南京博物院</a>";
		tophtml = "* 中心位置支持首字母查询，南京博物院可输入“njbwg”"
	}
	var h = pupoHTML, allh = "<div style=\"padding:10px; line-height:25px; width:290px;\">"
			+ tophtml
			+ "<br><br><span style=\"font-size:14px;\">路况热点：</span><br>"
			+ h
			+ "</div>";
	sr.html(allh);
	sr = null;
}
// ---------地图操作
function addRoadMap() {
	var splat = [], splon = [], coords = roadPointInfo[golRoadId].length;
	if (coords > 0) {
		for ( var i = 0; i < coords; i++) {
			var slat = roadPointInfo[golRoadId][i].roadWKT;
			if (slat != null && slat.length > 0) {
				if (slat.indexOf(";")) {
					var c = slat.split(";");
					if (c.length > 0) {
						for ( var j = 0; j < c.length; j++) {
							var coor = c[j].split(",");
							splat.push(coor[0]);
							splon.push(coor[1])
						}
					} else {
						var coords = c[j].split(",");
						splat.push(coor[0]);
						splon.push(coor[1])
					}
				}
			}
		}
		var la = splat.sort(), lo = splon.sort(), zxlat = (parseFloat(la[0]) + parseFloat(la[la.length - 1])) / 2, zxlon = (parseFloat(lo[0]) + parseFloat(lo[lo.length - 1])) / 2;
		var endCoords = zxlat + "," + zxlon;
		var point = new MctfoPointObject();
		point.coord = endCoords;
		mapObj.addPoint(point);
		mapObj.setViewAdjustType("auto");
		mapObj.removePoint(point.serial_id);
		alert('f');
	}
}
function trafficPoly(coords, type) {
	addPoly(coords, type);
}
function addPoly(coords, type) {
	//initMap(TGCC); //初始化地图
	mapObj.removeTraffic();
	mapObj.addTraffic();
	mapObj.removeAllPoly();
	var poly = new MctfoPolyObject;
	poly.serial_id = new Date().valueOf() + Math.random() * 1000;
	poly.coord = coords;
	poly.polyStyle.polyType = "polyline";
	poly.polyStyle.showTip = true;
	poly.polyStyle.lineWeight = 5;
	poly.polyStyle.lineColor = "#6600FF";
	poly.polyStyle.lineOpacity = 0.5;
	if (type == 1) {
		poly.polyStyle.strokeEndarrow = "Block"
	} else if (type == 0) {
		poly.polyStyle.strokeStartarrow = "Block"
	}
	mapObj.addPoly(poly);
	mapObj.setViewAdjustType("auto");
}
var poiPointMap = {};// 储存poi点对象
function mapAddPoint(info, imagenumber) {
	var name = info.poiName == null || info.poiName == "" ? "" : info.poiName, city = info.province == null
			|| info.province.length <= 0 ? "" : info.province, address = info.address == null
			|| info.address.length <= 0 ? "" : info.address, tel = info.tel == null
			|| info.tel.length <= 0 ? "" : info.tel;
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + info.id;
	aTipStyle.tipHeight = "100";
	aTipStyle.tipTemplate = "<div align='left'>城市：<tipcont>" + city
			+ "</tipcont></div><br><div align='left'>名称：<tipcont>" + name
			+ "</tipcont></div><br><div align='left'>电话：<tipcont>" + tel
			+ "</tipcont></div><br><div align='left'>地址：<tipcont>" + address
			+ "</tipcont></div><br><div align='left'></div>";
	mapObj.addTipStyle(aTipStyle);
	var center = info.lon + "," + info.lat, image = "images/map/mapto_"
			+ imagenumber + ".png", tid = "tipStylePalmcity" + info.id;
	var point = commonmaps(info.id, center, image, 24, 38, tid);
	mapObj.addPoint(point);
	mapObj.setViewAdjustType("auto");
	poiPointMap[point.serial_id] = point;
}
var mapStartPoint = 0;// 地图路线起点定位
var mapEndPoint = 0;// 地图路线终点定位
function addPointInRoute(id, lat, lon, name, city, type) {
	var img = '', typeName = '';
	if (type == "start") {
		img = "images/map/qidian.png";
		typeName = "起点";
		if (mapStartPoint != 0) {
			mapObj.removePoint(mapStartPoint + type)
		}
		mapStartPoint = id
	} else if (type == "end") {
		img = "images/map/zhongdian.png";
		typeName = "终点";
		if (mapEndPoint != 0) {
			mapObj.removePoint(mapEndPoint + type)
		}
		mapEndPoint = id
	}
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + id + type;
	aTipStyle.tipHeight = "60";
	aTipStyle.tipTemplate = "<div align='left'>城市：<tipcont>" + city
			+ "</tipcont></div><br><div align='left'>" + typeName
			+ "：<tipcont>" + name + "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle);
	var center = lon + "," + lat, tid = "tipStylePalmcity" + id + type;
	var point = commonmaps(id + type, center, img, 19, 19, tid);
	mapObj.addPoint(point);
	mapObj.setViewAdjustType("auto");
	poiPointMap[point.serial_id] = point;
}
function addPointInRouteType(type, name, lat, lon) {
	var img = '';
	if (type == "start") {
		img = "images/map/qidian.png"
	} else {
		img = "images/map/zhongdian.png"
	}
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + lat + type;
	aTipStyle.tipHeight = "60";
	aTipStyle.tipTemplate = "<div align='left'>城市：<tipcont>" + mapcity
			+ "</tipcont></div><br><div align='left'>起点：<tipcont>" + name
			+ "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle);
	var center = lon + "," + lat, mid = "Point_"
			+ (new Date().valueOf() + "" + Math.random() * 10000), tid = "tipStylePalmcity"
			+ lat + type;
	var start = commonmaps(mid, center, img, 19, 19, tid);
	mapObj.addPoint(start);
	mapObj.setViewAdjustType("auto");
	poiPointMap[start.serial_id] = type;
}
function movePoint() {
	clearInterval();
	var firstcoord = movePointInfo[0];
	var point = buildPoint(firstcoord);
	if (point != null && point != undefined) {
		mapObj.addPoint(point);
		var pointid = point.serial_id;
		var index = 0;
		setInterval( function() {
			var xy = movePointInfo[index];
			if (xy.indexOf(",") != -1) {
				mapObj.movePoint(pointid, xy)
			}
			index++;
			if (index == (movePointInfo.length - 1)) {
				index = 0
			}
		}, 50);
	}
}
function buildPoint(coord) {
	var point = new MctfoPointObject();
	point.serial_id = new Date().valueOf() + "" + Math.random() * 10000;
	point.coord = coord;
	point.pointStyle.hasIcon = true;
	point.pointStyle.showLabel = false;
	point.pointStyle.iconURL = "images/map/star.gif";
	point.pointStyle.size.iconWidth = 14;
	point.pointStyle.size.iconHeight = 14;
	point.pointStyle.offset.iconX = 0;
	point.pointStyle.offset.iconY = 0;
	point.pointStyle.offset.infoWindowX = 28;
	point.pointStyle.offset.infoWindowY = 0;
	point.pointStyle.offset.labelX = 20;
	point.pointStyle.offset.labelY = 20;
	return point;
}
function openPoiTip(id) {
	var point = poiPointMap[id];
	if (point != null && point != undefined) {
		mapObj.openInfoWindow("point", id);
	}
}
function onClickPOI(mapId, pointId) {
	mapObj.openInfoWindow("point", pointId);
}
function resetaddPoly(coords, resetId) {
	var poly = new MctfoPolyObject;
	poly.serial_id = resetId;
	poly.coord = coords;
	poly.polyStyle.polyType = "polyline";
	poly.polyStyle.showTip = true;
	poly.polyStyle.lineWeight = 6;
	poly.polyStyle.lineColor = "#FF0000";
	poly.polyStyle.lineOpacity = 1;
	mapObj.addPoly(poly);
}
function commonAddPoint(id) {
	var e = eventexplain[id], coords = e.situation, eid = "events" + e.eventId, message = e.content, img = "", cityName = codeOnCityName(e.cityCode), startTime = e.startTime == null
			|| e.startTime == "" ? "" : e.startTime, endTime = e.endTime == null
			|| e.endTime == "" ? "" : e.endTime, address = e.address == null
			|| e.address.length < 0 ? "" : e.address, etype = e.eventsType;
	if (etype == 1) {
		img = "images/map/roadConstruct.png"
	} else if (etype == 2) {
		img = "images/map/trafficContol.png"
	} else if (etype == 3) {
		img = "images/map/trafficAccident.png"
	} else {
		img = "images/map/other.png"
	}
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + eid;
	if (message.length > 150) {
		message = message.substring(0, 150)
	}
	var tiph = 90;
	if (message.length >= 30 && message.length < 60) {
		tiph = 110
	} else if (message.length >= 60 && message.length < 90) {
		tiph = 130
	} else if (message.length >= 90 && message.length < 120) {
		tiph = 150
	} else if (message.length >= 120 && message.length < 150) {
		tiph = 180
	} else if (message.length >= 150) {
		tiph = 210
	}
	aTipStyle.tipHeight = tiph;
	aTipStyle.tipTemplate = "<div align='left'><img src="
			+ img
			+ " align=\"absmiddle\"/>   标题：<tipcont>"
			+ e.shortTitle
			+ "</tipcont></div><br><div align='left'  style=\"line-height:18px; width:350px;\">内容：<tipcont>"
			+ message + "</tipcont></div><br><div align='left'>时间：<tipcont>"
			+ e.startDate + " " + startTime + "&nbsp;至&nbsp;" + e.endDate + " "
			+ endTime + "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle);
	var tid = "tipStylePalmcity" + eid;
	var point = commonmaps(eid, coords, img, 24, 24, tid);
	mapObj.addPoint(point);
	mapObj.setViewAdjustType("auto");
	poiPointMap[point.serial_id] = point;
}
function parkAddMap(id) {
	var parkname = parkCheckInfo[id].parkingName, lat = parkCheckInfo[id].lat, lon = parkCheckInfo[id].lon, address = parkCheckInfo[id].parkingAddr, totalSpace = parkCheckInfo[id].totalSpace, currentSpace = parkCheckInfo[id].currentSpace, currs = totalSpace
			- currentSpace, parkType = '', bh = (currs / totalSpace) * 100, images = "images/map/park_01.png";
	if (bh > 0 && bh <= 50) {
		parkType = "一级（空）";
		images = "images/map/park_01.png"
	} else if (bh > 50 && bh <= 80) {
		parkType = "二级（中）";
		images = "images/map/park_02.png"
	} else if (bh > 80) {
		parkType = "三级（满）";
		images = "images/map/park_03.png"
	}
	mapObj.removeAllPoint();
	if (lon != null && lon != "null" && lon.length > 0 && lat != null
			&& lat != "null" && lat.length > 0) {
		var aTipStyle = new MctfoTipStyle();
		aTipStyle.tipId = "tipStylePalmcity" + lon;
		aTipStyle.tipHeight = "120";
		aTipStyle.tipTemplate = "<div align='left'>停车场名称：<tipcont>" + parkname
				+ "</tipcont></div><br><div align='left'>停车场地址：<tipcont>"
				+ address
				+ "</tipcont></div><br><div align='left'>空车位：<tipcont>"
				+ currentSpace
				+ "</tipcont></div><br><div align='left'>饱和度：<tipcont>"
				+ parkType + "</tipcont></div>";
		mapObj.addTipStyle(aTipStyle);
		var center = lon + "," + lat, mid = "Point_"
				+ (new Date().valueOf() + "" + Math.random() * 10000), tid = "tipStylePalmcity"
				+ lon;
		var point = commonmaps(mid, center, images, 24, 24, tid);
		mapObj.setMapCenter(center);
		mapObj.addPoint(point);
		mapObj.setViewAdjustType("auto");
		poiPointMap[point.serial_id] = point;
		mapObj.openInfoWindow("point", point.serial_id);
	}
}
function moveCollPoint() {
	clearInterval();
	var firstcoord = collMovePointInfo[0];
	var point = buildPoint(firstcoord);
	if (point != null && point != undefined) {
		mapObj.addPoint(point);
		var pointid = point.serial_id;
		var index = 0;
		setInterval( function() {
			var xy = collMovePointInfo[index];
			if (xy.indexOf(",") != -1) {
				mapObj.movePoint(pointid, xy)
			}
			index++;
			if (index == (collMovePointInfo.length - 1)) {
				index = 0
			}
		}, 50);
	}
}
function addCollPointInRoute() {
	mapObj.removeAllPoint();
	var simg = "images/map/qidian.png", eimg = "images/map/zhongdian.png", r = collRouteInfo[routeId], cityName = codeOnCityName(r.city), id = r.lineId;
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + id + "start";
	aTipStyle.tipHeight = "60";
	aTipStyle.tipTemplate = "<div align='left'>城市：<tipcont>" + cityName
			+ "</tipcont></div><br><div align='left'>起点：<tipcont>"
			+ r.startName + "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle);
	var center = r.startLon + "," + r.startLat, mid = id + "start", tid = "tipStylePalmcity"
			+ id + "start";
	var start = commonmaps(mid, center, simg, 19, 19, tid);
	mapObj.addPoint(start);
	mapObj.setViewAdjustType("auto");
	collPoiMap[start.serial_id] = start;
	var aTipStyle2 = new MctfoTipStyle();
	aTipStyle2.tipId = "tipStylePalmcity" + id + "end";
	aTipStyle2.tipHeight = "60";
	aTipStyle2.tipTemplate = "<div align='left'>城市：<tipcont>" + cityName
			+ "</tipcont></div><br><div align='left'>终点：<tipcont>" + r.endName
			+ "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle2);
	var center2 = r.endLon + "," + r.endLat, meid = id + "end", teid = "tipStylePalmcity"
			+ id + "end";
	var end = commonmaps(meid, center2, eimg, 19, 19, teid);
	mapObj.addPoint(end);
	mapObj.setViewAdjustType("auto");
	collPoiMap[end.serial_id] = end;
}
function mapAddCollPoint(id, type, selectType) {
	removeMapInfo();
	if (selectType == "poi") {
		var info = collPoiInfo[id], name = info.pointName == null
				|| info.pointName == "" ? "" : info.pointName, city = info.city == null
				|| info.city.length <= 0 ? "" : info.city, cityName = codeOnCityName(info.city), address = info.address == null
				|| info.address.length <= 0 ? "" : info.address, tel = info.tel == null
				|| info.tel.length <= 0 ? "" : info.tel;
		var aTipStyle = new MctfoTipStyle();
		aTipStyle.tipId = "tipStylePalmcity" + id + type;
		aTipStyle.tipHeight = "100";
		aTipStyle.tipTemplate = "<div align='left'>城市：<tipcont>" + cityName
				+ "</tipcont></div><br><div align='left'>名称：<tipcont>" + name
				+ "</tipcont></div><br><div align='left'>电话：<tipcont>" + tel
				+ "</tipcont></div><br><div align='left'>地址：<tipcont>"
				+ address + "</tipcont></div><br><div align='left'></div>";
		mapObj.addTipStyle(aTipStyle);
		var center = info.lon + "," + info.lat, mid = type + id, tid = "tipStylePalmcity"
				+ id + type, img = "images/map/1_red.png";
		var point = commonmaps(mid, center, img, 24, 38, tid);
		mapObj.addPoint(point);
		mapObj.setViewAdjustType("auto");
		collPoiMap[point.serial_id] = point;
		openCollPoiTip(point.serial_id)
	} else if (selectType == "road") {
		var roadWKT = collPoiInfo[id].roadWKT;
		var collsplat = [];
		var collsplon = [];
		if (roadWKT != null && roadWKT != "") {
			if (roadWKT.indexOf(";")) {
				var c = roadWKT.split(";");
				for ( var i = 0; i < c.length - 1; i++) {
					var coords = c[i].split(",");
					collsplat.push(coords[0]);
					collsplon.push(coords[1])
				}
			}
			var la = collsplat.sort();
			var lo = collsplon.sort();
			var zxlat = (parseFloat(la[0]) + parseFloat(la[la.length - 1])) / 2;
			var zxlon = (parseFloat(lo[0]) + parseFloat(lo[lo.length - 1])) / 2;
			var endCoords = zxlat + "," + zxlon;
			var point = new MctfoPointObject();
			point.coord = endCoords;
			mapObj.addPoint(point);
			mapObj.setViewAdjustType("auto");
			mapObj.removePoint(point.serial_id);
		}
	}
}
function openCollPoiTip(id) {
	mapObj.openInfoWindow("point", id);
}
function pupoAddPointMap(lon, lat, name, leavl) {
	mapObj.removeAllPoint();
	var aTipStyle = new MctfoTipStyle();
	aTipStyle.tipId = "tipStylePalmcity" + lon;
	aTipStyle.tipHeight = "50";
	aTipStyle.tipTemplate = "<div align='left'>名称：<tipcont>" + name
			+ "</tipcont></div>";
	mapObj.addTipStyle(aTipStyle);
	var center = lon + "," + lat, mid = "Point_"
			+ (new Date().valueOf() + "" + Math.random() * 10000), tid = "tipStylePalmcity"
			+ lon, img = "images/map/1_red.png";
	var point = commonmaps(mid, center, img, 24, 38, tid);
	mapObj.setMapCenter(center);
	mapObj.addPoint(point);
	mapObj.setMapZoom(leavl);
	poiPointMap[point.serial_id] = point;
	mapObj.openInfoWindow("point", point.serial_id);
}
function commonmaps(id, center, image, imagew, imageh, tipid) {
	var point = new MctfoPointObject();
	point.serial_id = id;
	point.coord = center;
	point.pointStyle.hasIcon = true;
	point.pointStyle.showLabel = false;
	point.pointStyle.iconURL = image;
	point.pointStyle.size.iconWidth = imagew;
	point.pointStyle.size.iconHeight = imageh;
	point.pointStyle.offset.iconX = -7;
	point.pointStyle.offset.iconY = -7;
	point.pointStyle.offset.infoWindowX = 18;
	point.pointStyle.offset.infoWindowY = 5;
	point.pointStyle.offset.labelX = 20;
	point.pointStyle.offset.labelY = 20;
	point.pointStyle.labelContent = "";
	point.pointStyle.mindisscroll = 0;
	point.pointStyle.maxdisscroll = 17;
	point.pointStyle.tipId = tipid;
	return point;
}
function messageCustomize() {
	if (userName != null && userName != "null" && userName.length > 0) {
		if (checkId == 0) {
			var html = "<p style=\"text-align:center; color:#FF0000;\">请选择需要定制的信息</p>";
			AlertMsg('手机定制', html, 250, 200);
			return false
		} else if (checkId > 1) {
			var html = "<p style=\"text-align:center; color:#FF0000;\">目前只支持定制一条信息</p>";
			AlertMsg('手机定制', html, 250, 200);
			return false
		}
		var cm = (mobile == null || mobile == "null") ? "" : mobile;
		var html = "<p class=\"messageCus\">请确认或者输入您的手机号码</p><p class=\"messageCus\">手机号码：<input type=\"text\" name=\"dxmobile\" id=\"dxmobile\" style=\"width:100px; height:14px;\" value='"
				+ cm
				+ "' /><p style=\"margin:10px 0px 3px 0px\"><a href=\"javascript:void(0)\" onclick=\"nextCustomize()\" style=\"text-decoration:underline;\">下一步(点击发送验证至您手机)</a></p><p style=\"color:#ff0000; text-align:center; display:none\" id=\"cusShowInfo\">处理中,请等待...</p>";
		AlertMsg('手机定制', html, 250, 200)
	} else {
		var html = "<p style=\"text-align:center\">请先<a href=\"login.jsp\" style=\"color:#FF0000; text-decoration:underline\">登录</a>，或者<a href=\"register.jsp\" style=\"color:#FF0000; text-decoration:underline\">注册</a></p>";
		AlertMsg('手机定制', html, 250, 200);
	}
}
function nextCustomize() {
	var mob = $('#dxmobile'), m = mob.val(), cs = $('#cusShowInfo');
	if (m != null && m != "" && m.length > 0) {
		if (m.length > 0 && m.length != 11) {
			alert("请输入正确的手机号码");
			return false
		}
		if (isNaN(m)) {
			alert("手机号码为数字，请重新输入");
			return false
		}
	} else {
		alert("请输入手机号码");
		return false
	}
	mobile = m;
	cs.show('slow');
	getYZM(m);
	mob = null;
	cs = null;
}
function getYZM(m) {
	Custom.messCustomize(userName, m, getYZM_do);
}
function getYZM_do(result) {
	var cs = $('#cusShowInfo');
	if (result == "success") {
		var time = "<select name=\"cushour\" id=\"cushour\">";
		var minute = "<select name=\"cusminute\" id=\"cusminute\">";
		for ( var i = 0; i < 24; i++) {
			if (i < 10) {
				time += "<option value=0" + i + ">0" + i + "</option>"
			} else {
				time += "<option value=" + i + ">" + i + "</option>"
			}
		}
		time += "</select>";
		for ( var j = 0; j < 60; j += 10) {
			if (j == 0) {
				minute += "<option value=00>00</option>"
			} else {
				minute += "<option value=" + j + ">" + j + "</option>"
			}
		}
		minute += "</select>";
		var html = "<p class=\"messageCus\">请输入您收到的验证码：</p><p class=\"messageCus\">验证码：<input type=\"text\" name=\"yzmmobile\" id=\"yzmmobile\" style=\"width:100px; height:14px;\" /></p><p class=\"messageCus\">定制时间："
				+ time
				+ "："
				+ minute
				+ "</p><p style=\"margin:10px 0px 3px 0px\"><a href=\"javascript:void(0)\" onclick=\"customizeSub()\" style=\"text-decoration:underline;\">完成</a></p><p style=\"text-align:center; color:#FF0000;display:none\" id=\"cusOpenId\"></p>";
		$('#msgbody').html(html)
	} else if (result == "submit") {
		cs.html('此手机号码已经被定制，请更换其他号码');
		return false
	} else {
		cs.html('操作错误');
		return false
	}
	cs = null;
}
function customizeSub() {
	var message = '', length = collectionMap.size(), mob = $('#yzmmobile'), m = mob
			.val(), hour = $('#cushour'), h = hour.val(), son = $('#cusminute'), s = son
			.val(), time = h + ":" + s;
	if (!$.trim(m)) {
		alert("请输入验证码");
		return false
	}
	if (searchType == "poi") {
		for ( var i = 0; i < length; i++) {
			var c = collectionMap.get(i);
			message += c.lat + "," + c.lon + "," + c.poiName + "," + c.cityCode
		}
		message += "," + m + "," + mobile + "," + time;
		Custom.addCustomize(userName, message, 'poi', addCustomize_do)
	} else if (searchType == "road") {
		var wkt = '';
		for ( var i = 0; i < length; i++) {
			var c = collectionMap.get(i);
			message += c.roadName + "," + c.cityCode
		}
		message += "," + m + "," + mobile + "," + time;
		Custom.addCustomize(userName, message, 'road', addCustomize_do)
	}
	mob = null;
	hour = null;
	son = null;
}
function addCustomize_do(result) {
	var message = "";
	if (result == "subsist") {
		message = "你已经设置了一条定制信息"
	} else if (result == "success") {
		message = nickName + "，你好，您已经成功定制了路况提醒业务，我们会在周一至周五按时给您下发路况信息";
		collectionMap.clear();
		delteSelect();
		checkId = 0
	} else if (result == "fail") {
		message = "信息定制失败"
	} else if (result == "numfail") {
		message = "验证码输入不正确"
	}
	if (result == "success") {
		$('#msgbody').html("<p style=\"color:#FF0000;\">" + message + "</p>")
	} else {
		$('#cusOpenId').show('slow').html(message);
	}
}
var blockOpenyb = 0, cityNameyb = 'bj', timeidyd = '1', xqyb = '1', ybport = '9080';
function chanageTMap(type, time, xqj) {
	var cityName = 'bj';
	switch (TGCC) {
	case "110000":
		cityName = "bj";
		ybport = '9080';
		break;
	case "310000":
		cityName = "sh";
		ybport = '9081';
		break;
	case "510100":
		cityName = "cd";
		ybport = '9084';
		break;
	case "500000":
		cityName = "cq";
		ybport = '9083';
		break;
	case "420100":
		cityName = "wh";
		ybport = '9082';
		break
	}
	var t = convertTime(time);
	if (type == 1) {
		bxsybtraffic(cityName, cityName, t, ybport);
		blockOpenyb = 1;
		timeidyd = t
	} else {
		var xq = convertXQ(xqj);
		if (time == null || time == "") {
			time = 9
		}
		yzybtraffic(cityName, cityName, time, xq, ybport);
		blockOpenyb = 2;
		timeidyd = time;
		xqyb = xq
	}
	cityNameyb = cityName;
}
function inityb() {
	var cityName = 'bj';
	switch (TGCC) {
	case "110000":
		cityName = "bj";
		ybport = '9080';
		break;
	case "310000":
		cityName = "sh";
		ybport = '9081';
		break;
	case "510100":
		cityName = "cd";
		ybport = '9084';
		break;
	case "500000":
		cityName = "cq";
		ybport = '9083';
		break;
	case "420100":
		cityName = "wh";
		ybport = '9082';
		break
	}
	bxsybtraffic(cityName, cityName, 1, ybport);
	timeidyd = 1;
	blockOpenyb = 1;
}
function convertTime(time) {
	var timeType = 1;
	switch (time) {
	case "5":
		timeType = 1;
		break;
	case "10":
		timeType = 2;
		break;
	case "15":
		timeType = 3;
		break;
	case "20":
		timeType = 4;
		break;
	case "25":
		timeType = 5;
		break;
	case "30":
		timeType = 6;
		break
	}
	return timeType;
}
function convertXQ(xq) {
	var xqType = 1;
	switch (xq) {
	case "星期一":
		xqType = 1;
		break;
	case "星期二":
		xqType = 2;
		break;
	case "星期三":
		xqType = 3;
		break;
	case "星期四":
		xqType = 4;
		break;
	case "星期五":
		xqType = 5;
		break;
	case "星期六":
		xqType = 6;
		break;
	case "星期日":
		xqType = 0;
		break;
	case "节假日":
		xqType = 8;
		break
	}
	return xqType;
}
function closeTMap() {
	blockOpenyb = 0;
	var y = $('#ybdiv'), ym = $('#mapybtraffic');
	y.hide();
	ym.attr('src', 'images/lkyb02.gif');
	mapshowybtraffic++;
	$('#maptraffic').show();
	if (mapshowtraffic % 2 == 0) {
		delWms();
		addTrafficToMap(TGCC)
	} else {
		delWms()
	}
	y = null;
	ym = null;
}