var gaoMap;
var gdMap;
var gdMarkers =[];//存放车辆标注点
var jhMarkers =[];
var bz_gdMarkers =[];//存放标注点
var qy_gdMarkers =[];//存放标注点
var latlngArr =[];//追踪页面存放点集合
var tracker = {};
var trafficLayer;//路况图层
var ruler1;//测距
var cluster;
function loadGaoDe(){
	$("#map_canvas").empty();
	if(document.readyState=="complete"){
		gaoMap = new AMap.Map('map_canvas');
	}else{
		setTimeout('loadGaoDe()',500);
		return;
	}
	gaoMap.setZoom(5);
	gaoMap.addControl(new AMap.Scale({visible:true}));//添加比例尺
	gaoMap.addControl(new AMap.ToolBar({visible:true}));//添加工具条
	//实时路况图层
	trafficLayer = new AMap.TileLayer.Traffic({
		zIndex: 10
	});
	trafficLayer.setMap(gaoMap);
	trafficLayer.hide();
	gaoMap.plugin(["AMap.RangingTool"],function(){
		ruler1 = new AMap.RangingTool(gaoMap,{startLabelText:"起点(双击或右键结束)"});
		//ruler1.midLabelText("双击或右键结束测量");
		AMap.event.addListener(ruler1,"end",function(e){
			ruler1.turnOff();
		});
	});

	//输入提示
	var autoOptions = {
			input: "gd_mapsearch_input"
	};
	var auto = new AMap.Autocomplete(autoOptions);
	var placeSearch = new AMap.PlaceSearch({
		map:gaoMap
	});  //构造地点查询类
	AMap.event.addListener(auto,"select",select);//注册监听，当选中某条记录时会触发
	function select(e){
		placeSearch.setCity(e.poi.adcode);
		placeSearch.search(e.poi.name);  //关键字查询查询
	}
	cluster = new AMap.MarkerClusterer(gaoMap,jhMarkers,{gridSize:80});
	cluster.setMaxZoom(13);
	loadPoint();
	GaoDemarkerShowOrHide();
	closeMask();
	gaoMap.on('zoomchange', function(e) {
		//console.info(gaoMap.getZoom());
		if(gaoMap.getZoom()<14){
			gaoMap.clearInfoWindow();
		}
	});
}
//地图上面打点
function loadPoint(){
	gdMarkers = [];
	jhMarkers = [];
	if(num_s ==10 ){
		num_s = getRefreshTime();
		countDown();    //每隔15秒执行函数al
	}

	var obj = getUserStatus();//取用户状态
	if(obj==null){
		var lat=0,lng=0;
		for(i=0;i<carList.data.length;i++){
			try{
				if(carList.data[i].positionLast.blat != 0 &&carList.data[i].positionLast.blng != 0){
					lat = carList.data[i].positionLast.blat;
					lng = carList.data[i].positionLast.blng;
					break;
				}
			}catch(e){
				lat=0;
				lng=0;
			}
		}
		var point = [lng,lat];
		if(lat==0 && lng==0){
			gaoMap.setZoomAndCenter(15,[116.404,39.915]);
		}else{
			gaoMap.setZoomAndCenter(15,point);
		}
	}
//	if(isLargeData==true){
//		return;
//	}

	for(i=0;i<carList.data.length;i++){
		var myLnglat = [carList.data[i].positionLast.lng,carList.data[i].positionLast.lat];
		var s=10;
		var condition=carList.data[i].positionLast.state2;
		var sp = parseInt(carList.data[i].positionLast.speed);
		if (condition != null) {
			if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
				s = 2;
			else {
				if (condition.indexOf("速报警")>=0)
					s = 4;
				else if (condition.indexOf("报警")>=0)
					s = 3;
				else if (sp > 0.5)
					s = 0;
				else
					s = 1;
			}
			if (s != 4 && s != 3 && condition.indexOf("停车")>=0
					&& !condition.indexOf("不在线")>= 0)
			{
				if(condition.indexOf("停车超时")>=0){
					s = 5;	
				}else{
					s = 6;
				}
			}
		}else{
			if (sp > 0.5)
				s = 0;
			else
				s = 1;
		}
		if( carList.data[i].positionLast.av == 0 ){
			s=7;
		}
		var newtime = new Date().getTime();
		var ttime = carList.data[i].positionLast.recvtime.replace("-","/");
		ttime = ttime.replace("-","/");
		ttime = ttime.replace("T"," ");
		var oldtime = new Date(ttime).getTime();
		if(newtime-oldtime > 600000){
			s=2;
		}

		var state =s;
		var pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/red_0.gif";
		if(state == 0) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/green_";
		else if(state == 1) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/red_";
		else if(state == 2) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/gray_";
		else if(state == 3) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/yellow_";
		else if(state == 4) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/pink_";
		else if(state == 5) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/stopalarm";
		else if(state == 7) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/blue_";
		else pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/red_";
		var direction="";
		var t = parseInt(carList.data[i].positionLast.direct);
		if(t>27 && t<=72){
			if(state == 5){
				var image=".gif";
			}else{
				var image="45.gif";
			}
			direction="东北";
		}else if(t>72 && t<=117){
			if(state == 5){
				var image=".gif";
			}else{
				var image="90.gif";
			}

			direction="东";
		}
		else if(t>117 && t<=162){
			if(state == 5){
				var image=".gif";
			}else{
				var image="135.gif";
			}
			direction="东南";
		}
		else if(t>162 && t<=207){
			if(state == 5){
				var image=".gif";
			}else{
				var image="180.gif";
			}
			direction="南";
		}
		else if(t>207 && t<=252){
			if(state == 5){
				var image=".gif";
			}else{
				var image="225.gif";
			}
			direction="西南";
		}
		else if(t>252 && t<=297){
			if(state == 5){
				var image=".gif";
			}else{
				var image="270.gif";
			}
			direction="西";
		}
		else if(t>297 && t<=342){
			if(state == 5){
				var image=".gif";
			}else{
				var image="315.gif";
			}
			direction="西北";
		}
		else {
			if(state == 5){
				var image=".gif";
			}else{
				var image="0.gif";
			}
			direction="北";
		}

		var carname = encodeURI(encodeURI(carList.data[i].vhcCode)); 

		var temp,temp1,temp2,temp3,temp4;
		if(carList.data[i].positionLast.temperature != null && carList.data[i].positionLast.temperature <=127){
			temp=carList.data[i].positionLast.temperature +" ℃";
		}else{
			temp="无效";
		}
		if(carList.data[i].positionLast.temp1 != null && carList.data[i].positionLast.temp1 <=127){
			temp1=carList.data[i].positionLast.temp1 +" ℃";
		}else{
			temp1="无效";
		}
		if(carList.data[i].positionLast.temp2 != null && carList.data[i].positionLast.temp2 <=127){
			temp2=carList.data[i].positionLast.temp2 +" ℃";
		}else{
			temp2="无效";
		}
		if(carList.data[i].positionLast.temp3 != null && carList.data[i].positionLast.temp3 <=127){
			temp3=carList.data[i].positionLast.temp3 +" ℃";
		}else{
			temp3="无效";
		}
		if(carList.data[i].positionLast.temp4 != null && carList.data[i].positionLast.temp4 <=127){
			temp4=carList.data[i].positionLast.temp4 +" ℃";
		}else{
			temp4="无效";
		}
		var WinShowParms = getCurUserWinShowParms();
		var Nhtml =	"<a href='javascript:void(0);' class='map_setting_ico' onclick='setSystemObject.openWin(1);'style='right:25px;'><span></span></a><div id='app_"+carList.data[i].id+"' style='font-weight:normal;'>"
		for ( var ws = 0; ws < WinShowParms.length; ws++){
			if(WinShowParms[ws]==1){
				Nhtml+="<div id='app1_"+carList.data[i].id+"'><b>设备名称：</b>"+carList.data[i].vhcCode+"</br></div>"
			}
			if(WinShowParms[ws]==2){
				Nhtml+="<div id='app2_"+carList.data[i].id+"'><b>服务器时间：</b>"+carList.data[i].positionLast.recvtime+"</br></div>"
			}
			if(WinShowParms[ws]==3){
				Nhtml+="<div id='app3_"+carList.data[i].id+"'><b>速度：</b>"+carList.data[i].positionLast.speed.toFixed(1)+"km/h </br></div>"
			}
			if(WinShowParms[ws]==4){
				Nhtml+="<div id='app4_"+carList.data[i].id+"'><b>方向：</b>"+direction+"</br></div>"
			}
			if(WinShowParms[ws]==5){
				Nhtml+="<div id='app5_"+carList.data[i].id+"'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
			}
			if(WinShowParms[ws]==6){
				Nhtml+="<div id='app6_"+carList.data[i].id+"'><b>油量：</b>"+carList.data[i].positionLast.oilMN1+" L</br></div>"
			}
			if(WinShowParms[ws]==7){
				Nhtml+="<div id='app7_"+carList.data[i].id+"'><b>当日里程：</b>"+carList.data[i].positionLast.distance+" km</br></div>"
			}
			if(WinShowParms[ws]==8){
				Nhtml+="<div id='app8_"+carList.data[i].id+"'><b>总里程：</b>"+carList.data[i].positionLast.totalDistance+" km</br></div>"
			}
			if(WinShowParms[ws]==9){
				Nhtml+="<div id='app9_"+carList.data[i].id+"'><b>状态：</b>"+carList.data[i].positionLast.state2+"</br></div>"
			}
			if(WinShowParms[ws]==10){
				Nhtml+="<div id='app10_"+carList.data[i].id+"'><b>位置：</b>"+carList.data[i].positionLast.memo+"</br></div>"
			}
			if(WinShowParms[ws]==11 && eqVisualPower.sim){
				Nhtml+="<div id='app11_"+carList.data[i].id+"'><b>SIM卡号：</b>"+carList.data[i].simCode+"</br></div>"
			}
			if(WinShowParms[ws]==12){
				Nhtml+="<div id='app12_"+carList.data[i].id+"'><b>GPS时间：</b>"+carList.data[i].positionLast.gpstime+"</br></div>"
			}
			if(WinShowParms[ws]==13){
				Nhtml+="<div id='app13_"+carList.data[i].id+"'><b>OBD/CAN数据：</b><a href='javascript:opobd("+carList.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
			}
			if(WinShowParms[ws]==14 && eqVisualPower.remark){
				Nhtml+="<div id='app14_"+carList.data[i].id+"'><b>备注：</b>"+carList.data[i].remark+"</br></div>"
			}
			if(WinShowParms[ws]==15){
				Nhtml+="<div id='app15_"+carList.data[i].id+"'><b>经纬度：</b>"+carList.data[i].positionLast.lng+","+carList.data[i].positionLast.lat+"</br></div>"
			}
			if(WinShowParms[ws]==16){
				Nhtml+="<div id='app16_"+carList.data[i].id+"'><b>到期时间：</b>"+(carList.data[i].overduetime != null && carList.data[i].overduetime.indexOf("19") != 0 ? carList.data[i].overduetime:"")+"</br></div>"
			}
			if(WinShowParms[ws]==17){
				Nhtml+="<div id='app17_"+carList.data[i].id+"'><b>启用时间：</b>"+(carList.data[i].posavtime != null && carList.data[i].posavtime.indexOf("19") != 0 ? carList.data[i].posavtime :"")+"</br></div>"
			}
			if(WinShowParms[ws]==18 && eqVisualPower.gprs){
				Nhtml+="<div id='app18_"+carList.data[i].id+"'><b>设备ID：</b>"+carList.data[i].gprsCode+"</br></div>"
			}
			if(WinShowParms[ws]==19){
				Nhtml+="<div id='app19_"+carList.data[i].id+"'><b>备注2：</b>"+carList.data[i].remark2+"</br></div>"
			}
		}
		//Nhtml+="<a href='javascript:streeViewObject.open("+carList.data[i].id+","+carList.data[i].positionLast.blat+","+carList.data[i].positionLast.blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+carList.data[i].id+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='gpsonline/jsp/monitor/playBack.jsp?carid="+carList.data[i].id+"&carname="+carname+"&icon="+carList.data[i].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+carList.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+carList.data[i].id+");\" >刷新位置</font> | </a><a id='sim_"+carList.data[i].simCode+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+carList.data[i].simCode+");\">SIM </font> | </a> <a id='more_"+carList.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
		
		Nhtml+="<a href='javascript:streeViewObject.open("+carList.data[i].id+","+carList.data[i].positionLast.blat+","+carList.data[i].positionLast.blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+carList.data[i].id+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a>";
		if(eqVisualPower.play)Nhtml+="<a id='play_"+carList.data[i].id+"' href='gpsonline/jsp/monitor/playBack.jsp?carid="+carList.data[i].id+"&carname="+carname+"&icon="+carList.data[i].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a>";
		Nhtml+="<a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+carList.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+carList.data[i].id+");\" >刷新位置</font> | </a>";
		if(eqVisualPower.sim)Nhtml+="<a id='sim_"+carList.data[i].id+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+carList.data[i].simCode+");\">SIM </font> | </a>";
		Nhtml+="<a id='more_"+carList.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
		
		var infoWindow = new AMap.InfoWindow({
			content: Nhtml,
			offset: new AMap.Pixel(1,-10)
		});

		var icon_size = real(carList.data[i].icon);
		//自定义图标
		var cyIcon= new AMap.Icon({
			size: new AMap.Size(icon_size,icon_size),  //图标大小
			image: pngicon+image
		});
		var marker = new AMap.Marker({
			icon : cyIcon,//自定义图标
			position : myLnglat,//位置
			offset : new AMap.Pixel(-15,-15),//偏移量
			map :gaoMap //地图
		});
		cluster.addMarker(marker);
		var label = {//label默认蓝框白底左上角显示，样式className为：amap-marker-label
				offset: new AMap.Pixel(20,2),//修改label相对于maker的位置
				content:carList.data[i].vhcCode +"("+carList.data[i].positionLast.speed.toFixed(1)+"km/h)"
		};
		var markerManage = new Object();
		markerManage.id = carList.data[i].id;
		markerManage.vhcCode = carList.data[i].vhcCode;
		markerManage.gprs = carList.data[i].gprsCode;
		markerManage.marker = marker;
		markerManage.label = label;
		markerManage.remark = carList.data[i].remark;
		markerManage.remark2 = carList.data[i].remark2;
		markerManage.icon = carList.data[i].icon;
		markerManage.simCode = carList.data[i].simCode;
		markerManage.infoWindow = infoWindow;
		markerManage.myLnglat = myLnglat;
		gdMarkers.push(markerManage);
		if( namekg == false){
			marker.setLabel(label);
		}else{
			marker.setLabel(null);
		}
		marker.zIndex = i;
		//marker.position = myLnglat;
		AMap.event.addListener(marker,'click',function(e){
			var WinShowParms = getCurUserWinShowParms();
			var Nhtml = "";
			for ( var j = 0; j < carList.data.length; j++){
				if(j==e.target.zIndex){
					gdMarkers[j].infoWindow.open(gaoMap,gdMarkers[j].myLnglat);
				}
			}
		});
	}
}
function centerGaoDeMap(data){
	if(isLargeData==true){
		var myLnglat = [data.data[0].positionLast.lng,data.data[0].positionLast.lat];
		gaoMap.setZoomAndCenter(14,myLnglat);
		var s=10;
		var condition=data.data[0].positionLast.state2;
		var sp = parseInt(data.data[0].positionLast.speed);
		if(condition != null){
			if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
				s = 2;
			else{
				if (condition.indexOf("速报警")>=0)
					s = 4;
				else if (condition.indexOf("报警")>=0)
					s = 3;
				else if (sp > 0.5)
					s = 0;
				else
					s = 1;
			}
			if (s != 4 && s != 3 && condition.indexOf("停车")>=0
					&& !condition.indexOf("不在线")>= 0)
			{
				if(condition.indexOf("停车超时")>=0){
					s = 5;	
				}else{
					s = 6;
				}
			}
		}else{
			if (sp > 0.5)
				s = 0;
			else
				s = 1;
		}
		if( data.data[0].positionLast.av == 0 ){
			s=7;
		}
		var newtime = new Date().getTime();
		var ttime = data.data[0].positionLast.recvtime.replace("-","/");
		ttime = ttime.replace("-","/");
		ttime = ttime.replace("T"," ");
		var oldtime = new Date(ttime).getTime();
		if(newtime-oldtime > 600000){
			s=2;
		}

		var state =s;
		var pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_0.gif";
		if(state == 0) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/green_";
		else if(state == 1) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_";
		else if(state == 2) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/gray_";
		else if(state == 3) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/yellow_";
		else if(state == 4) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/pink_";
		else if(state == 5) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/stopalarm";
		else if(state == 7) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/blue_";
		else pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_";
		var direction="";
		var t = parseInt(data.data[0].positionLast.direct);
		if(t>27 && t<=72){
			if(state == 5){
				var image=".gif";
			}else{
				var image="45.gif";
			}
			direction="东北";
		}else if(t>72 && t<=117){
			if(state == 5){
				var image=".gif";
			}else{
				var image="90.gif";
			}

			direction="东";
		}
		else if(t>117 && t<=162){
			if(state == 5){
				var image=".gif";
			}else{
				var image="135.gif";
			}
			direction="东南";
		}
		else if(t>162 && t<=207){
			if(state == 5){
				var image=".gif";
			}else{
				var image="180.gif";
			}
			direction="南";
		}
		else if(t>207 && t<=252){
			if(state == 5){
				var image=".gif";
			}else{
				var image="225.gif";
			}
			direction="西南";
		}
		else if(t>252 && t<=297){
			if(state == 5){
				var image=".gif";
			}else{
				var image="270.gif";
			}
			direction="西";
		}
		else if(t>297 && t<=342){
			if(state == 5){
				var image=".gif";
			}else{
				var image="315.gif";
			}
			direction="西北";
		}
		else {
			if(state == 5){
				var image=".gif";
			}else{
				var image="0.gif";
			}
			direction="北";
		}

		var carname = encodeURI(encodeURI(data.data[0].vhcCode)); 

		var temp,temp1,temp2,temp3,temp4;
		if(data.data[0].positionLast.temperature != null && data.data[0].positionLast.temperature <=127){
			temp=data.data[0].positionLast.temperature +" ℃";
		}else{
			temp="无效";
		}
		if(data.data[0].positionLast.temp1 != null && data.data[0].positionLast.temp1 <=127){
			temp1=data.data[0].positionLast.temp1 +" ℃";
		}else{
			temp1="无效";
		}
		if(data.data[0].positionLast.temp2 != null && data.data[0].positionLast.temp2 <=127){
			temp2=data.data[0].positionLast.temp2 +" ℃";
		}else{
			temp2="无效";
		}
		if(data.data[0].positionLast.temp3 != null && data.data[0].positionLast.temp3 <=127){
			temp3=data.data[0].positionLast.temp3 +" ℃";
		}else{
			temp3="无效";
		}
		if(data.data[0].positionLast.temp4 != null && data.data[0].positionLast.temp4 <=127){
			temp4=data.data[0].positionLast.temp4 +" ℃";
		}else{
			temp4="无效";
		}
		var icon_size=real(data.data[0].icon);
		//自定义图标
		var cyIcon= new AMap.Icon({
			size: new AMap.Size(icon_size,icon_size),  //图标大小
			image: pngicon+image
		});
		var WinShowParms = getCurUserWinShowParms();
		var Nhtml =	"<a href='javascript:void(0);' class='map_setting_ico' onclick='setSystemObject.openWin(1);'style='right:25px;'><span></span></a><div id='app_"+data.data[0].id+"' style='font-weight:normal;'>"
		for ( var ws = 0; ws < WinShowParms.length; ws++){
			if(WinShowParms[ws]==1){
				Nhtml+="<div id='app1_"+data.data[0].id+"'><b>设备名称：</b>"+data.data[0].vhcCode+"</br></div>"
			}
			if(WinShowParms[ws]==2){
				Nhtml+="<div id='app2_"+data.data[0].id+"'><b>服务器时间：</b>"+data.data[0].positionLast.recvtime+"</br></div>"
			}
			if(WinShowParms[ws]==3){
				Nhtml+="<div id='app3_"+data.data[0].id+"'><b>速度：</b>"+data.data[0].positionLast.speed.toFixed(1)+"km/h </br></div>"
			}
			if(WinShowParms[ws]==4){
				Nhtml+="<div id='app4_"+data.data[0].id+"'><b>方向：</b>"+direction+"</br></div>"
			}
			if(WinShowParms[ws]==5){
				Nhtml+="<div id='app5_"+data.data[0].id+"'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
			}
			if(WinShowParms[ws]==6){
				Nhtml+="<div id='app6_"+data.data[0].id+"'><b>油量：</b>"+data.data[0].positionLast.oilMN1+" L</br></div>"
			}
			if(WinShowParms[ws]==7){
				Nhtml+="<div id='app7_"+data.data[0].id+"'><b>当日里程：</b>"+data.data[0].positionLast.distance+" km</br></div>"
			}
			if(WinShowParms[ws]==8){
				Nhtml+="<div id='app8_"+data.data[0].id+"'><b>总里程：</b>"+data.data[0].positionLast.totalDistance+" km</br></div>"
			}
			if(WinShowParms[ws]==9){
				Nhtml+="<div id='app9_"+data.data[0].id+"'><b>状态：</b>"+data.data[0].positionLast.state2+"</br></div>"
			}
			if(WinShowParms[ws]==10){
				Nhtml+="<div id='app10_"+data.data[0].id+"'><b>位置：</b>"+data.data[0].positionLast.memo+"</br></div>"
			}
			if(WinShowParms[ws]==11 && eqVisualPower.sim){
				Nhtml+="<div id='app11_"+data.data[0].id+"'><b>SIM卡号：</b>"+data.data[0].simCode+"</br></div>"
			}
			if(WinShowParms[ws]==12){
				Nhtml+="<div id='app12_"+data.data[0].id+"'><b>GPS时间：</b>"+data.data[0].positionLast.gpstime+"</br></div>"
			}
			if(WinShowParms[ws]==13){
				Nhtml+="<div id='app13_"+data.data[0].id+"'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[0].id+");'><font color='#0000FF'>详细</font></a></br></div>"
			}
			if(WinShowParms[ws]==14 && eqVisualPower.remark){
				Nhtml+="<div id='app14_"+data.data[0].id+"'><b>备注：</b>"+data.data[0].remark+"</br></div>"
			}
			if(WinShowParms[ws]==15){
				Nhtml+="<div id='app15_"+data.data[0].id+"'><b>经纬度：</b>"+data.data[0].positionLast.lng+","+data.data[0].positionLast.lat+"</br></div>"
			}
			if(WinShowParms[ws]==16){
				Nhtml+="<div id='app16_"+data.data[0].id+"'><b>到期时间：</b>"+(data.data[0].overduetime != null && data.data[0].overduetime.indexOf("19") != 0 ? data.data[0].overduetime:"")+"</br></div>"
			}
			if(WinShowParms[ws]==17){
				Nhtml+="<div id='app17_"+data.data[0].id+"'><b>启用时间：</b>"+(data.data[0].posavtime != null && data.data[0].posavtime.indexOf("19") != 0 ? data.data[0].posavtime :"")+"</br></div>"
			}
			if(WinShowParms[ws]==18 && eqVisualPower.gprs){
				Nhtml+="<div id='app18_"+data.data[0].id+"'><b>设备ID：</b>"+data.data[0].gprsCode+"</br></div>"
			}
			if(WinShowParms[ws]==19){
				Nhtml+="<div id='app19_"+data.data[0].id+"'><b>备注2：</b>"+data.data[0].remark2+"</br></div>"
			}
		}
		//Nhtml+="<a href='javascript:streeViewObject.open("+data.data[0].id+","+data.data[0].positionLast.blat+","+data.data[0].positionLast.blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+data.data[0].id+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[0].id+"&carname="+carname+"&icon="+data.data[0].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[0].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[0].id+");\" >刷新位置</font> | </a><a id='sim_"+data.data[0].simCode+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+data.data[0].simCode+");\">SIM </font> | </a> <a id='more_"+data.data[0].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
		Nhtml+="<a href='javascript:streeViewObject.open("+data.data[0].id+","+data.data[0].positionLast.blat+","+data.data[0].positionLast.blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+data.data[0].id+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a>";
		if(eqVisualPower.play)Nhtml+="<a id='play_"+data.data[0].id+"' href='gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[0].id+"&carname="+carname+"&icon="+data.data[0].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a>";
		Nhtml+="<a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[0].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[0].id+");\" >刷新位置</font> | </a>";
		if(eqVisualPower.sim)Nhtml+="<a id='sim_"+data.data[0].id+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+data.data[0].simCode+");\">SIM </font> | </a>";
		Nhtml+="<a id='more_"+data.data[0].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
		var k = -1;
		for ( var h = 0; h < gdMarkers.length; h++){
			if(gdMarkers[h].id==data.data[0].id){
				k=h;
				break;
			}
		}
		var label = {//label默认蓝框白底左上角显示，样式className为：amap-marker-label
				offset: new AMap.Pixel(20,2),//修改label相对于maker的位置
				content:data.data[0].vhcCode +"("+data.data[0].positionLast.speed.toFixed(1)+"km/h)"
		};
		if(k==-1){
			var marker = new AMap.Marker({
				icon : cyIcon,//自定义图标
				position : myLnglat,//位置
				offset : new AMap.Pixel(-15,-15),//偏移量
				map :gaoMap //地图
			});
			cluster.addMarker(marker);
			var infoWindow = new AMap.InfoWindow({
				content: Nhtml,
				offset: new AMap.Pixel(1,-10)
			});
			if(namekg == false){
				marker.setLabel(label);
			}else{
				marker.setLabel(null);
			}
			infoWindow.open(gaoMap,myLnglat);
			var markerManage = new Object();
			markerManage.id = data.data[0].id;
			markerManage.vhcCode = data.data[0].vhcCode;
			markerManage.gprs = data.data[0].gprsCode;
			markerManage.marker = marker;
			markerManage.label = label;
			markerManage.remark = data.data[0].remark;
			markerManage.remark2 = data.data[0].remark2;
			markerManage.icon = data.data[0].icon;
			markerManage.simCode = data.data[0].simCode;
			markerManage.infoWindow = infoWindow;
			markerManage.myLnglat = myLnglat;
			gdMarkers.push(markerManage);
			marker.on('click',function(e){
				infoWindow.open(gaoMap,gdMarkers[gdMarkers.length-1].myLnglat);
			});
		}else{
			gdMarkers[k].marker.setIcon(cyIcon);
			gdMarkers[k].marker.setPosition(myLnglat);
			gdMarkers[k].infoWindow.setContent(Nhtml);
			gdMarkers[k].infoWindow.setPosition(myLnglat);
			gdMarkers[k].infoWindow.open(gaoMap,myLnglat);
		}
	}else{
		for (var k = 0;k < gdMarkers.length;k++){
			if(data.data[0].id == gdMarkers[k].id){
				var myLnglat = [data.data[0].positionLast.lng,data.data[0].positionLast.lat];
				var s=10;
				var condition=data.data[0].positionLast.state2;
				var sp = parseInt(data.data[0].positionLast.speed);
				if(condition != null){
					if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
						s = 2;
					else{
						if (condition.indexOf("速报警")>=0)
							s = 4;
						else if (condition.indexOf("报警")>=0)
							s = 3;
						else if (sp > 0.5)
							s = 0;
						else
							s = 1;
					}
					if (s != 4 && s != 3 && condition.indexOf("停车")>=0
							&& !condition.indexOf("不在线")>= 0)
					{
						if(condition.indexOf("停车超时")>=0){
							s = 5;	
						}else{
							s = 6;
						}
					}
				}else{
					if (sp > 0.5)
						s = 0;
					else
						s = 1;
				}
				if( data.data[0].positionLast.av == 0 ){
					s=7;
				}
				var newtime = new Date().getTime();
				var ttime = data.data[0].positionLast.recvtime.replace("-","/");
				ttime = ttime.replace("-","/");
				ttime = ttime.replace("T"," ");
				var oldtime = new Date(ttime).getTime();
				if(newtime-oldtime > 600000){
					s=2;
				}

				var state =s;
				var pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_0.gif";
				if(state == 0) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/green_";
				else if(state == 1) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_";
				else if(state == 2) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/gray_";
				else if(state == 3) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/yellow_";
				else if(state == 4) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/pink_";
				else if(state == 5) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/stopalarm";
				else if(state == 7) pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/blue_";
				else pngicon = "gpsonline/image/pic/"+data.data[0].icon+"/red_";
				var direction="";
				var t = parseInt(data.data[0].positionLast.direct);
				if(t>27 && t<=72){
					if(state == 5){
						var image=".gif";
					}else{
						var image="45.gif";
					}
					direction="东北";
				}else if(t>72 && t<=117){
					if(state == 5){
						var image=".gif";
					}else{
						var image="90.gif";
					}

					direction="东";
				}
				else if(t>117 && t<=162){
					if(state == 5){
						var image=".gif";
					}else{
						var image="135.gif";
					}
					direction="东南";
				}
				else if(t>162 && t<=207){
					if(state == 5){
						var image=".gif";
					}else{
						var image="180.gif";
					}
					direction="南";
				}
				else if(t>207 && t<=252){
					if(state == 5){
						var image=".gif";
					}else{
						var image="225.gif";
					}
					direction="西南";
				}
				else if(t>252 && t<=297){
					if(state == 5){
						var image=".gif";
					}else{
						var image="270.gif";
					}
					direction="西";
				}
				else if(t>297 && t<=342){
					if(state == 5){
						var image=".gif";
					}else{
						var image="315.gif";
					}
					direction="西北";
				}
				else {
					if(state == 5){
						var image=".gif";
					}else{
						var image="0.gif";
					}
					direction="北";
				}

				var carname = encodeURI(encodeURI(data.data[0].vhcCode)); 

				var temp,temp1,temp2,temp3,temp4;
				if(data.data[0].positionLast.temperature != null && data.data[0].positionLast.temperature <=127){
					temp=data.data[0].positionLast.temperature +" ℃";
				}else{
					temp="无效";
				}
				if(data.data[0].positionLast.temp1 != null && data.data[0].positionLast.temp1 <=127){
					temp1=data.data[0].positionLast.temp1 +" ℃";
				}else{
					temp1="无效";
				}
				if(data.data[0].positionLast.temp2 != null && data.data[0].positionLast.temp2 <=127){
					temp2=data.data[0].positionLast.temp2 +" ℃";
				}else{
					temp2="无效";
				}
				if(data.data[0].positionLast.temp3 != null && data.data[0].positionLast.temp3 <=127){
					temp3=data.data[0].positionLast.temp3 +" ℃";
				}else{
					temp3="无效";
				}
				if(data.data[0].positionLast.temp4 != null && data.data[0].positionLast.temp4 <=127){
					temp4=data.data[0].positionLast.temp4 +" ℃";
				}else{
					temp4="无效";
				}
				var icon_size=real(data.data[0].icon);
				//自定义图标
				var cyIcon= new AMap.Icon({
					size: new AMap.Size(icon_size,icon_size),  //图标大小
					image: pngicon+image
				});
				var label = {//label默认蓝框白底左上角显示，样式className为：amap-marker-label
						offset: new AMap.Pixel(20,2),//修改label相对于maker的位置
						content:data.data[0].vhcCode +"("+data.data[0].positionLast.speed.toFixed(1)+"km/h)"
				};
				gdMarkers[k].label = label;
				if( namekg == false){
					gdMarkers[k].marker.setLabel(label);
				}else{
					gdMarkers[k].marker.setLabel(null);
				}
				gdMarkers[k].marker.setIcon(cyIcon);
				gdMarkers[k].marker.setPosition(myLnglat);
				var WinShowParms = getCurUserWinShowParms();
				var Nhtml =	"<a href='javascript:void(0);' class='map_setting_ico' onclick='setSystemObject.openWin(1);'style='right:25px;'><span></span></a><div id='app_"+data.data[0].id+"' style='font-weight:normal;'>"
				for ( var ws = 0; ws < WinShowParms.length; ws++){
					if(WinShowParms[ws]==1){
						Nhtml+="<div id='app1_"+data.data[0].id+"'><b>设备名称：</b>"+data.data[0].vhcCode+"</br></div>"
					}
					if(WinShowParms[ws]==2){
						Nhtml+="<div id='app2_"+data.data[0].id+"'><b>服务器时间：</b>"+data.data[0].positionLast.recvtime+"</br></div>"
					}
					if(WinShowParms[ws]==3){
						Nhtml+="<div id='app3_"+data.data[0].id+"'><b>速度：</b>"+data.data[0].positionLast.speed.toFixed(1)+"km/h </br></div>"
					}
					if(WinShowParms[ws]==4){
						Nhtml+="<div id='app4_"+data.data[0].id+"'><b>方向：</b>"+direction+"</br></div>"
					}
					if(WinShowParms[ws]==5){
						Nhtml+="<div id='app5_"+data.data[0].id+"'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
					}
					if(WinShowParms[ws]==6){
						Nhtml+="<div id='app6_"+data.data[0].id+"'><b>油量：</b>"+data.data[0].positionLast.oilMN1+" L</br></div>"
					}
					if(WinShowParms[ws]==7){
						Nhtml+="<div id='app7_"+data.data[0].id+"'><b>当日里程：</b>"+data.data[0].positionLast.distance+" km</br></div>"
					}
					if(WinShowParms[ws]==8){
						Nhtml+="<div id='app8_"+data.data[0].id+"'><b>总里程：</b>"+data.data[0].positionLast.totalDistance+" km</br></div>"
					}
					if(WinShowParms[ws]==9){
						Nhtml+="<div id='app9_"+data.data[0].id+"'><b>状态：</b>"+data.data[0].positionLast.state2+"</br></div>"
					}
					if(WinShowParms[ws]==10){
						Nhtml+="<div id='app10_"+data.data[0].id+"'><b>位置：</b>"+data.data[0].positionLast.memo+"</br></div>"
					}
					if(WinShowParms[ws]==11 && eqVisualPower.sim){
						Nhtml+="<div id='app11_"+data.data[0].id+"'><b>SIM卡号：</b>"+data.data[0].simCode+"</br></div>"
					}
					if(WinShowParms[ws]==12){
						Nhtml+="<div id='app12_"+data.data[0].id+"'><b>GPS时间：</b>"+data.data[0].positionLast.gpstime+"</br></div>"
					}
					if(WinShowParms[ws]==13){
						Nhtml+="<div id='app13_"+data.data[0].id+"'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[0].id+");'><font color='#0000FF'>详细</font></a></br></div>"
					}
					if(WinShowParms[ws]==14 && eqVisualPower.remark){
						Nhtml+="<div id='app14_"+data.data[0].id+"'><b>备注：</b>"+data.data[0].remark+"</br></div>"
					}
					if(WinShowParms[ws]==15){
						Nhtml+="<div id='app15_"+data.data[0].id+"'><b>经纬度：</b>"+data.data[0].positionLast.lng+","+data.data[0].positionLast.lat+"</br></div>"
					}
					if(WinShowParms[ws]==16){
						Nhtml+="<div id='app16_"+data.data[0].id+"'><b>到期时间：</b>"+(data.data[0].overduetime != null && data.data[0].overduetime.indexOf("19") != 0 ? data.data[0].overduetime:"")+"</br></div>"
					}
					if(WinShowParms[ws]==17){
						Nhtml+="<div id='app17_"+data.data[0].id+"'><b>启用时间：</b>"+(data.data[0].posavtime != null && data.data[0].posavtime.indexOf("19") != 0 ? data.data[0].posavtime :"")+"</br></div>"
					}
					if(WinShowParms[ws]==18 && eqVisualPower.gprs){
						Nhtml+="<div id='app18_"+data.data[0].id+"'><b>设备ID：</b>"+data.data[0].gprsCode+"</br></div>"
					}
					if(WinShowParms[ws]==19){
						Nhtml+="<div id='app19_"+data.data[0].id+"'><b>备注2：</b>"+data.data[0].remark2+"</br></div>"
					}
				}
				Nhtml+="<a href='javascript:streeViewObject.open("+data.data[0].id+","+data.data[0].positionLast.blat+","+data.data[0].positionLast.blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+data.data[0].id+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a>";
				if(eqVisualPower.play)Nhtml+="<a id='play_"+data.data[0].id+"' href='gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[0].id+"&carname="+carname+"&icon="+data.data[0].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a>";
				Nhtml+="<a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[0].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[0].id+");\" >刷新位置</font> | </a>";
				if(eqVisualPower.sim)Nhtml+="<a id='sim_"+data.data[0].id+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+data.data[0].simCode+");\">SIM </font> | </a>";
				Nhtml+="<a id='more_"+data.data[0].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
				gdMarkers[k].infoWindow.setContent(Nhtml);
				gdMarkers[k].infoWindow.setPosition(myLnglat);
				gdMarkers[k].infoWindow.open(gaoMap,myLnglat);
				gaoMap.setZoomAndCenter(14,myLnglat);
			}
		}
	}
}
//修改点内容  gdMarkers
function updateGaodeMap(){
	for(var i=0;i<newdata.data.length;i++){
		for(var k=0;k<gdMarkers.length;k++){
			if(newdata.data[i].vehicleId == gdMarkers[k].id){
				var myLnglat = [newdata.data[i].lng,newdata.data[i].lat];
				var s = 10;
				var condition = newdata.data[i].state2;
				var sp = parseInt(newdata.data[i].speed);
				if(condition != null){
					if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
						s = 2;
					else{
						if (condition.indexOf("速报警")>=0)
							s = 4;
						else if (condition.indexOf("报警")>=0)
							s = 3;
						else if (sp > 0.5)
							s = 0;
						else
							s = 1;
					}
					if (s != 4 && s != 3 && condition.indexOf("停车")>=0
							&& !condition.indexOf("不在线")>= 0)
					{
						if(condition.indexOf("停车超时")>=0){
							s = 5;	
						}else{
							s = 6;
						}
					}
				}else{
					if (sp > 0.5)
						s = 0;
					else
						s = 1;
				}
				if(newdata.data[i].av == 0 ){
					s=7;
				}
				var newtime = new Date().getTime();
				var ttime = newdata.data[i].recvtime.replace("-","/");
				ttime = ttime.replace("-","/");
				ttime = ttime.replace("T"," ");
				var oldtime = new Date(ttime).getTime();
				if(newtime-oldtime > 600000){
					s=2;
				}

				var state =s;
				var pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/red_0.gif";
				if(state == 0) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/green_";
				else if(state == 1) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/red_";
				else if(state == 2) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/gray_";
				else if(state == 3) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/yellow_";
				else if(state == 4) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/pink_";
				else if(state == 5) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/stopalarm";
				else if(state == 7) pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/blue_";
				else pngicon = "gpsonline/image/pic/"+gdMarkers[k].icon+"/red_";
				var direction="";
				var t = parseInt(newdata.data[i].direct);
				if(t>27 && t<=72){
					if(state == 5){
						var image=".gif";
					}else{
						var image="45.gif";
					}
					direction="东北";
				}else if(t>72 && t<=117){
					if(state == 5){
						var image=".gif";
					}else{
						var image="90.gif";
					}

					direction="东";
				}
				else if(t>117 && t<=162){
					if(state == 5){
						var image=".gif";
					}else{
						var image="135.gif";
					}
					direction="东南";
				}
				else if(t>162 && t<=207){
					if(state == 5){
						var image=".gif";
					}else{
						var image="180.gif";
					}
					direction="南";
				}
				else if(t>207 && t<=252){
					if(state == 5){
						var image=".gif";
					}else{
						var image="225.gif";
					}
					direction="西南";
				}
				else if(t>252 && t<=297){
					if(state == 5){
						var image=".gif";
					}else{
						var image="270.gif";
					}
					direction="西";
				}
				else if(t>297 && t<=342){
					if(state == 5){
						var image=".gif";
					}else{
						var image="315.gif";
					}
					direction="西北";
				}
				else {
					if(state == 5){
						var image=".gif";
					}else{
						var image="0.gif";
					}
					direction="北";
				}

				var carname = encodeURI(encodeURI(newdata.data[i].vhcCode)); 

				var temp,temp1,temp2,temp3,temp4;
				if(newdata.data[i].temperature != null && newdata.data[i].temperature <=127){
					temp=newdata.data[i].temperature +" ℃";
				}else{
					temp="无效";
				}
				if(newdata.data[i].temp1 != null && newdata.data[i].temp1 <=127){
					temp1=newdata.data[i].temp1 +" ℃";
				}else{
					temp1="无效";
				}
				if(newdata.data[i].temp2 != null && newdata.data[i].temp2 <=127){
					temp2=newdata.data[i].temp2 +" ℃";
				}else{
					temp2="无效";
				}
				if(newdata.data[i].temp3 != null && newdata.data[i].temp3 <=127){
					temp3=newdata.data[i].temp3 +" ℃";
				}else{
					temp3="无效";
				}
				if(newdata.data[i].temp4 != null && newdata.data[i].temp4 <=127){
					temp4=newdata.data[i].temp4 +" ℃";
				}else{
					temp4="无效";
				}
				var icon_size=real(gdMarkers[k].icon);
				//自定义图标
				var cyIcon= new AMap.Icon({
					size: new AMap.Size(icon_size,icon_size),  //图标大小
					image: pngicon+image
				});
				var label = {//label默认蓝框白底左上角显示，样式className为：amap-marker-label
						offset: new AMap.Pixel(20,2),//修改label相对于maker的位置
						content:gdMarkers[k].vhcCode +"("+newdata.data[i].speed.toFixed(1)+"km/h)"
				};
				gdMarkers[k].label = label;
				if( namekg == false){
					gdMarkers[k].marker.setLabel(label);
				}else{
					gdMarkers[k].marker.setLabel(null);
				}
				gdMarkers[k].marker.setIcon(cyIcon);
				gdMarkers[k].marker.moveTo(myLnglat,120);
				gdMarkers[k].marker.setPosition(myLnglat);
				gdMarkers[k].myLnglat = myLnglat;
				var WinShowParms = getCurUserWinShowParms();
				var Nhtml =	"<a href='javascript:void(0);' class='map_setting_ico' onclick='setSystemObject.openWin(1);'style='right:25px;'><span></span></a><div id='app_"+newdata.data[i].vehicleId+"' style='font-weight:normal;'>"
				for ( var ws = 0; ws < WinShowParms.length; ws++){
					if(WinShowParms[ws]==1){
						Nhtml+="<div id='app1_"+newdata.data[i].vehicleId+"'><b>设备名称：</b>"+gdMarkers[k].vhcCode+"</br></div>"
					}
					if(WinShowParms[ws]==2){
						Nhtml+="<div id='app2_"+newdata.data[i].vehicleId+"'><b>服务器时间：</b>"+newdata.data[i].recvtime+"</br></div>"
					}
					if(WinShowParms[ws]==3){
						Nhtml+="<div id='app3_"+newdata.data[i].vehicleId+"'><b>速度：</b>"+newdata.data[i].speed.toFixed(1)+"km/h </br></div>"
					}
					if(WinShowParms[ws]==4){
						Nhtml+="<div id='app4_"+newdata.data[i].vehicleId+"'><b>方向：</b>"+direction+"</br></div>"
					}
					if(WinShowParms[ws]==5){
						Nhtml+="<div id='app5_"+newdata.data[i].vehicleId+"'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
					}
					if(WinShowParms[ws]==6){
						Nhtml+="<div id='app6_"+newdata.data[i].vehicleId+"'><b>油量：</b>"+newdata.data[i].oilMN1+" L</br></div>"
					}
					if(WinShowParms[ws]==7){
						Nhtml+="<div id='app7_"+newdata.data[i].vehicleId+"'><b>当日里程：</b>"+newdata.data[i].distance+" km</br></div>"
					}
					if(WinShowParms[ws]==8){
						Nhtml+="<div id='app8_"+newdata.data[i].vehicleId+"'><b>总里程：</b>"+newdata.data[i].totalDistance+" km</br></div>"
					}
					if(WinShowParms[ws]==9){
						Nhtml+="<div id='app9_"+newdata.data[i].vehicleId+"'><b>状态：</b>"+newdata.data[i].state2+"</br></div>"
					}
					if(WinShowParms[ws]==10){
						Nhtml+="<div id='app10_"+newdata.data[i].vehicleId+"'><b>位置：</b>"+newdata.data[i].memo+"</br></div>"
					}
					if(WinShowParms[ws]==11 && eqVisualPower.sim){
						Nhtml+="<div id='app11_"+newdata.data[i].vehicleId+"'><b>SIM卡号：</b>"+gdMarkers[k].simCode+"</br></div>"
					}
					if(WinShowParms[ws]==12){
						Nhtml+="<div id='app12_"+newdata.data[i].vehicleId+"'><b>GPS时间：</b>"+newdata.data[i].gpstime+"</br></div>"
					}
					if(WinShowParms[ws]==13){
						Nhtml+="<div id='app13_"+newdata.data[i].vehicleId+"'><b>OBD/CAN数据：</b><a href='javascript:opobd("+newdata.data[i].vehicleId+");'><font color='#0000FF'>详细</font></a></br></div>"
					}
					if(WinShowParms[ws]==14 && eqVisualPower.remark){
						Nhtml+="<div id='app14_"+newdata.data[i].vehicleId+"'><b>备注：</b>"+gdMarkers[k].remark+"</br></div>"
					}
					if(WinShowParms[ws]==15){
						Nhtml+="<div id='app15_"+newdata.data[i].vehicleId+"'><b>经纬度：</b>"+newdata.data[i].lng+","+newdata.data[i].lat+"</br></div>"
					}
					if(WinShowParms[ws]==16){
						Nhtml+="<div id='app16_"+newdata.data[i].vehicleId+"'><b>到期时间：</b>"+(newdata.data[i].overduetime != null && newdata.data[i].overduetime.indexOf("19") != 0 ? newdata.data[i].overduetime:"")+"</br></div>"
					}
					if(WinShowParms[ws]==17){
						Nhtml+="<div id='app17_"+newdata.data[i].vehicleId+"'><b>启用时间：</b>"+(newdata.data[i].posavtime != null && newdata.data[i].posavtime.indexOf("19") != 0 ? newdata.data[i].posavtime :"")+"</br></div>"
					}
					if(WinShowParms[ws]==18 && eqVisualPower.gprs){
						Nhtml+="<div id='app18_"+newdata.data[i].vehicleId+"'><b>设备ID：</b>"+gdMarkers[k].gprs+"</br></div>"
					}
					if(WinShowParms[ws]==19){
						Nhtml+="<div id='app19_"+newdata.data[i].vehicleId+"'><b>备注2：</b>"+gdMarkers[k].remark2+"</br></div>"
					}
				}
				Nhtml+="<a href='javascript:streeViewObject.open("+newdata.data[i].vehicleId+","+newdata.data[i].blat+","+newdata.data[i].blng+","+t+","+3+");'><font color='#0000FF'>街景</font> | </a><a href='gpsonline/jsp/TrackMap.jsp?carid="+newdata.data[i].vehicleId+"&mapType=1' target='_blank'><font color='#0000FF'>跟踪</font> | </a>";
				if(eqVisualPower.play)Nhtml+="<a href='gpsonline/jsp/monitor/playBack.jsp?carid="+newdata.data[i].vehicleId+"&carname="+gdMarkers[k].vhcCode+"&icon="+gdMarkers[k].icon+"&mapType=1' target='_blank'><font color='#0000FF'>回放</font> | </a>";
				Nhtml+="<a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+newdata.data[i].vehicleId+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+newdata.data[i].vehicleId+");\" >刷新位置</font> | </a>";
				if(eqVisualPower.sim)Nhtml+="<a id='sim_"+gdMarkers[k].simCode+"' href='javascript:;' ><font color='#0000FF' onclick=\"openSim("+gdMarkers[k].simCode+");\">SIM </font> | </a>";
				Nhtml+="<a id='more_"+newdata.data[i].vehicleId+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></div>";
				gdMarkers[k].infoWindow.setPosition(myLnglat);
				gdMarkers[k].infoWindow.setContent(Nhtml);
			}
		}
	}
}
//高德地图搜索
function openGdMapSearchInput(){
	$("#gd_mapsearch_input").val("");
	if($('#gd_mapSearch_div').css('display')=='block'){
		$("#gd_mapSearch_div").hide();
		var mmarks = gaoMap.getAllOverlays("marker");
		for ( var t = 0; t < mmarks.length; t++){
			if(typeof(mmarks[t].zIndex) == 'undefined')gaoMap.remove(mmarks[t]);
		}
	}else{
		$("#gd_mapSearch_div").show();
	} 
}
//加载谷歌地图js
function loadGaodeMapJs(){
	var script = document.createElement("script");
	script.type = "text/javascript";
	script.src = "http://webapi.amap.com/maps?v=1.3&key=311f25d6868ca0039f68575345df8e04&&plugin=AMap.Scale,AMap.OverView,AMap.ToolBar,AMap.Autocomplete,AMap.PlaceSearch,AMap.MarkerClusterer";
	document.getElementsByTagName("head")[0].appendChild(script);
}
//显示或隐藏标注
function GaoDemarkerShowOrHide(){
	if(treeObj!=null){
		var nodes = treeObj.getCheckedNodes(true);
		gaoMap.remove(bz_gdMarkers);
		gaoMap.remove(qy_gdMarkers);
		var allmarker_bz = markerObject.markerJson.data;
		for (var i = 0; i < nodes.length; i++){
			if(nodes[i].isParent)continue;
			for (var j = 0; j < allmarker_bz.length; j++){
				if(nodes[i].id == allmarker_bz[j].id){
					var label = {//label默认蓝框白底左上角显示，样式className为：amap-marker-label
							offset: new AMap.Pixel(20,2),//修改label相对于maker的位置
							content:allmarker_bz[j].title
					};
					var mylnglat = [allmarker_bz[j].lat2,allmarker_bz[j].lng2];
					var marker = new AMap.Marker({
						icon:new AMap.Icon({
							size: new AMap.Size(32, 32),  //图标大小
							image:allmarker_bz[j].icon.replace(/\"/g,"")
						}),//自定义图标
						position : mylnglat,//位置
						offset : new AMap.Pixel(-15,-15),//偏移量
						map :gaoMap //地图
					});
					marker.zIndex = allmarker_bz[j].id;
					marker.title = allmarker_bz[j].title;
					marker.position = mylnglat;
					var html = "<div  style='font-weight:normal;'>"+
					"<div><b>标注名称:</b>"+allmarker_bz[j].title+"</br></div>"+
					"<div><b>描        述:</b>"+allmarker_bz[j].memo+"</br></div>"+
					"<div><b>经纬度:</b>"+allmarker_bz[j].lat2+","+allmarker_bz[j].lng2+"</br></div></div>";
					marker.content = html;
					if($('#bzShowNamekbox').attr('checked')){
						marker.setLabel(label);
					}
					marker.on('click',function(e){
						var infoWindow = new AMap.InfoWindow({
							content:e.target.content,
							offset: new AMap.Pixel(1,-10)
						});
						infoWindow.open(gaoMap,e.target.position);
					});
					var polygonArr = new Array();//多边形覆盖物节点坐标数组
					polygonArr.push([allmarker_bz[j].userMarkerArea.g_leftLon,allmarker_bz[j].userMarkerArea.g_leftLat]);
					polygonArr.push(getLngLat(allmarker_bz[j].userMarkerArea.markerLength/1000*1.3,0,allmarker_bz[j].userMarkerArea.g_leftLat,allmarker_bz[j].userMarkerArea.g_leftLon));
					polygonArr.push([allmarker_bz[j].userMarkerArea.g_rightLon,allmarker_bz[j].userMarkerArea.g_rightLat]);
					polygonArr.push(getLngLat(allmarker_bz[j].userMarkerArea.markerLength/1000*1.3,180,allmarker_bz[j].userMarkerArea.g_rightLat,allmarker_bz[j].userMarkerArea.g_rightLon));
					var polygon = new AMap.Polygon({
						path: polygonArr,//设置多边形边界路径
						strokeColor: "#191970", //线颜色
						strokeOpacity: 0.5, //线透明度
						strokeWeight:2,    //线宽
						fillColor: "#191970", //填充色
						fillOpacity:0.8//填充透明度
					});
					polygon.setMap(gaoMap);
					bz_gdMarkers.push(marker);
					qy_gdMarkers.push(polygon);
				}
			}
		}
	}
}
//根据角度，距离一个已知点 计算另一个点坐标
function getLngLat(dis,angle,lng,lat){
	return [(lat+(dis*Math.cos(angle*Math.PI/180))/111),(lng+(dis*Math.sin(angle*Math.PI/180))/(111*Math.cos(lat*Math.PI/180)))];
}
//追踪页面 初始化
function loadGaoDeTrack(){
	if(document.readyState=="complete"){
		gdMap = new AMap.Map('map_canvas');
	}else{
		setTimeout('loadGaoDeTrack()',500);
		return;
	}
	gdMap.addControl(new AMap.Scale({visible:true}));//添加比例尺
	gdMap.addControl(new AMap.ToolBar({visible:true}));//添加工具条
	
	var lat,lng;
	for(i=0;i<carList.data.length;i++){
		if(carList.data[i].positionLast.lat != 0 &&carList.data[i].positionLast.lng != 0){
			lat = carList.data[i].positionLast.lat;
			lng = carList.data[i].positionLast.lng;
			break;
		}
	}
	var mylnglat = [lng,lat];
	latlngArr.push(mylnglat);
	tracker.mylnglat = mylnglat;
	gdMap.setZoomAndCenter(15,mylnglat);// 初始化地图，设置中心点坐标和地图级别
	var s=10;
	var condition=carList.data[0].positionLast.state2;
	var sp = parseInt(carList.data[0].positionLast.speed);
	if (condition != null) {
		if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
			s = 2;
		else {
			if (condition.indexOf("速报警")>=0)
				s = 4;
			else if (condition.indexOf("报警")>=0)
				s = 3;
			else if (sp > 0.5)
				s = 0;
			else
				s = 1;
		}
		if (s != 4 && s != 3 && condition.indexOf("停车")>=0
				&& !condition.indexOf("不在线")>= 0)
		{
			if(condition.indexOf("停车超时")>=0){
				s = 5;	
			}else{
				s = 6;
			}
		}
	}else{
		if (sp > 0.5)
			s = 0;
		else
			s = 1;
	}

	var newtime = new Date().getTime();
	var ttime =carList.data[0].positionLast.recvtime.replace("-","/");
	ttime=ttime.replace("-","/");
	ttime=ttime.replace("T"," ");
	var oldtime = new Date(ttime).getTime();
	if(newtime-oldtime > 600000){
		s=2;
	}	
	var state =s;
	var pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_0.gif";
	if(state == 0) pngicon = "gpsonline/image/pic/"+carList.data[i].icon+"/green_";
	else if(state == 1) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_";
	else if(state == 2) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/gray_";
	else if(state == 3) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/yellow_";
	else if(state == 4) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/pink_";
	else if(state == 5) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/stopalarm";
	else pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_";
	var direction="";
	var t = parseInt(carList.data[0].positionLast.direct);
	if(t>27 && t<=72){
		if(state == 5){
			var image=".gif";
		}else{
			var image="45.gif";
		}

		direction="东北";
	}else if(t>72 && t<=117){
		if(state == 5){
			var image=".gif";
		}else{
			var image="90.gif";
		}

		direction="东";
	}
	else if(t>117 && t<=162){
		if(state == 5){
			var image=".gif";
		}else{
			var image="135.gif";
		}
		direction="东南";
	}
	else if(t>162 && t<=207){
		if(state == 5){
			var image=".gif";
		}else{
			var image="180.gif";
		}
		direction="南";
	}
	else if(t>207 && t<=252){
		if(state == 5){
			var image=".gif";
		}else{
			var image="225.gif";
		}
		direction="西南";
	}
	else if(t>252 && t<=297){
		if(state == 5){
			var image=".gif";
		}else{
			var image="270.gif";
		}
		direction="西";
	}
	else if(t>297 && t<=342){
		if(state == 5){
			var image=".gif";
		}else{
			var image="315.gif";
		}
		direction="西北";
	}
	else {
		if(state == 5){
			var image=".gif";
		}else{
			var image="0.gif";
		}
		direction="北";
	}

	var html =	"<b>设备名称：</b>"+carList.data[0].vhcCode+"</br>"
	+"<b>接收时间：</b>"+carList.data[0].positionLast.recvtime+"</br>"
	+"<b>速度：</b>"+carList.data[0].positionLast.speed.toFixed(1)+"km/h </br>"
	+"<b>方向：</b>"+direction+"</br>"
	+"<b>状态：</b>"+carList.data[0].positionLast.state2+"</br>"
	+"<b>位置：</b>"+carList.data[0].positionLast.memo+"</br>";
	tracker.content = html;
	var icon_size=real(carList.data[0].icon);
	//自定义图标
	var cyIcon= new AMap.Icon({
		size: new AMap.Size(icon_size,icon_size),  //图标大小
		image: pngicon+image
	});
	var marker = new AMap.Marker({
		icon : cyIcon,//自定义图标
		position : mylnglat,//位置
		offset : new AMap.Pixel(-15,-15),//偏移量
		map :gdMap //地图
    });
	tracker.marker = marker;
	var infoWindow = new AMap.InfoWindow({
		content: tracker.content,
		offset: new AMap.Pixel(1,-10)
	});
	tracker.infoWindow = infoWindow;
	infoWindow.open(gdMap,tracker.mylnglat);
	marker.on('click',function(e){
		infoWindow.open(gdMap,tracker.mylnglat);
	});
}
//追踪页面的轨迹显示
function updateGaodeMapTrack(){
	
	var myLatlng = [carList.data[0].positionLast.lng,carList.data[0].positionLast.lat];
	latlngArr.push(myLatlng);
	tracker.mylnglat = myLatlng;
	var s=10;
	var condition=carList.data[0].positionLast.state2;
	var sp = parseInt(carList.data[0].positionLast.speed);
	if (condition != null){
		if (condition.indexOf("不在线")>=0 || condition.indexOf("掉线")>=0)
			s = 2;
		else {
			if (condition.indexOf("速报警")>=0)
				s = 4;
			else if (condition.indexOf("报警")>=0)
				s = 3;
			else if (sp > 0.5)
				s = 0;
			else
				s = 1;
		}
		if (s != 4 && s != 3 && condition.indexOf("停车")>=0
				&& !condition.indexOf("不在线")>= 0){
			if(condition.indexOf("停车超时")>=0){
				s = 5;	
			}else{
				s = 6;
			}
		}
	}else{
		if (sp > 0.5)
			s = 0;
		else
			s = 1;
	}
	var newtime = new Date().getTime();
	var ttime =carList.data[0].positionLast.recvtime.replace("-","/");
	ttime=ttime.replace("-","/");
	ttime=ttime.replace("T"," ");
	var oldtime = new Date(ttime).getTime();
	if(newtime-oldtime > 600000){
		s=2;
	}
	var state =s;
	var pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_0.gif";
	if(state == 0) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/green_";
	else if(state == 1) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_";
	else if(state == 2) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/gray_";
	else if(state == 3) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/yellow_";
	else if(state == 4) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/pink_";
	else if(state == 5) pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/stopalarm";
	else pngicon = "gpsonline/image/pic/"+carList.data[0].icon+"/red_";
	var direction="";
	var t = parseInt(carList.data[0].positionLast.direct);
	if(t>27 && t<=72){
		if(state == 5){
			var image=".gif";
		}else{
			var image="45.gif";
		}
		direction="东北";
	}else if(t>72 && t<=117){
		if(state == 5){
			var image=".gif";
		}else{
			var image="90.gif";
		}

		direction="东";
	}
	else if(t>117 && t<=162){
		if(state == 5){
			var image=".gif";
		}else{
			var image="135.gif";
		}
		direction="东南";
	}
	else if(t>162 && t<=207){
		if(state == 5){
			var image=".gif";
		}else{
			var image="180.gif";
		}
		direction="南";
	}
	else if(t>207 && t<=252){
		if(state == 5){
			var image=".gif";
		}else{
			var image="225.gif";
		}
		direction="西南";
	}
	else if(t>252 && t<=297){
		if(state == 5){
			var image=".gif";
		}else{
			var image="270.gif";
		}
		direction="西";
	}
	else if(t>297 && t<=342){
		if(state == 5){
			var image=".gif";
		}else{
			var image="315.gif";
		}
		direction="西北";
	}
	else {
		if(state == 5){
			var image=".gif";
		}else{
			var image="0.gif";
		}
		direction="北";
	}
	var col = "#00CD00";
	var dianMoveSpeed = 120;//点在地图上的移动速度
	if(carList.data[0].positionLast.speed.toFixed(1)>70){
		dianMoveSpeed = 180;
	}else if(carList.data[0].positionLast.speed.toFixed(1)>100){
		col="#FF34B3";
		dianMoveSpeed = 240;
	}
	var html = "<b>设备名称：</b>"+carList.data[0].vhcCode+"</br>"
	+"<b>接收时间：</b>"+carList.data[0].positionLast.recvtime+"</br>"
	+"<b>速度：</b>"+carList.data[0].positionLast.speed.toFixed(1)+"km/h </br>"
	+"<b>方向：</b>"+direction+"</br>"
	+"<b>状态：</b>"+carList.data[0].positionLast.state2+"</br>"
	+"<b>位置：</b>"+carList.data[0].positionLast.memo+"</br>";
	tracker.content = html;
	document.getElementById('position').innerHTML = "位置: " +carList.data[0].positionLast.memo;					
	var icon_size=real(carList.data[0].icon);
	var cyIcon= new AMap.Icon({
		size: new AMap.Size(icon_size,icon_size),  //图标大小
		image: pngicon+image
	});
	tracker.marker.setIcon(cyIcon);
	tracker.marker.moveTo(myLatlng,dianMoveSpeed);
	tracker.infoWindow.setPosition(myLatlng);
	tracker.infoWindow.setContent(html);
	if(latlngArr.length>=2){
		var linearr = [];
		linearr.push(latlngArr[latlngArr.length-1]);
		linearr.push(latlngArr[latlngArr.length-2]);
		var polyline = new AMap.Polyline({
	        path: linearr,          //设置线覆盖物路径
	        strokeColor:col, //线颜色
	        strokeOpacity: 1,       //线透明度
	        strokeWeight: 3,        //线宽
	        strokeStyle: "solid",   //线样式
	        strokeDasharray: [10,5] //补充线样式
	    });
	    polyline.setMap(gdMap);
	}
}
$(window).load(function(){

});