<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="cn.exlive.mygpsonline.util.MyApplicationContextUtil"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String isFull = request.getParameter("isFull");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title></title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
<style type="text/css">
      #map_canvas { height:100%}
      #container{height:100%}
      .amap-info-close{
		width:16px;
		height:16px;
		font-size:18px !important;
		line-height:16px;
		color:#adacac !important;
	  }
	  .leaflet-zoom-animated{
	    width:400px;
	    background:#fff;
	    border-radius:5px;
	    box-shadow:0px 0px 10px rgba(0,0,0,0.5);
	    padding:30px 20px;
	  }
	  .leaflet-zoom-animated::after{
	     content:'';
	     position:absolute;
	     bottom:-15px;
	     width:0px;
	     height:0px;
	     border-top:15px #fff solid;
	     border-left:15px rgba(0,0,0,0) solid;
	     border-right:15px rgba(0,0,0,0) solid;
	     left:50%;
	     margin-left:-7.5px;
	    }
	   
</style>
	<!--加载百度地图-->
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&amp;ak=<%=MyApplicationContextUtil.map_baidu_key%>"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/library/TextIconOverlay/1.2/src/TextIconOverlay_min.js"></script>
	<script type="text/javascript" src="http://api.map.baidu.com/library/MarkerClusterer/1.2/src/MarkerClusterer_min.js"></script>		
    <script type="text/javascript" src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
    <!--加载谷歌地图 
    <script type="text/javascript" src="http://ditu.google.cn/maps/api/js?sensor=false&libraries=drawing&key=AIzaSyDZis631eei5VArZqB-lP2DDOSgPrhLR5A"></script>
    <script type="text/javascript" src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js"></script> 
    -->
	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/baiduMap/baiduMap.js"></script>
	<script type="text/javascript" src="<%=path%>/gpsonline/js/baiduMap/Menu.js"></script>
    
    <script type="text/javascript" src="<%=path%>/gpsonline/js/language.js"></script>
  	<script type="text/javascript" src="<%=path%>/gpsonline/js/url.js"></script>	
	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/monitor/infobox.js"></script>	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/tool/distance.js"></script>	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/tool/areaQuery.js"></script>	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/tool/baiduAreaQuery.js"></script>	
    <script type="text/javascript" src="<%=path%>/gpsonline/js/MianMap/MianMap.js"></script>
    <!--加载高德地图
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.3&key=311f25d6868ca0039f68575345df8e04"></script> --> 
  	<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
  	<script type="text/javascript" src="<%=path%>/gpsonline/js/gaode/gaode.js"></script>
  	<script type="text/javascript" src="<%=path%>/gpsonline/js/google/google.js"></script>
  	
  	<script type="text/javascript" src="<%=path%>/gpsonline/js/xiuyou/xiuyou.js"></script>
	<script type="text/javascript">
   var map;
   var markersArray =[];
   var id;
   var msgid;
   var msgname;
   var url;
   var carList;
   var carIds=[];
   var infowindow2;
   var infowindowArray =[];
   var vehicles = [];
   var setT;
   var alSwitch = false;
   var drag = false;
   var getType="";
   var num_s = 10;
   function MapData(){
	   	if(map){
	   		if(map.getBounds()){
		   		closeMask();
		   		clearTimeout(setT);
		   		if(alSwitch == false){
		   			alSwitch = true;
		   			if(getType != "-1"){
		   				countDown();    //每隔15秒执行函数al
		   			}
		   		}
		        google.maps.event.addListener(map, 'drag', function(){
		        	clearTimeout(yanchiAl);
		        	yanchiAl=setTimeout("al()",500);
		      	});
	   		}else{
		   		setTimeout("MapData()",100);
		   	}
	   	}else{
	   		setTimeout("MapData()",100);
	   	}
   }
   var pageIdArray = [];
   var pageTimeArray = [];
   function initialize(ids){
	if(alSwitch == false){
			countDown();    //每隔15秒执行函数al
			alSwitch = true;
	} // 172
    num_s = getRefreshTime();
    if(pagingRefreshObject.isPaging){
		   		var remainder = pagingRefreshObject.total % pagingRefreshObject.pageSize;
		   		var shang = pagingRefreshObject.total / pagingRefreshObject.pageSize;
		   		if(remainder>0){
		   			shang++;
		   		}
		   		shang=Math.floor(shang);
		   		for(var i=0; i<shang;i++){
		   			var pageId = new Object();
		   			if(remainder>0 && i==shang-1){
			   			pageId.min=i*pagingRefreshObject.pageSize;
			   			pageId.max=remainder+1;
			   		}else{
			   			pageId.min=i*pagingRefreshObject.pageSize;
			   			pageId.max=pagingRefreshObject.pageSize;
			   		}
			   		pageIdArray.push(pageId);
			   		pageTimeArray.push(0);
		   		}
	}
   		url="<%=basePath%>";
   		var obj = null;
		if(obj != null){
			if(obj.mapType>0){
				mapType=obj.mapType;
			}
		}
		
   		/*var weizhi_ = document.getElementById("weizhi");
		var clientWidth= document.documentElement.clientWidth;
		if(clientWidth>865){
			weizhi_.style.width = clientWidth-865+"px";
		}*/
		
		
   		var lat;
		var lng;
		setT=setTimeout("MapData()",100);
		if(ids == ""){
			setTimeout("initialize(cartIds)",5000);
		}else if(ids == "-1"){
			 getType="-1";
			 var mapOptions = {
		          center: new google.maps.LatLng(31.23, 121.47),
		          zoom: 4,
		          mapTypeId: google.maps.MapTypeId.ROADMAP,
		          mapTypeControlOptions: {
                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, "MAPabc"]
                }
		     };
        	 map = new google.maps.Map(document.getElementById("map_canvas"),
                mapOptions);
            
             addMAPabc(map);
             var geocoder = new google.maps.Geocoder(); 
				    geocoder.geocode( { 'address': remote_ip_info.city}, function(results, status) { 
				      if (status == google.maps.GeocoderStatus.OK) { 
				      	 map.setCenter(results[0].geometry.location);
				      	 map.setZoom(8);
				      } else { 
				        //alert("Geocode was not successful for the following reason: " + status); 
				      } 
    				}); 
			}else if(ids == "thresholds"){
					if(mapType==1){
		      			baiduMap("thresholds",true);
		      			if(findbsCookie("isShowCarName")==true){
		      				$("#isShowCarName").attr("checked",true);
		      				namekg = true;
		      				showCarName();
		      			 }
		      			if(markerObject.markerJson != null && markerObject.markerJson !=""){
		      				showMarkerBaidu(markerObject.markerJson);
		      			}
		      			var  myselect=document.getElementById("select");
		      			myselect.options[0].selected = true;
					  
					   	closeMask();
		   				clearTimeout(setT);
		      		}else if(mapType==3){
		      			loadGaodeMapJs();//加载高德地图js
		      			setTimeout('loadGaoDe()',2000);
			      	}else{
							 var mapOptions = {
						          center: new google.maps.LatLng(31.23, 121.47),
						          zoom: 4,
						          mapTypeId: google.maps.MapTypeId.ROADMAP,
						          mapTypeControlOptions: {
				                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, "MAPabc"]
				                }
						     };
				        	 map = new google.maps.Map(document.getElementById("map_canvas"),
				                mapOptions);
				          
				             addMAPabc(map);
				             var geocoder = new google.maps.Geocoder(); 
								    geocoder.geocode( { 'address': remote_ip_info.city}, function(results, status) { 
								      if (status == google.maps.GeocoderStatus.OK) { 
								      	 map.setCenter(results[0].geometry.location);
								      	 map.setZoom(8);
								      } else { 
								      
								      } 
				    				}); 
				    }
					if(alSwitch == false){
		      			alSwitch = true;
		      			countDown();    //每隔15秒执行函数al
		      			
		      		}
				    /*
					$.ajax({
				        type: "POST",
				        dataType: "json",
				        url: "json/vehicleAction_byids.action",
				        data: {ids:-1},
				        success: function(data){
								
								//reEquipmentStatus(data);
						},
				        error: function() {
				        }
				   	});
				   	*/
		}else{
			    var daparam = -1;
				if(ids==-2){
					daparam = -2;
				}
				$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "json/vehicleAction_byids.action",
		        data: {ids:daparam},
		        success: function(data){
			      	if(data.flag==true){
			      		carList=data;
			      		id=ids;
			      		idsData=ids;
			      		/*if(typeof(google)=="undefined"){
			      			mapType=1
			      			//$("#select").hide(); 
					    }*/
			      		if(mapType==1){
			      			baiduMap(idsData,true);
			      			if(markerObject.markerJson != null && markerObject.markerJson !=""){
			      				showMarkerBaidu(markerObject.markerJson);
			      			}
			      			var  myselect=document.getElementById("select");
			      			myselect.options[0].selected = true;
			      			if(findbsCookie("isShowCarName")==true){
			      				$("#isShowCarName").attr("checked",true);
			      				namekg = true;
			      				showCarName();
			      			}
			      		}else if(mapType==3){
			      			var  myselect=document.getElementById("select");
			      			myselect.options[2].selected = true;
			      			if(findbsCookie("isShowCarName")==true){
			      				$("#isShowCarName").attr("checked",true);
			      				namekg = true;
			      				showCarName();
			      			}
			      			 loadGaodeMapJs();//加载高德地图js
			      			 setTimeout('loadGaoDe()',2000);
			      			 return;
				      	}else{
			      			for(i=0;i<data.data.length;i++){
				      			if(data.data[i].positionLast.lat != 0 &&data.data[i].positionLast.lng != 0){
				      				lat = data.data[i].positionLast.lat;
				      				lng = data.data[i].positionLast.lng;
				      				break;
				      			}
				      		}
				      		if(lat==null && lng ==null){
					      		var mapOptions = {
							          center: new google.maps.LatLng(31.23, 121.47),
							          zoom: 4,
							          mapTypeId: google.maps.MapTypeId.ROADMAP,
							          mapTypeControlOptions: {
												                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, "MAPabc"]
												                }
									     };
							        	 map = new google.maps.Map(document.getElementById("map_canvas"),
							                mapOptions);
							                
							             addMAPabc(map);
							             
							             var geocoder = new google.maps.Geocoder(); 
									      geocoder.geocode( { 'address': remote_ip_info.city}, function(results, status) { 
									      if (status == google.maps.GeocoderStatus.OK) { 
									      	 map.setCenter(results[0].geometry.location);
									      	 map.setZoom(8);
									      } else { 
									        //alert("Geocode was not successful for the following reason: " + status); 
									      } 
					    				}); 
				      		}else{
				      		if(alSwitch == false){
				      			alSwitch = true;
				      			countDown();    //每隔15秒执行函数al
				      			
				      		}
				      		//var obj = getUserStatus();
				      		var zoom;
				      		if(obj==null){
				      			mapOptions = {
						          center: new google.maps.LatLng(lat,lng),
						          zoom: 10,
						          mapTypeId: google.maps.MapTypeId.ROADMAP,
							          mapTypeControlOptions: {
												                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, "MAPabc"]
												                }
					       		};
				      		}else{
				      			if(obj.gzoom == "" || obj.gzoom==null){
				      				zoom=6;
				      			}else{
				      				zoom=obj.gzoom;
				      			}
				      			mapOptions = {
						          center: new google.maps.LatLng(obj.lat,obj.lng),
						          zoom: zoom,
						          mapTypeId: google.maps.MapTypeId.ROADMAP,
							          mapTypeControlOptions: {
												                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID, google.maps.MapTypeId.SATELLITE, "MAPabc"]
												                }
					       		};
				      		}
				      		
					        map = new google.maps.Map(document.getElementById("map_canvas"),
					            mapOptions);
					            addMAPabc(map);
					        
					        google.maps.event.addListener(map, 'bounds_changed', function(){
								        	drag=true;
								      	 });
					        for(i=0;i<data.data.length;i++){
					    		(function(x){
					    		var myLatlng = new google.maps.LatLng(data.data[x].positionLast.lat,data.data[x].positionLast.lng);
									
								var s=10;
								var condition=data.data[x].positionLast.state2;
							  	var sp = parseInt(data.data[x].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[x].positionLast.av == 0 ){
									s=7;
								}
							var newtime = new Date().getTime();
										var ttime =data.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 = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_0.gif";
								 if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/green_";
							else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_";
							else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/gray_";
							else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/yellow_";
							else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/pink_";
							else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/stopalarm";
							else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/blue_";
							else pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_";
									 var direction="";
									 var t = parseInt(data.data[x].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 icon_size=real(data.data[x].icon);
								    var marker = new google.maps.Marker({
									      position: myLatlng,
									      map: map,
									    //  icon: new google.maps.MarkerImage(pngicon+image, new google.maps.Size(40, 40),new google.maps.Point(0,0),new google.maps.Point(10, 10)),
									       icon: new google.maps.MarkerImage(pngicon+image, new google.maps.Size(icon_size, icon_size),new google.maps.Point(0,0),new google.maps.Point(10, 10)),
									      title:data.data[x].vhcCode
									});
									//var b = new Base64();  
		            				//var carname = b.encode(data.data[x].vhcCode); 
		            				var carname = encodeURI(encodeURI(data.data[x].vhcCode)); 
									//alert(carname);
									markersArray.push(marker);
									var temp,temp1,temp2,temp3,temp4;
									if(data.data[x].positionLast.temperature != null && data.data[x].positionLast.temperature <=127){
										temp=data.data[x].positionLast.temperature +" ℃";
									}else{
										temp="无效";
									}
									if(data.data[x].positionLast.temp1 != null && data.data[x].positionLast.temp1 <=127){
										temp1=data.data[x].positionLast.temp1 +" ℃";
									}else{
										temp1="无效";
									}
									if(data.data[x].positionLast.temp2 != null && data.data[x].positionLast.temp2 <=127){
										temp2=data.data[x].positionLast.temp2 +" ℃";
									}else{
										temp2="无效";
									}
									if(data.data[x].positionLast.temp3 != null && data.data[x].positionLast.temp3 <=127){
										temp3=data.data[x].positionLast.temp3 +" ℃";
									}else{
										temp3="无效";
									}
									if(data.data[x].positionLast.temp4 != null && data.data[x].positionLast.temp4 <=127){
										temp4=data.data[x].positionLast.temp4 +" ℃";
									}else{
										temp4="无效";
									}
								    var  contentString="";
								    if(isHasPBackAut()){
								    	 contentString = "<div id='app_"+data.data[x].id+"'><p>"+
											"<div id='app1_"+data.data[x].id+"' style='display:block'><b>设备名称：</b>"+data.data[x].vhcCode+"</br></div>"
											+"<div id='app18_"+data.data[x].id+"' style='display:block'><b>设备ID：</b>"+data.data[x].gprsCode+"</br></div>"
											+"<div id='app16_"+data.data[x].id+"' style='display:block'><b>到期时间：</b>"+(data.data[x].overduetime != null && data.data[x].overduetime.indexOf("19") != 0 ? data.data[x].overduetime:"")+"</br></div>"
											+"<div id='app17_"+data.data[x].id+"' style='display:block'><b>启用时间：</b>"+(data.data[x].posavtime != null && data.data[x].posavtime.indexOf("19") != 0 ? data.data[x].posavtime :"")+"</br></div>"
											
											+"<div id='app14_"+data.data[x].id+"' style='display:block'><b>备注：</b>"+data.data[x].remark+"</br></div>"
											+"<div id='app15_"+data.data[x].id+"' style='display:block'><b>经纬度：</b>"+data.data[x].positionLast.lng+","+data.data[x].positionLast.lat+"</br></div>"
											+"<div id='app11_"+data.data[x].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[x].simCode+"</br></div>"
											+"<div id='app2_"+data.data[x].id+"' style='display:block'><b>服务器时间：</b>"+data.data[x].positionLast.recvtime+"</br></div>"
											+"<div id='app12_"+data.data[x].id+"' style='display:block'><b>GPS时间：</b>"+data.data[x].positionLast.gpstime+"</br></div>"
											+"<div id='app3_"+data.data[x].id+"' style='display:block'><b>速度：</b>"+data.data[x].positionLast.speed+" km/h </br></div>"
											+"<div id='app4_"+data.data[x].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
											+"<div id='app5_"+data.data[x].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
											+"<div id='app6_"+data.data[x].id+"' style='display:block'><b>油量：</b>"+data.data[x].positionLast.oilMN1+" L</br></div>"
											+"<div id='app7_"+data.data[x].id+"' style='display:block'><b>当日里程：</b>"+data.data[x].positionLast.distance+" km</br></div>"
											+"<div id='app8_"+data.data[x].id+"' style='display:block'><b>总里程：</b>"+data.data[x].positionLast.totalDistance+" km</br></div>"
											+"<div id='app9_"+data.data[x].id+"' style='display:block'><b>状态：</b>"+data.data[x].positionLast.state2+"</br></div>"
											+"<div id='app10_"+data.data[x].id+"' style='display:block'><b>位置：</b>"+data.data[x].positionLast.memo+"</br></div>"
											+"<div id='app13_"+data.data[x].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[x].id+");'><font color='#0000FF'>详细</font></a></br></div>"
											+"<a href='javascript:streeViewObject.open("+data.data[x].id+","+data.data[x].positionLast.lat+","+data.data[x].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[x].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[x].id+"&carname="+carname+"&icon="+data.data[x].icon+"' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[x].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[x].id+");\" >刷新位置</font> | </a>  <a id='more_"+data.data[x].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div>";
						  
					     
									}else{
										 contentString = "<div id='app_"+data.data[x].id+"'><p>"+
											"<div id='app1_"+data.data[x].id+"' style='display:block'><b>设备名称：</b>"+data.data[x].vhcCode+"</br></div>"
											+"<div id='app18_"+data.data[x].id+"' style='display:block'><b>设备ID：</b>"+data.data[x].gprsCode+"</br></div>"
											+"<div id='app16_"+data.data[x].id+"' style='display:block'><b>到期时间：</b>"+(data.data[x].overduetime != null && data.data[x].overduetime.indexOf("19") != 0 ? data.data[x].overduetime:"")+"</br></div>"
											+"<div id='app17_"+data.data[x].id+"' style='display:block'><b>启用时间：</b>"+(data.data[x].posavtime != null && data.data[x].posavtime.indexOf("19") != 0 ? data.data[x].posavtime :"")+"</br></div>"
											
											+"<div id='app14_"+data.data[x].id+"' style='display:block'><b>备注：</b>"+data.data[x].remark+"</br></div>"
											+"<div id='app15_"+data.data[x].id+"' style='display:block'><b>经纬度：</b>"+data.data[x].positionLast.lng+","+data.data[x].positionLast.lat+"</br></div>"
											+"<div id='app11_"+data.data[x].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[x].simCode+"</br></div>"
											+"<div id='app2_"+data.data[x].id+"' style='display:block'><b>服务器时间：</b>"+data.data[x].positionLast.recvtime+"</br></div>"
											+"<div id='app12_"+data.data[x].id+"' style='display:block'><b>GPS时间：</b>"+data.data[x].positionLast.gpstime+"</br></div>"
											+"<div id='app3_"+data.data[x].id+"' style='display:block'><b>速度：</b>"+data.data[x].positionLast.speed+" km/h </br></div>"
											+"<div id='app4_"+data.data[x].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
											+"<div id='app5_"+data.data[x].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
											+"<div id='app6_"+data.data[x].id+"' style='display:block'><b>油量：</b>"+data.data[x].positionLast.oilMN1+" L</br></div>"
											+"<div id='app7_"+data.data[x].id+"' style='display:block'><b>当日里程：</b>"+data.data[x].positionLast.distance+" km</br></div>"
											+"<div id='app8_"+data.data[x].id+"' style='display:block'><b>总里程：</b>"+data.data[x].positionLast.totalDistance+" km</br></div>"
											+"<div id='app9_"+data.data[x].id+"' style='display:block'><b>状态：</b>"+data.data[x].positionLast.state2+"</br></div>"
											+"<div id='app10_"+data.data[x].id+"' style='display:block'><b>位置：</b>"+data.data[x].positionLast.memo+"</br></div>"
											+"<div id='app13_"+data.data[x].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[x].id+");'><font color='#0000FF'>详细</font></a></br></div>"
											+"<a href='javascript:streeViewObject.open("+data.data[x].id+","+data.data[x].positionLast.lat+","+data.data[x].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[x].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[x].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[x].id+");\" >刷新位置</font> | </a>  <a id='more_"+data.data[x].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div>";
						  
					     
									}
								   
									  
									 	//infowindow.setContent(contentString);
									  var infowindow = new google.maps.InfoWindow({
									      content: contentString
									      //,zIndex:10
									  });
									 /* google.maps.event.addListener(marker, 'click', function() {
									    infowindow.open(map,marker);
									  });*/
		
									  
												
									//var infowindow = new InfoBox(myOptions);
									google.maps.event.addListener(marker, "click", function (e) {
									  //	$("#1_"+data.data[x].id).hide();
									  
									 	markerObject.closeInfowindow();//关闭打开的标注弹出框
								    	
								    	if(menu!=null){
								        	menu.hide();
								        }
									 	
									    for(var i=0;i<vehicles.length;i++){
									          vehicles[i].infowindow.close();
									    }		
									    			    
										infowindow.open(map, this);
										var WinShowParms = getCurUserWinShowParms();
										
										if(WinShowParms!=null){
											
											var app1_ = document.getElementById("app1_"+data.data[x].id);
										
											app1_.style.display ="none";
											var app2_ = document.getElementById("app2_"+data.data[x].id);
											app2_.style.display ="none";
											var app3_ = document.getElementById("app3_"+data.data[x].id);
											app3_.style.display ="none";
											var app4_ = document.getElementById("app4_"+data.data[x].id);
											app4_.style.display ="none";
											var app5_ = document.getElementById("app5_"+data.data[x].id);
											app5_.style.display ="none";
											var app6_ = document.getElementById("app6_"+data.data[x].id);
											app6_.style.display ="none";
											var app7_ = document.getElementById("app7_"+data.data[x].id);
											app7_.style.display ="none";
											var app8_ = document.getElementById("app8_"+data.data[x].id);
											app8_.style.display ="none";
											var app9_ = document.getElementById("app9_"+data.data[x].id);
											app9_.style.display ="none";
											var app10_ = document.getElementById("app10_"+data.data[x].id);
											app10_.style.display ="none";
											var app11_ = document.getElementById("app11_"+data.data[x].id);
											app11_.style.display ="none";
											var app12_ = document.getElementById("app12_"+data.data[x].id);
											app12_.style.display ="none";
											var app13_ = document.getElementById("app13_"+data.data[x].id);
											app13_.style.display ="none";
											var app14_ = document.getElementById("app14_"+data.data[x].id);
											app14_.style.display ="none";
											var app15_ = document.getElementById("app15_"+data.data[x].id);
											app15_.style.display ="none";
											var app16_ = document.getElementById("app16_"+data.data[x].id);
											app16_.style.display ="none";
											var app17_ = document.getElementById("app17_"+data.data[x].id);
											app17_.style.display ="none";
											var app18_ = document.getElementById("app18_"+data.data[x].id);
											app18_.style.display ="none";
											for(var ws=0;ws<WinShowParms.length;ws++){
									      		if(WinShowParms[ws]==1){
									      			app1_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==2){
									      			app2_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==3){
									      			app3_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==4){
									      			app4_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==5){
									      			app5_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==6){
									      			app6_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==7){
									      			app7_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==8){
									      			app8_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==9){
									      			app9_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==10){
									      			app10_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==11){
									      			app11_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==12){
									      			app12_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==13){
									      			app13_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==14){
									      			app14_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==15){
									      			app15_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==16){
									      			app16_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==17){
									      			app17_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==18){
									      			app18_.style.display ="block";
									      		}
									      	}
									      	var app_ = document.getElementById("app_"+data.data[x].id);
											infowindow.setContent(app_);
										}
										document.getElementById('weizhi').innerHTML = data.data[x].vhcCode+"： " + data.data[x].positionLast.memo;
										document.getElementById('weizhi').title = data.data[x].vhcCode+"： " + data.data[x].positionLast.memo;
										
										msgid= data.data[x].id;
										msgname= data.data[x].vhcCode;
										
									});
								
									var vehicle = new Object();
								    vehicle.id = data.data[x].id;
								    vehicle.vhcCode = data.data[x].vhcCode;
								    vehicle.remark = data.data[x].remark;
									vehicle.label = new LableMarker(map,data.data[x].vhcCode,myLatlng);
									//vehicle.label.setMap(null);
									vehicle.marker = marker;
									vehicle.icon = data.data[x].icon;
									vehicle.infowindow = infowindow;
									vehicle.latlng = myLatlng;
									vehicle.simCode = data.data[x].simCode;
									vehicle.overduetime = data.data[x].overduetime;
									vehicle.posavtime = data.data[x].posavtime;
									//if( (data.data[x].positionLast.lat == 0 &&data.data[x].positionLast.lng == 0) || data.data[x].positionLast.av == 0 ){
									if(data.data[x].positionLast.lat == 0 &&data.data[x].positionLast.lng == 0){
										//vehicle.marker.setMap(null);
										//vehicle.label.setMap(null);
									}
									vehicles.push(vehicle);
					    		})(i);
					         }	
					         		//showCarName();
							        if(findbsCookie("isShowCarName")==true){
										$("#isShowCarName").attr("checked",true);
										namekg = true;
										showCarName();
									}
					         }
			      		}
			      		
			      		
					 }else{
					 				
					 }
		        },
		        error: function() {
		          
				    }
		   });
	   
		}
    }

    var counter=0;
    var timestamp=0;
    var gids="";
   	var min ="";
   	var max ="";
   	var cishu = -1;
    function al(){
    	   var WinShowParms = getCurUserWinShowParms();
    	   if(drag==true){
				drag=false;
				timestamp=0;
		   }
    	   if(pagingRefreshObject.isPaging){
    	   	  cishu++;
    	   	  if(cishu>=pageIdArray.length){
    	   	  	cishu=0;
    	   	  }
    	   	  min=pageIdArray[cishu].min;
    	   	  max=pageIdArray[cishu].max;
    	   	  timestamp= pageTimeArray[cishu];
    	   }
		   if(isLargeData==true){
		     if(0<carIds.length){
		     	 gids="";
				 for(var i=0;i<carIds.length;i++){
				 	gids = gids+""+carIds[i];
				 	if(i<carIds.length-1){
				 		gids = gids+",";
				 	}
				 }
			 }
			 id=cartIds;
		   }
    	   var p = new Object();
    	   if(mapType==1){
    		   p.leftLat = baidMap.getBounds().getSouthWest().lat-0.05;
			   p.leftLng = baidMap.getBounds().getSouthWest().lng-0.05;
			   p.rightLat = baidMap.getBounds().getNorthEast().lat+0.05;
			   p.rightLng = baidMap.getBounds().getNorthEast().lng+0.05;
    	   }else if(mapType==3){
    		   p.leftLat  = gaoMap.getBounds().getSouthWest().getLat()-0.05;
	           p.leftLng  = gaoMap.getBounds().getSouthWest().getLng()-0.05;
	           p.rightLat = gaoMap.getBounds().getNorthEast().getLat()+0.05;
	           p.rightLng = gaoMap.getBounds().getNorthEast().getLng()+0.05;
           }else if(mapType==4){

           }else{
	           p.leftLat = map.getBounds().getSouthWest().lat()-0.05;
	           p.leftLng = map.getBounds().getSouthWest().lng()-0.05;
	           p.rightLat = map.getBounds().getNorthEast().lat()+0.05;
	           p.rightLng = map.getBounds().getNorthEast().lng()+0.05;
           }
           if(cartIdsArr.length<=500){
               
           	if(cartIds != "" && cartIds != null){
	            $.ajax({
		        type: "POST",
		        dataType: "json",
		        async:true,
		        url: "json/vehicleAction_onlinevids.action",
		        data: {ids:-1,timestamp:timestamp,gids:gids,pagesize:max,offset:min},
		        success: function(data){
		      	if(data.flag==true){
		      		counter=0;
		      		//console.info(JSON.stringify(newdata));
    				newdata=data;
    				reEquipmentStatus(newdata);
    				timestamp= data.timestamp;
    				if(pagingRefreshObject.isPaging){
    					pageTimeArray[cishu]= data.timestamp;
    				}
    				if(data.data.length>0){
    				   if(carList){
    				   		for(var i=0;i<data.data.length;i++){
	    						for(var j=0;j<carList.data.length;j++){
	    							if(data.data[i].vehicleId == carList.data[j].id){
	    								carList.data[j].positionLast = null;
	    								carList.data[j].positionLast = data.data[i];
	    							}
	    						}
	    					}
    				   }
    					streeViewObject.update();
    					if(mapType==1){
    		   				updateBaiduMap();
    	   				}else if(mapType==3){
    	   					updateGaodeMap();
        	   			}else if(mapType==4){
        	   				updateXiuYouMap();
            	   		}else{
		    				for(var i=0;i<data.data.length;i++){
			    				/*if(msgid== data.data[i].vehicleId){
	    							document.getElementById('weizhi').innerHTML = msgname+"： " + data.data[i].memo;
									document.getElementById('weizhi').title = msgname+"： " + data.data[i].memo;
	    						}*/
		    					for(var k=0;k<vehicles.length;k++){
		    						if(data.data[i].vehicleId == vehicles[k].id){
		    							if(msgid== data.data[i].vehicleId){
			    							document.getElementById('weizhi').innerHTML = vehicles[k].vhcCode+"： " + data.data[i].memo;
											document.getElementById('weizhi').title = vehicles[k].vhcCode+"： " + data.data[i].memo;
			    						}
			    					
			    					//if(data.data[i].vehicleId == vehicles[k].id && data.data[i].lat != 0 && data.data[i].lng !=0){
			    							var myLatlng = new google.maps.LatLng(data.data[i].lat,data.data[i].lng);
			    							var s=10;
											var condition=data.data[i].state2;
										  	var sp = parseInt(data.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( data.data[i].av == 0 ){
												s=7;
											}
										var newtime = new Date().getTime();
										var ttime =data.data[i].recvtime.replace("-","/");
										ttime=ttime.replace("-","/");
										ttime=ttime.replace("T"," ");
										var oldtime = new Date(ttime).getTime();
										//alert(newtime-oldtime);
										if(newtime-oldtime > 600000){
											s=2;
										}
									  		
										  	var state =s;
										  	var pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_0.gif";
											if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/green_";
											else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_";
											else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/gray_";
											else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/yellow_";
											else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/pink_";
											else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/stopalarm";
											else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/blue_";
											else pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_";
												 var direction="";
												 var t = parseInt(data.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 b = new Base64();  
												//	var carname = b.encode(vehicles[k].vhcCode);  
													var carname = encodeURI(encodeURI(vehicles[k].vhcCode)); 
													var temp,temp1,temp2,temp3,temp4;
													if(data.data[i].temperature != null && data.data[i].temperature <=127){
														temp=data.data[i].temperature +" ℃";
													}else{
														temp="无效";
													}
													if(data.data[i].temp1 != null && data.data[i].temp1 <=127){
														temp1=data.data[i].temp1 +" ℃";
													}else{
														temp1="无效";
													}
													if(data.data[i].temp2 != null && data.data[i].temp2 <=127){
														temp2=data.data[i].temp2 +" ℃";
													}else{
														temp2="无效";
													}
													if(data.data[i].temp3 != null && data.data[i].temp3 <=127){
														temp3=data.data[i].temp3 +" ℃";
													}else{
														temp3="无效";
													}
													if(data.data[i].temp4 != null && data.data[i].temp4 <=127){
														temp4=data.data[i].temp4 +" ℃";
													}else{
														temp4="无效";
													}
													
												    if(isHasPBackAut()){
												    	 var contentString = "<div id='app_"+data.data[i].vehicleId+"'><p>"+
															"<div id='app1_"+data.data[i].vehicleId+"' style='display:block'><b>设备名称：</b>"+vehicles[k].vhcCode+"</br></div>"
															+"<div id='app18_"+data.data[i].vehicleId+"' style='display:block'><b>设备ID：</b>"+vehicles[k].gprsCode+"</br></div>"
															+"<div id='app16_"+data.data[i].vehicleId+"' style='display:block'><b>到期时间：</b>"+(vehicles[k].overduetime != null && vehicles[k].overduetime.indexOf("19") != 0 ? vehicles[k].overduetime:"")+"</br></div>"
															+"<div id='app17_"+data.data[i].vehicleId+"' style='display:block'><b>启用时间：</b>"+(vehicles[k].posavtime != null && vehicles[k].posavtime.indexOf("19") != 0 ? vehicles[k].posavtime :"")+"</br></div>"
															
															+"<div id='app14_"+data.data[i].vehicleId+"' style='display:block'><b>备注：</b>"+vehicles[k].remark+"</br></div>"
															+"<div id='app15_"+data.data[i].vehicleId+"' style='display:block'><b>经纬度：</b>"+data.data[i].lng+","+data.data[i].lat+"</br></div>"
															+"<div id='app11_"+data.data[i].vehicleId+"' style='display:block'><b>SIM卡号：</b>"+vehicles[k].simCode+"</br></div>"
															+"<div id='app2_"+data.data[i].vehicleId+"' style='display:block'><b>服务器时间：</b>"+data.data[i].recvtime+"</br></div>"
															+"<div id='app12_"+data.data[i].vehicleId+"' style='display:block'><b>GPS时间：</b>"+data.data[i].gpstime+"</br></div>"
															+"<div id='app3_"+data.data[i].vehicleId+"' style='display:block'><b>速度：</b>"+data.data[i].speed+" km/h </br></div>"
															+"<div id='app4_"+data.data[i].vehicleId+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
															+"<div id='app5_"+data.data[i].vehicleId+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"  | <b>温度3：</b>"+temp3+"  | <b>温度4：</b>"+temp4+"</br></div>"
															+"<div id='app6_"+data.data[i].vehicleId+"' style='display:block'><b>油量：</b>"+data.data[i].oilMN1+" L</br></div>"
															+"<div id='app7_"+data.data[i].vehicleId+"' style='display:block'><b>当日里程：</b>"+data.data[i].distance+" km</br></div>"
															+"<div id='app8_"+data.data[i].vehicleId+"' style='display:block'><b>总里程：</b>"+data.data[i].totalDistance+" km</br></div>"
															+"<div id='app9_"+data.data[i].vehicleId+"' style='display:block'><b>状态：</b>"+data.data[i].state2+"</br></div>"
															+"<div id='app10_"+data.data[i].vehicleId+"' style='display:block'><b>位置：</b>"+data.data[i].memo+"</br></div>"
															+"<div id='app13_"+data.data[i].vehicleId+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].vehicleId+");'><font color='#0000FF'>详细</font></a></br></div>"
															+"<a href='javascript:streeViewObject.open("+data.data[i].vehicleId+","+data.data[i].lat+","+data.data[i].lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+vehicles[k].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+vehicles[k].id+"&carname="+carname+"&icon="+vehicles[k].icon+"' target='_blank'><font color='#0000FF'>回放</font>  |</a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+vehicles[k].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+vehicles[k].id+");\" >刷新位置</font> | </a>  <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
										  
													}else{
														
														 var contentString = "<div id='app_"+data.data[i].vehicleId+"'><p>"+
															"<div id='app1_"+data.data[i].vehicleId+"' style='display:block'><b>设备名称：</b>"+vehicles[k].vhcCode+"</br></div>"
															+"<div id='app18_"+data.data[i].vehicleId+"' style='display:block'><b>设备ID：</b>"+vehicles[k].gprsCode+"</br></div>"
															+"<div id='app16_"+data.data[i].vehicleId+"' style='display:block'><b>到期时间：</b>"+(vehicles[k].overduetime != null && vehicles[k].overduetime.indexOf("19") != 0 ? vehicles[k].overduetime:"")+"</br></div>"
															+"<div id='app17_"+data.data[i].vehicleId+"' style='display:block'><b>启用时间：</b>"+(vehicles[k].posavtime != null && vehicles[k].posavtime.indexOf("19") != 0 ? vehicles[k].posavtime :"")+"</br></div>"
															
															+"<div id='app14_"+data.data[i].vehicleId+"' style='display:block'><b>备注：</b>"+vehicles[k].remark+"</br></div>"
															+"<div id='app15_"+data.data[i].vehicleId+"' style='display:block'><b>经纬度：</b>"+data.data[i].lng+","+data.data[i].lat+"</br></div>"
															+"<div id='app11_"+data.data[i].vehicleId+"' style='display:block'><b>SIM卡号：</b>"+vehicles[k].simCode+"</br></div>"
															+"<div id='app2_"+data.data[i].vehicleId+"' style='display:block'><b>服务器时间：</b>"+data.data[i].recvtime+"</br></div>"
															+"<div id='app12_"+data.data[i].vehicleId+"' style='display:block'><b>GPS时间：</b>"+data.data[i].gpstime+"</br></div>"
															+"<div id='app3_"+data.data[i].vehicleId+"' style='display:block'><b>速度：</b>"+data.data[i].speed+" km/h </br></div>"
															+"<div id='app4_"+data.data[i].vehicleId+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
															+"<div id='app5_"+data.data[i].vehicleId+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"  | <b>温度3：</b>"+temp3+"  | <b>温度4：</b>"+temp4+"</br></div>"
															+"<div id='app6_"+data.data[i].vehicleId+"' style='display:block'><b>油量：</b>"+data.data[i].oilMN1+" L</br></div>"
															+"<div id='app7_"+data.data[i].vehicleId+"' style='display:block'><b>当日里程：</b>"+data.data[i].distance+" km</br></div>"
															+"<div id='app8_"+data.data[i].vehicleId+"' style='display:block'><b>总里程：</b>"+data.data[i].totalDistance+" km</br></div>"
															+"<div id='app9_"+data.data[i].vehicleId+"' style='display:block'><b>状态：</b>"+data.data[i].state2+"</br></div>"
															+"<div id='app10_"+data.data[i].vehicleId+"' style='display:block'><b>位置：</b>"+data.data[i].memo+"</br></div>"
															+"<div id='app13_"+data.data[i].vehicleId+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].vehicleId+");'><font color='#0000FF'>详细</font></a></br></div>"
															+"<a href='javascript:streeViewObject.open("+data.data[i].vehicleId+","+data.data[i].lat+","+data.data[i].lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+vehicles[k].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+vehicles[k].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+vehicles[k].id+");\" >刷新位置</font> | </a>  <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
													}
									  				
												    var icon_size=real(vehicles[k].icon);
												    
							    					vehicles[k].marker.setIcon(new google.maps.MarkerImage(pngicon+image, new google.maps.Size(icon_size, icon_size),new google.maps.Point(0,0),new google.maps.Point(10, 10)));
							    					vehicles[k].infowindow.setContent(contentString);
													var WinShowParms = getCurUserWinShowParms();
											
											if(WinShowParms!=null){
												var app1_ = document.getElementById("app1_"+data.data[i].vehicleId);
													if(app1_ != null){
														app1_.style.display ="none";
														var app2_ = document.getElementById("app2_"+data.data[i].vehicleId);
														app2_.style.display ="none";
														var app3_ = document.getElementById("app3_"+data.data[i].vehicleId);
														app3_.style.display ="none";
														var app4_ = document.getElementById("app4_"+data.data[i].vehicleId);
														app4_.style.display ="none";
														var app5_ = document.getElementById("app5_"+data.data[i].vehicleId);
														app5_.style.display ="none";
														var app6_ = document.getElementById("app6_"+data.data[i].vehicleId);
														app6_.style.display ="none";
														var app7_ = document.getElementById("app7_"+data.data[i].vehicleId);
														app7_.style.display ="none";
														var app8_ = document.getElementById("app8_"+data.data[i].vehicleId);
														app8_.style.display ="none";
														var app9_ = document.getElementById("app9_"+data.data[i].vehicleId);
														app9_.style.display ="none";
														var app10_ = document.getElementById("app10_"+data.data[i].vehicleId);
														app10_.style.display ="none";
														var app11_ = document.getElementById("app11_"+data.data[i].vehicleId);
														app11_.style.display ="none";
														var app12_ = document.getElementById("app12_"+data.data[i].vehicleId);
														app12_.style.display ="none";
														var app13_ = document.getElementById("app13_"+data.data[i].vehicleId);
														app13_.style.display ="none";
														var app14_ = document.getElementById("app14_"+data.data[i].vehicleId);
														app14_.style.display ="none";
														var app15_ = document.getElementById("app15_"+data.data[i].vehicleId);
														app15_.style.display ="none";
														var app16_ = document.getElementById("app16_"+data.data[i].vehicleId);
														app16_.style.display ="none";
														var app17_ = document.getElementById("app17_"+data.data[i].vehicleId);
														app17_.style.display ="none";
														var app18_ = document.getElementById("app18_"+data.data[i].vehicleId);
														app18_.style.display ="none";
														for(var ws=0;ws<WinShowParms.length;ws++){
												      		if(WinShowParms[ws]==1){
												      			app1_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==2){
												      			app2_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==3){
												      			app3_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==4){
												      			app4_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==5){
												      			app5_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==6){
												      			app6_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==7){
												      			app7_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==8){
												      			app8_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==9){
												      			app9_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==10){
												      			app10_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==11){
												      			app11_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==12){
												      			app12_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==13){
												      			app13_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==14){
												      			app14_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==15){
												      			app15_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==16){
												      			app16_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==17){
												      			app17_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==18){
												      			app18_.style.display ="block";
												      		}
												      	}
												      	var app_ = document.getElementById("app_"+data.data[i].vehicleId);
												      	vehicles[k].infowindow.setContent(app_);
													}
												
								    			}	
							    				
															
							    					if(data.data[i].lat == 0 &&data.data[i].lng == 0){
														//vehicles[k].marker.setMap(null);
														//vehicles[k].label.setMap(null);
													}else{
														vehicles[k].latlng=myLatlng;
														vehicles[k].marker.setPosition(myLatlng);
														//vehicles[k].label.setMap(null);
														vehicles[k].label = new LableMarker(map,vehicles[k].vhcCode,myLatlng);	
														//vehicles[k].marker.setMap(map);
														
														/*if(namekg == true){
															//vehicles[k].label.setMap(null);
														}else{
															vehicles[k].label.setMap(map);	
														}*/
													}
			    					}
			    				}
		    				}
		    			}
    				}
				 }else{
				 	counter++;
	            	if(counter>=4){
	            		window.location.replace("<%=basePath%>gpsonline/jsp/login.jsp");
	            	}
				 }
				 gids="";
	        },
	        error: function() {
	        	 gids="";
	            	counter++;
	            	if(counter>=4){
	            		window.location.replace("<%=basePath%>gpsonline/jsp/login.jsp");
	            	}
			    }
	   });
            }
           }else{//大于500
            if(cartIds != "" && cartIds != null){
            $.ajax({
	        type: "POST",
	        dataType: "json",
	        async:true,
	        url: "json/vehicleAction_onlinevids.action",
	        data: {ids:-1,
		        'p.leftLat':p.leftLat,
		        'p.leftLng':p.leftLng,
		        'p.rightLat':p.rightLat,
		        'p.rightLng':p.rightLng,
	        	timestamp:timestamp, 
		        gids:gids,
		        pagesize:max,
		        offset:min
	        },
	        success: function(data){
		      	if(data.flag==true){
		      		counter=0;
    				newdata=data;
    				reEquipmentStatus(newdata);
    				timestamp= data.timestamp;
    				if(pagingRefreshObject.isPaging){
    					pageTimeArray[cishu]= data.timestamp;
    				}
    				if(data.data.length>0){
    				   if(carList){
    				   		for(var i=0;i<data.data.length;i++){
	    						for(var j=0;j<carList.data.length;j++){
	    							if(data.data[i].vehicleId == carList.data[j].id){
	    								carList.data[j].positionLast = null;
	    								carList.data[j].positionLast = data.data[i];
	    							}
	    						}
	    					}
    				   }
    				
	    					
    					
    					streeViewObject.update();
    					if(mapType==1){
    		   				updateBaiduMap();
    	   				}else if(mapType==3){
    	   					updateGaodeMap();
        	   			}else if(mapType==4){
        	   				updateXiuYouMap();
            	   		}else{
		    				for(var i=0;i<data.data.length;i++){
		    					for(var k=0;k<vehicles.length;k++){
		    						if(data.data[i].vehicleId == vehicles[k].id ){
				    					if(msgid== data.data[i].vehicleId){
			    							document.getElementById('weizhi').innerHTML = vehicles[k].vhcCode+"： " + data.data[i].memo;
											document.getElementById('weizhi').title = vehicles[k].vhcCode+"： " + data.data[i].memo;
			    						}
			    						
			    					//if(data.data[i].vehicleId == vehicles[k].id && data.data[i].lat != 0 && data.data[i].lng !=0){
			    							var myLatlng = new google.maps.LatLng(data.data[i].lat,data.data[i].lng);
			    							var s=10;
											var condition=data.data[i].state2;
										  	var sp = parseInt(data.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( data.data[i].av == 0 ){
												s=7;
											}
										var newtime = new Date().getTime();
										var ttime =data.data[i].recvtime.replace("-","/");
										ttime=ttime.replace("-","/");
										ttime=ttime.replace("T"," ");
										var oldtime = new Date(ttime).getTime();
										//alert(newtime-oldtime);
										if(newtime-oldtime > 600000){
											s=2;
										}
									  		
										  	var state =s;
										  	var pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_0.gif";
											if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/green_";
											else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_";
											else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/gray_";
											else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/yellow_";
											else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/pink_";
											else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/stopalarm";
											else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/blue_";
										else pngicon = "<%=basePath%>gpsonline/image/pic/"+vehicles[k].icon+"/red_";
												 var direction="";
												 var t = parseInt(data.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 b = new Base64();  
												//	var carname = b.encode(vehicles[k].vhcCode);  
													var carname = encodeURI(encodeURI(vehicles[k].vhcCode)); 
													var temp,temp1,temp2,temp3,temp4;
													if(data.data[i].temperature != null && data.data[i].temperature <=127){
														temp=data.data[i].temperature +" ℃";
													}else{
														temp="无效";
													}
													if(data.data[i].temp1 != null && data.data[i].temp1 <=127){
														temp1=data.data[i].temp1 +" ℃";
													}else{
														temp1="无效";
													}
													if(data.data[i].temp2 != null && data.data[i].temp2 <=127){
														temp2=data.data[i].temp2 +" ℃";
													}else{
														temp2="无效";
													}
													if(data.data[i].temp3 != null && data.data[i].temp3 <=127){
														temp3=data.data[i].temp3 +" ℃";
													}else{
														temp3="无效";
													}
													if(data.data[i].temp4 != null && data.data[i].temp4 <=127){
														temp4=data.data[i].temp4 +" ℃";
													}else{
														temp4="无效";
													}
													 var contentString = "";
												    if(isHasPBackAut()){
												    	contentString = "<div id='app_"+data.data[i].vehicleId+"'><p>"+
														"<div id='app1_"+data.data[i].vehicleId+"' style='display:block'><b>设备名称：</b>"+vehicles[k].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].vehicleId+"' style='display:block'><b>设备ID：</b>"+vehicles[k].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].vehicleId+"' style='display:block'><b>到期时间：</b>"+(vehicles[k].overduetime != null && vehicles[k].overduetime.indexOf("19") != 0 ? vehicles[k].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].vehicleId+"' style='display:block'><b>启用时间：</b>"+(vehicles[k].posavtime != null && vehicles[k].posavtime.indexOf("19") != 0 ? vehicles[k].posavtime :"")+"</br></div>"
															
														+"<div id='app14_"+data.data[i].vehicleId+"' style='display:block'><b>备注：</b>"+vehicles[k].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].vehicleId+"' style='display:block'><b>经纬度：</b>"+data.data[i].lng+","+data.data[i].lat+"</br></div>"
														+"<div id='app11_"+data.data[i].vehicleId+"' style='display:block'><b>SIM卡号：</b>"+vehicles[k].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].vehicleId+"' style='display:block'><b>服务器时间：</b>"+data.data[i].recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].vehicleId+"' style='display:block'><b>GPS时间：</b>"+data.data[i].gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].vehicleId+"' style='display:block'><b>速度：</b>"+data.data[i].speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].vehicleId+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].vehicleId+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
														+"<div id='app6_"+data.data[i].vehicleId+"' style='display:block'><b>油量：</b>"+data.data[i].oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].vehicleId+"' style='display:block'><b>当日里程：</b>"+data.data[i].distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].vehicleId+"' style='display:block'><b>总里程：</b>"+data.data[i].totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].vehicleId+"' style='display:block'><b>状态：</b>"+data.data[i].state2+"</br></div>"
														+"<div id='app10_"+data.data[i].vehicleId+"' style='display:block'><b>位置：</b>"+data.data[i].memo+"</br></div>"
														+"<div id='app13_"+data.data[i].vehicleId+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].vehicleId+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].vehicleId+","+data.data[i].lat+","+data.data[i].lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+vehicles[k].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+vehicles[k].id+"&carname="+carname+"&icon="+vehicles[k].icon+"' target='_blank'><font color='#0000FF'>回放</font>  |</a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+vehicles[k].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+vehicles[k].id+");\" >刷新位置</font> | </a> <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									  
													}else{
														contentString = "<div id='app_"+data.data[i].vehicleId+"'><p>"+
														"<div id='app1_"+data.data[i].vehicleId+"' style='display:block'><b>设备名称：</b>"+vehicles[k].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].vehicleId+"' style='display:block'><b>设备ID：</b>"+vehicles[k].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].vehicleId+"' style='display:block'><b>到期时间：</b>"+(vehicles[k].overduetime != null && vehicles[k].overduetime.indexOf("19") != 0 ? vehicles[k].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].vehicleId+"' style='display:block'><b>启用时间：</b>"+(vehicles[k].posavtime != null && vehicles[k].posavtime.indexOf("19") != 0 ? vehicles[k].posavtime :"")+"</br></div>"
															
														+"<div id='app14_"+data.data[i].vehicleId+"' style='display:block'><b>备注：</b>"+vehicles[k].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].vehicleId+"' style='display:block'><b>经纬度：</b>"+data.data[i].lng+","+data.data[i].lat+"</br></div>"
														+"<div id='app11_"+data.data[i].vehicleId+"' style='display:block'><b>SIM卡号：</b>"+vehicles[k].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].vehicleId+"' style='display:block'><b>服务器时间：</b>"+data.data[i].recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].vehicleId+"' style='display:block'><b>GPS时间：</b>"+data.data[i].gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].vehicleId+"' style='display:block'><b>速度：</b>"+data.data[i].speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].vehicleId+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].vehicleId+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br></div>"
														+"<div id='app6_"+data.data[i].vehicleId+"' style='display:block'><b>油量：</b>"+data.data[i].oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].vehicleId+"' style='display:block'><b>当日里程：</b>"+data.data[i].distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].vehicleId+"' style='display:block'><b>总里程：</b>"+data.data[i].totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].vehicleId+"' style='display:block'><b>状态：</b>"+data.data[i].state2+"</br></div>"
														+"<div id='app10_"+data.data[i].vehicleId+"' style='display:block'><b>位置：</b>"+data.data[i].memo+"</br></div>"
														+"<div id='app13_"+data.data[i].vehicleId+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].vehicleId+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].vehicleId+","+data.data[i].lat+","+data.data[i].lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+vehicles[k].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+vehicles[k].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+vehicles[k].id+");\" >刷新位置</font> | </a> <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									  
													}
									 				
							    					 
							    					vehicles[k].marker.setIcon(new google.maps.MarkerImage(pngicon+image, new (25, 25),new google.maps.Point(0,0),new google.maps.Point(10, 10)));
							    					vehicles[k].infowindow.setContent(contentString);
													
													var WinShowParms = getCurUserWinShowParms();
											
											if(WinShowParms!=null){
												var app1_ = document.getElementById("app1_"+data.data[i].vehicleId);
													if(app1_ != null){
														app1_.style.display ="none";
														var app2_ = document.getElementById("app2_"+data.data[i].vehicleId);
														app2_.style.display ="none";
														var app3_ = document.getElementById("app3_"+data.data[i].vehicleId);
														app3_.style.display ="none";
														var app4_ = document.getElementById("app4_"+data.data[i].vehicleId);
														app4_.style.display ="none";
														var app5_ = document.getElementById("app5_"+data.data[i].vehicleId);
														app5_.style.display ="none";
														var app6_ = document.getElementById("app6_"+data.data[i].vehicleId);
														app6_.style.display ="none";
														var app7_ = document.getElementById("app7_"+data.data[i].vehicleId);
														app7_.style.display ="none";
														var app8_ = document.getElementById("app8_"+data.data[i].vehicleId);
														app8_.style.display ="none";
														var app9_ = document.getElementById("app9_"+data.data[i].vehicleId);
														app9_.style.display ="none";
														var app10_ = document.getElementById("app10_"+data.data[i].vehicleId);
														app10_.style.display ="none";
														var app11_ = document.getElementById("app11_"+data.data[i].vehicleId);
														app11_.style.display ="none";
														var app12_ = document.getElementById("app12_"+data.data[i].vehicleId);
														app12_.style.display ="none";
														var app13_ = document.getElementById("app13_"+data.data[i].vehicleId);
														app13_.style.display ="none";
														var app14_ = document.getElementById("app14_"+data.data[i].vehicleId);
														app14_.style.display ="none";
														var app15_ = document.getElementById("app15_"+data.data[i].vehicleId);
														app15_.style.display ="none";
														var app16_ = document.getElementById("app16_"+data.data[i].vehicleId);
														app16_.style.display ="none";
														var app17_ = document.getElementById("app17_"+data.data[i].vehicleId);
														app17_.style.display ="none";
														var app18_ = document.getElementById("app18_"+data.data[i].vehicleId);
														app18_.style.display ="none";
														for(var ws=0;ws<WinShowParms.length;ws++){
												      		if(WinShowParms[ws]==1){
												      			app1_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==2){
												      			app2_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==3){
												      			app3_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==4){
												      			app4_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==5){
												      			app5_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==6){
												      			app6_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==7){
												      			app7_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==8){
												      			app8_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==9){
												      			app9_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==10){
												      			app10_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==11){
												      			app11_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==12){
												      			app12_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==13){
												      			app13_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==14){
												      			app14_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==15){
												      			app15_.style.display ="block";
												      		}
															if(WinShowParms[ws]==16){
												      			app16_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==17){
												      			app17_.style.display ="block";
												      		}
												      		if(WinShowParms[ws]==18){
												      			app18_.style.display ="block";
												      		}
												      	}
												      	var app_ = document.getElementById("app_"+data.data[i].vehicleId);
												      	vehicles[k].infowindow.setContent(app_);
													}
												
								    			}	
							    				
							    					
							    					//if((data.data[i].lat == 0 &&data.data[i].lng == 0) || data.data[i].av == 0){
							    					if(data.data[i].lat == 0 &&data.data[i].lng == 0){
														//vehicles[k].marker.setMap(null);
														//vehicles[k].label.setMap(null);
													}else{
														vehicles[k].latlng=myLatlng;
														vehicles[k].marker.setPosition(myLatlng);
														//vehicles[k].label.setMap(null);	
														vehicles[k].label = new LableMarker(map,vehicles[k].vhcCode,myLatlng);	 
														vehicles[k].marker.setMap(map);
														
														/*if(namekg == true){
															vehicles[k].label.setMap(null);
														}else{
															vehicles[k].label.setMap(map);	
														}*/
														
													}
			    							
			    					}
			    				}
		    				}
		    			}
    				}
				 }else{
				 	counter++;
	            	if(counter>=4){
	            		window.location.replace("<%=basePath%>gpsonline/jsp/login.jsp");
	            	}
				 }
				 gids="";
	        },
	        error: function() {
	        	 gids="";
	            	counter++;
	            	if(counter>=4){
	            		window.location.replace("<%=basePath%>gpsonline/jsp/login.jsp");
	            	}
			    }
	   });
            }}
       if(qonun==-1){
    	   showstatusThree(-1)
       }else if(qonun==0){
    	   showstatusThree(0)
       }else{
    	   showstatusThree(1)
       }
    }
   
	function setContentString() {
		 if(msgid != null && msgid !=""){
		 	centerMap(msgid,0,"");
		 }
		
	}

	function updateMarkerData(id){
		centerMap(id,1,true);
	}
	
   	var isUpdate = false;
    function centerMap(id,db,isDatabase){
    	msgid=id;
    	isUpdate = false;
    	markerObject.closeInfowindow();//关闭打开的标注弹出框
    	if(menu!=null){
        	menu.hide();
        }
        var tdata=1;
        if(isDatabase==true){
        	tdata=0;
        }
   		$.ajax({
	        type: "POST",
	        dataType: "json",
	        async:true,
	        url: "json/vehicleAction_byids.action",
	        data: {ids:id,t:tdata},
	        success: function(data){
		        //console.info(JSON.stringify(data));
		      	if(data.flag==true){
    				if(data.data.length>0){
    					var isCf = false;
    				    for(var i=0;i<carIds.length;i++){
    				    	if(carIds[i]==id){
    				    		isCf=true;
    				    	}
    				    }
    				    if(isCf == false){
    				    	carIds.push(id);
    				    }
    					if(isLargeData==true){
							if(carList=="null" || carList=="" ||carList== null){
								carList=data;
							}else{
								for(var i=0;i<data.data.length;i++){
		    						for(var j=0;j<carList.data.length;j++){
		    							if(data.data[i].id == carList.data[j].id){
		    								carList.data[j] = data.data[i];
		    								isUpdate = true;
		    							}
		    						}
		    						if(isUpdate==false){
		    							carList.data.push(data.data[0]);
		    						}
		    					}
							}
						}else{
	    					for(var i=0;i<data.data.length;i++){
	    						for(var j=0;j<carList.data.length;j++){
	    							if(data.data[i].id == carList.data[j].id){
	    								carList.data[j] = data.data[i];
	    							}
	    						}
	    					}
    					}
    					for(var i=0;i<data.data.length;i++){
    						//if(data.data[i].positionLast.lat != 0 &&data.data[i].positionLast.lng != 0 && data.data[i].positionLast.av == 1){
    							//if(data.data[i].positionLast.lat != 0 && data.data[i].positionLast.lng != 0){
    								if(mapType==2){
    									streeViewObject.show(data.data[i].id,data.data[i].positionLast.lat,data.data[i].positionLast.lng,parseInt(data.data[i].positionLast.direct),5);
				      				}else{
				      					streeViewObject.show(data.data[i].id,data.data[i].positionLast.blat,data.data[i].positionLast.blng,parseInt(data.data[i].positionLast.direct),3);
				      				}
				      			if(mapType==1){
		    		   				centerBaiduMap(data,db);
		    		   				return;
		    	   				}else if(mapType==3){
									centerGaoDeMap(data);
		    	   					return;
			    	   			}else if(mapType==4){
			    	   				centerXiuYouMap(data);
		    	   					return;
				    	   		}else{
			    	   				
		    	   					if(isLargeData==true){
		    	   						if(vehicles.length>0){
		    	   							for(var j=0;j<vehicles.length;j++){
												vehicles[j].infowindow.close();
											} 
											for(var k=0;k<vehicles.length;k++){
					    						if(data.data[i].id == vehicles[k].id){
					    							vehicles[k].vhcCode=data.data[i].vhcCode;
					    							isUpdate = true;
					    							var myLatlng = new google.maps.LatLng(data.data[i].positionLast.lat,data.data[i].positionLast.lng);
					    							var s=10;
													var condition=data.data[i].positionLast.state2;
												  	var sp = parseInt(data.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(data.data[i].positionLast.av == 0 ){
													s=7;
												}
												var newtime = new Date().getTime();
												var ttime =data.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 = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_0.gif";
											if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/green_";
											else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_";
											else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/gray_";
											else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/yellow_";
											else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/pink_";
											else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/stopalarm";
											else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/blue_";
											else pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_";
											var direction="";
											var t = parseInt(data.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 marker = addMarker(myLatlng,carList.data[x].vhcCode,pngicon+image);
												//var b = new Base64();  
												//var carname = b.encode(data.data[i].vhcCode);  
												var carname = encodeURI(encodeURI(data.data[i].vhcCode)); 
												var temp,temp1,temp2,temp3,temp4;
													if(data.data[i].positionLast.temperature != null && data.data[i].positionLast.temperature <=127){
														temp=data.data[i].positionLast.temperature +" ℃";
													}else{
														temp="无效";
													}
													if(data.data[i].positionLast.temp1 != null && data.data[i].positionLast.temp1 <=127){
														temp1=data.data[i].positionLast.temp1 +" ℃";
													}else{
														temp1="无效";
													}
													if(data.data[i].positionLast.temp2 != null && data.data[i].positionLast.temp2 <=127){
														temp2=data.data[i].positionLast.temp2 +" ℃";
													}else{
														temp2="无效";
													}
													if(data.data[i].positionLast.temp3 != null && data.data[i].positionLast.temp3 <=127){
														temp3=data.data[i].positionLast.temp3 +" ℃";
													}else{
														temp3="无效";
													}
													if(data.data[i].positionLast.temp4 != null && data.data[i].positionLast.temp4 <=127){
														temp4=data.data[i].positionLast.temp4 +" ℃";
													}else{
														temp4="无效";
													}
													var contentString = "";
												    if(isHasPBackAut()){
												    	contentString = "<div id='app_"+data.data[i].id+"'><p>"+
														"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
															
														+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
														+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
														+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
														+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
														+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[i].id+"&carname="+carname+"&icon="+data.data[i].icon+"' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									  
													}else{
														contentString = "<div id='app_"+data.data[i].id+"'><p>"+
														"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
														+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
														+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
														+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
														+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
														+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									  
													}
									  			 
												    var icon_size=real(data.data[i].icon);
						    					vehicles[k].marker.setIcon(new google.maps.MarkerImage(pngicon+image, new google.maps.Size(icon_size, icon_size),new google.maps.Point(0,0),new google.maps.Point(10, 10)));
						    					
						    					
						    					
												if(data.data[i].positionLast.lat != 0 && data.data[i].positionLast.lng != 0){
													vehicles[k].latlng=myLatlng;		 
						    						vehicles[k].marker.setPosition(myLatlng);
						    						vehicles[k].label.setMap(null);
						    						vehicles[k].label = new LableMarker(map,data.data[i].vhcCode,myLatlng);
						    						
												}
												if(namekg == true){
														vehicles[k].label.setMap(null);
												}
						    					
						    					vehicles[k].infowindow.open(map,vehicles[k].marker);
						    			var WinShowParms = getCurUserWinShowParms();
											
										if(WinShowParms!=null){
											var app1_ = document.getElementById("app1_"+data.data[i].id);
											app1_.style.display ="none";
											var app2_ = document.getElementById("app2_"+data.data[i].id);
											app2_.style.display ="none";
											var app3_ = document.getElementById("app3_"+data.data[i].id);
											app3_.style.display ="none";
											var app4_ = document.getElementById("app4_"+data.data[i].id);
											app4_.style.display ="none";
											var app5_ = document.getElementById("app5_"+data.data[i].id);
											app5_.style.display ="none";
											var app6_ = document.getElementById("app6_"+data.data[i].id);
											app6_.style.display ="none";
											var app7_ = document.getElementById("app7_"+data.data[i].id);
											app7_.style.display ="none";
											var app8_ = document.getElementById("app8_"+data.data[i].id);
											app8_.style.display ="none";
											var app9_ = document.getElementById("app9_"+data.data[i].id);
											app9_.style.display ="none";
											var app10_ = document.getElementById("app10_"+data.data[i].id);
											app10_.style.display ="none";
											var app11_ = document.getElementById("app11_"+data.data[i].id);
											app11_.style.display ="none";
											var app12_ = document.getElementById("app12_"+data.data[i].id);
											app12_.style.display ="none";
											var app13_ = document.getElementById("app13_"+data.data[i].id);
											app13_.style.display ="none";
											var app14_ = document.getElementById("app14_"+data.data[i].id);
											app14_.style.display ="none";
											var app15_ = document.getElementById("app15_"+data.data[i].id);
											app15_.style.display ="none";
											var app16_ = document.getElementById("app16_"+data.data[i].id);
											app16_.style.display ="none";
											var app17_ = document.getElementById("app17_"+data.data[i].id);
											app17_.style.display ="none";
											var app18_ = document.getElementById("app18_"+data.data[i].id);
											app18_.style.display ="none";
											for(var ws=0;ws<WinShowParms.length;ws++){
									      		if(WinShowParms[ws]==1){
									      			app1_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==2){
									      			app2_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==3){
									      			app3_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==4){
									      			app4_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==5){
									      			app5_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==6){
									      			app6_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==7){
									      			app7_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==8){
									      			app8_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==9){
									      			app9_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==10){
									      			app10_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==11){
									      			app11_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==12){
									      			app12_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==13){
									      			app13_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==14){
									      			app14_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==15){
									      			app15_.style.display ="block";
									      		}
												if(WinShowParms[ws]==16){
									      			app16_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==17){
									      			app17_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==18){
									      			app18_.style.display ="block";
									      		}
									      	}
									      	var app_ = document.getElementById("app_"+data.data[i].id);
											vehicles[k].infowindow.setContent(app_);
										}
												//document.getElementById('weizhi').innerHTML = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
												//document.getElementById('weizhi').title  = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
												msgid= data.data[i].id;
												msgname= data.data[i].vhcCode;
												if(map.getZoom()<13){
													map.setZoom(13);
												}
												
														if(db==1){
																  map.setCenter(new google.maps.LatLng(data.data[0].positionLast.lat,data.data[0].positionLast.lng));
														}
					    						}
					    					}
		    	   						}
		    	   						if(isUpdate==false || vehicles.length ==0){
			    							
					    						for(i=0;i<data.data.length;i++){
										    		(function(x){
										    		var myLatlng = new google.maps.LatLng(data.data[x].positionLast.lat,data.data[x].positionLast.lng);
														
													var s=10;
													var condition=data.data[x].positionLast.state2;
												  	var sp = parseInt(data.data[x].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[i].positionLast.av == 0 ){
														s=7;
													}
												var newtime = new Date().getTime();
															var ttime =data.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 = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_0.gif";
												if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/green_";
												else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_";
												else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/gray_";
												else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/yellow_";
												else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/pink_";
												else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/stopalarm";
												else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/blue_";
												else pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[x].icon+"/red_";
														 var direction="";
														 var t = parseInt(data.data[x].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 icon_size=real(data.data[i].icon);
													    var marker = new google.maps.Marker({
														      position: myLatlng,
														      map: map,
														      icon: new google.maps.MarkerImage(pngicon+image, new google.maps.Size(icon_size, icon_size),new google.maps.Point(0,0),new google.maps.Point(10, 10)),
														      title:data.data[x].vhcCode
														});
														//var b = new Base64();  
							            				//var carname = b.encode(data.data[x].vhcCode); 
							            				var carname = encodeURI(encodeURI(data.data[x].vhcCode)); 
														//alert(carname);
														markersArray.push(marker);
													var temp,temp1,temp2,temp3,temp4;
													if(data.data[i].positionLast.temperature != null && data.data[i].positionLast.temperature <=127){
														temp=data.data[i].positionLast.temperature +" ℃";
													}else{
														temp="无效";
													}
													if(data.data[i].positionLast.temp1 != null && data.data[i].positionLast.temp1 <=127){
														temp1=data.data[i].positionLast.temp1 +" ℃";
													}else{
														temp1="无效";
													}
													if(data.data[i].positionLast.temp2 != null && data.data[i].positionLast.temp2 <=127){
														temp2=data.data[i].positionLast.temp2 +" ℃";
													}else{
														temp2="无效";
													}
													if(data.data[i].positionLast.temp3 != null && data.data[i].positionLast.temp3 <=127){
														temp3=data.data[i].positionLast.temp3 +" ℃";
													}else{
														temp3="无效";
													}
													if(data.data[i].positionLast.temp4 != null && data.data[i].positionLast.temp4 <=127){
														temp4=data.data[i].positionLast.temp4 +" ℃";
													}else{
														temp4="无效";
													}
												    if(isHasPBackAut()){
												    	contentString = "<div id='app_"+data.data[i].id+"'><p>"+
														"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
													
														+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
														+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
														+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
														+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
														+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[i].id+"&carname="+carname+"&icon="+data.data[i].icon+"' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									 
													}else{
														contentString = "<div id='app_"+data.data[i].id+"'><p>"+
														"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"</br></div>"
														+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
														+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
														+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
													
														+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
														+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
														+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
														+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
														+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
														+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
														+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
														+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
														+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
														+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
														+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
														+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
														+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
														+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
														+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
									 
													}
									  			
									  			
									  					
														 var infowindow = new google.maps.InfoWindow({
														      content: contentString
														      //,zIndex:10
														  });			
														//var infowindow = new InfoBox(myOptions);
														google.maps.event.addListener(marker, "click", function (e) {
														 	//alert($(boxText).css("height"));
														 	
														 	markerObject.closeInfowindow();//关闭打开的标注弹出框
													    	if(menu!=null){
													        	menu.hide();
													        }
														 	
														    for(var i=0;i<vehicles.length;i++){
														          vehicles[i].infowindow.close();
														    }					    
															infowindow.open(map, this);
										var WinShowParms = getCurUserWinShowParms();
											
										if(WinShowParms!=null){
											var app1_ = document.getElementById("app1_"+data.data[i].id);
											app1_.style.display ="none";
											var app2_ = document.getElementById("app2_"+data.data[i].id);
											app2_.style.display ="none";
											var app3_ = document.getElementById("app3_"+data.data[i].id);
											app3_.style.display ="none";
											var app4_ = document.getElementById("app4_"+data.data[i].id);
											app4_.style.display ="none";
											var app5_ = document.getElementById("app5_"+data.data[i].id);
											app5_.style.display ="none";
											var app6_ = document.getElementById("app6_"+data.data[i].id);
											app6_.style.display ="none";
											var app7_ = document.getElementById("app7_"+data.data[i].id);
											app7_.style.display ="none";
											var app8_ = document.getElementById("app8_"+data.data[i].id);
											app8_.style.display ="none";
											var app9_ = document.getElementById("app9_"+data.data[i].id);
											app9_.style.display ="none";
											var app10_ = document.getElementById("app10_"+data.data[i].id);
											app10_.style.display ="none";
											var app11_ = document.getElementById("app11_"+data.data[i].id);
											app11_.style.display ="none";
											var app12_ = document.getElementById("app12_"+data.data[i].id);
											app12_.style.display ="none";
											var app13_ = document.getElementById("app13_"+data.data[i].id);
											app13_.style.display ="none";
											var app14_ = document.getElementById("app14_"+data.data[i].id);
											app14_.style.display ="none";
											var app15_ = document.getElementById("app15_"+data.data[i].id);
											app15_.style.display ="none";
											var app16_ = document.getElementById("app16_"+data.data[i].id);
											app16_.style.display ="none";
											var app17_ = document.getElementById("app17_"+data.data[i].id);
											app17_.style.display ="none";
											var app18_ = document.getElementById("app18_"+data.data[i].id);
											app18_.style.display ="none";
											for(var ws=0;ws<WinShowParms.length;ws++){
									      		if(WinShowParms[ws]==1){
									      			app1_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==2){
									      			app2_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==3){
									      			app3_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==4){
									      			app4_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==5){
									      			app5_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==6){
									      			app6_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==7){
									      			app7_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==8){
									      			app8_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==9){
									      			app9_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==10){
									      			app10_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==11){
									      			app11_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==12){
									      			app12_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==13){
									      			app13_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==14){	
									      			app14_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==15){
									      			app15_.style.display ="block";
									      		}
												if(WinShowParms[ws]==16){
									      			app16_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==17){
									      			app17_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==18){
									      			app18_.style.display ="block";
									      		}
									      	}
									      	var app_ = document.getElementById("app_"+data.data[i].id);
											infowindow.setContent(app_);
										}
															document.getElementById('weizhi').innerHTML = data.data[x].vhcCode+"： " + data.data[x].positionLast.memo;
															document.getElementById('weizhi').title = data.data[x].vhcCode+"： " + data.data[x].positionLast.memo;
															
														});
														
														
														//var infowindow = new InfoBox(myOptions);
							
														var vehicle = new Object();
													    vehicle.id = data.data[x].id;
													    vehicle.vhcCode = data.data[x].vhcCode;
														vehicle.label = new LableMarker(map,data.data[x].vhcCode,myLatlng);
														//vehicle.label.setMap(null);
														vehicle.marker = marker;
														vehicle.icon = data.data[x].icon;
														vehicle.infowindow = infowindow;
														vehicle.latlng = myLatlng;
														//if((data.data[x].positionLast.lat == 0 &&data.data[x].positionLast.lng == 0) || data.data[i].av == 0){
														if(data.data[x].positionLast.lat == 0 &&data.data[x].positionLast.lng == 0){
															//vehicle.marker.setMap(null);
															//vehicle.label.setMap(null);
														}
														//if( namekg == false ){
															//vehicle.label.setMap(map);
														//}
														vehicles.push(vehicle);
														infowindow.open(map,marker);
														document.getElementById('weizhi').innerHTML = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
														document.getElementById('weizhi').title  = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
														if(map.getZoom()<13){
															map.setZoom(13);
														}
																if(db==1){
																		  map.setCenter(new google.maps.LatLng(data.data[0].positionLast.lat,data.data[0].positionLast.lng));
																}
							    						
										    		})(i);
									         }
					    					
			    						}
		    	   					}else{
//----------
		    	   						for(var j=0;j<vehicles.length;j++){
											vehicles[j].infowindow.close();
										}
					      				for(var k=0;k<vehicles.length;k++){
				    						if(data.data[i].id == vehicles[k].id){
				    							vehicles[k].vhcCode=data.data[i].vhcCode;
				    							var myLatlng = new google.maps.LatLng(data.data[i].positionLast.lat,data.data[i].positionLast.lng);
				    							var s=10;
												var condition=data.data[i].positionLast.state2;
											  	var sp = parseInt(data.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( data.data[i].positionLast.av == 0 ){
													s=7;
												}
											var newtime = new Date().getTime();
											var ttime =data.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 = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_0.gif";
												if(state == 0) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/green_";
												else if(state == 1) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_";
												else if(state == 2) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/gray_";
												else if(state == 3) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/yellow_";
												else if(state == 4) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/pink_";
												else if(state == 5) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/stopalarm";
												else if(state == 7) pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/blue_";
												else pngicon = "<%=basePath%>gpsonline/image/pic/"+data.data[i].icon+"/red_";
										 var direction="";
										 var t = parseInt(data.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(data.data[i].vhcCode)); 
											var temp,temp1,temp2,temp3,temp4;
											if(data.data[i].positionLast.temperature != null && data.data[i].positionLast.temperature <=127){
												temp=data.data[i].positionLast.temperature +" ℃";
											}else{
												temp="无效";
											}
											if(data.data[i].positionLast.temp1 != null && data.data[i].positionLast.temp1 <=127){
												temp1=data.data[i].positionLast.temp1 +" ℃";
											}else{
												temp1="无效";
											}
											if(data.data[i].positionLast.temp2 != null && data.data[i].positionLast.temp2 <=127){
												temp2=data.data[i].positionLast.temp2 +" ℃";
											}else{
												temp2="无效";
											}
											if(data.data[i].positionLast.temp3 != null && data.data[i].positionLast.temp3 <=127){
												temp3=data.data[i].positionLast.temp3 +" ℃";
											}else{
												temp3="无效";
											}
											if(data.data[i].positionLast.temp4 != null && data.data[i].positionLast.temp4 <=127){
												temp4=data.data[i].positionLast.temp4 +" ℃";
											}else{
												temp4="无效";
											}
											var contentString = "";
											//console.info("isHasPBackAut():",isHasPBackAut());
										    if(isHasPBackAut()){
										    	contentString = "<div id='app_"+data.data[i].id+"'><p>"+
												"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"<a href='javascript:void(0);'class='map_setting_ico' onclick='setSystemObject.openWin();' style='top:0px; margin-right:5px;'><span></span></a></br></div>"
												+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
												+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
												+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
												+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
												+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
												+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
												+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
												+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
												+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
												+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
												+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
												+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
												+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
												+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
												+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
												+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
												+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
												+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='"+url+"gpsonline/jsp/monitor/playBack.jsp?carid="+data.data[i].id+"&carname="+carname+"&icon="+data.data[i].icon+"' target='_blank'><font color='#0000FF'>回放</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
							 
											}else{
												contentString = "<div id='app_"+data.data[i].id+"'><p>"+
												"<div id='app1_"+data.data[i].id+"' style='display:block'><b>设备名称：</b>"+data.data[i].vhcCode+"</br></div>"
												+"<div id='app18_"+data.data[i].id+"' style='display:block'><b>设备ID：</b>"+data.data[i].gprsCode+"</br></div>"
												+"<div id='app16_"+data.data[i].id+"' style='display:block'><b>到期时间：</b>"+(data.data[i].overduetime != null && data.data[i].overduetime.indexOf("19") != 0 ? data.data[i].overduetime:"")+"</br></div>"
												+"<div id='app17_"+data.data[i].id+"' style='display:block'><b>启用时间：</b>"+(data.data[i].posavtime != null && data.data[i].posavtime.indexOf("19") != 0 ? data.data[i].posavtime :"")+"</br></div>"
													
												+"<div id='app14_"+data.data[i].id+"' style='display:block'><b>备注：</b>"+data.data[i].remark+"</br></div>"
												+"<div id='app15_"+data.data[i].id+"' style='display:block'><b>经纬度：</b>"+data.data[i].positionLast.lng+","+data.data[i].positionLast.lat+"</br></div>"
												+"<div id='app11_"+data.data[i].id+"' style='display:block'><b>SIM卡号：</b>"+data.data[i].simCode+"</br></div>"
												+"<div id='app2_"+data.data[i].id+"' style='display:block'><b>服务器时间：</b>"+data.data[i].positionLast.recvtime+"</br></div>"
												+"<div id='app12_"+data.data[i].id+"' style='display:block'><b>GPS时间：</b>"+data.data[i].positionLast.gpstime+"</br></div>"
												+"<div id='app3_"+data.data[i].id+"' style='display:block'><b>速度：</b>"+data.data[i].positionLast.speed+" km/h </br></div>"
												+"<div id='app4_"+data.data[i].id+"' style='display:block'><b>方向：</b>"+direction+"</br></div>"
												+"<div id='app5_"+data.data[i].id+"' style='display:block'><b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+" | <b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+" </br></div>"
												+"<div id='app6_"+data.data[i].id+"' style='display:block'><b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br></div>"
												+"<div id='app7_"+data.data[i].id+"' style='display:block'><b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br></div>"
												+"<div id='app8_"+data.data[i].id+"' style='display:block'><b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br></div>"
												+"<div id='app9_"+data.data[i].id+"' style='display:block'><b>状态：</b>"+data.data[i].positionLast.state2+"</br></div>"
												+"<div id='app10_"+data.data[i].id+"' style='display:block'><b>位置：</b>"+data.data[i].positionLast.memo+"</br></div>"
												+"<div id='app13_"+data.data[i].id+"' style='display:block'><b>OBD/CAN数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br></div>"
												+"<a href='javascript:streeViewObject.open("+data.data[i].id+","+data.data[i].positionLast.lat+","+data.data[i].positionLast.lng+","+t+","+5+");'><font color='#0000FF'>街景</font> | </a><a href='"+url+"gpsonline/jsp/TrackMap.jsp?carid="+data.data[i].id+"&mapType=2' target='_blank'><font color='#0000FF'>跟踪</font> | </a><a href='javascript:;' ><font color='#0000FF' onclick=\"openDriverInfo("+data.data[i].id+");\" >驾驶员</font> | </a> <a href='javascript:;' ><font color='#0000FF' onclick=\"updateWeizhi("+data.data[i].id+");\" >刷新位置</font> | </a> <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div>";
							 
											}
							  				
										    var icon_size=real(data.data[i].icon);
					    					vehicles[k].marker.setIcon(new google.maps.MarkerImage(pngicon+image, new google.maps.Size(icon_size, icon_size),new google.maps.Point(0,0),new google.maps.Point(10, 10)));
					    					
					    					
					    					
											if(data.data[i].positionLast.lat != 0 &&data.data[i].positionLast.lng != 0){
															//vehicle.marker.setMap(null);
															//vehicle.label.setMap(null);
															vehicles[k].latlng=myLatlng;		 
					    									vehicles[k].marker.setPosition(myLatlng);	
					    									//vehicles[k].label.setMap(null);
					    									vehicles[k].label = new LableMarker(map,data.data[i].vhcCode,myLatlng);
					    									
											}
											if(namekg == true){
													//vehicles[k].label.setMap(null);
											}
					    					//vehicles[k].infowindow.setContent(contentString);
					    					vehicles[k].infowindow.open(map,vehicles[k].marker);
					    					var WinShowParms = getCurUserWinShowParms();
					    				vehicles[k].infowindow.setContent(contentString);	
										if(WinShowParms!=null){
											var app1_ = document.getElementById("app1_"+data.data[i].id);
											app1_.style.display ="none";
											var app2_ = document.getElementById("app2_"+data.data[i].id);
											app2_.style.display ="none";
											var app3_ = document.getElementById("app3_"+data.data[i].id);
											app3_.style.display ="none";
											var app4_ = document.getElementById("app4_"+data.data[i].id);
											app4_.style.display ="none";
											var app5_ = document.getElementById("app5_"+data.data[i].id);
											app5_.style.display ="none";
											var app6_ = document.getElementById("app6_"+data.data[i].id);
											app6_.style.display ="none";
											var app7_ = document.getElementById("app7_"+data.data[i].id);
											app7_.style.display ="none";
											var app8_ = document.getElementById("app8_"+data.data[i].id);
											app8_.style.display ="none";
											var app9_ = document.getElementById("app9_"+data.data[i].id);
											app9_.style.display ="none";
											var app10_ = document.getElementById("app10_"+data.data[i].id);
											app10_.style.display ="none";
											var app11_ = document.getElementById("app11_"+data.data[i].id);
											app11_.style.display ="none";
											var app12_ = document.getElementById("app12_"+data.data[i].id);
											app12_.style.display ="none";
											var app13_ = document.getElementById("app13_"+data.data[i].id);
											app13_.style.display ="none";
											var app14_ = document.getElementById("app14_"+data.data[i].id);
											app14_.style.display ="none";
											var app15_ = document.getElementById("app15_"+data.data[i].id);
											app15_.style.display ="none";
											var app16_ = document.getElementById("app16_"+data.data[i].id);
											app16_.style.display ="none";
											var app17_ = document.getElementById("app17_"+data.data[i].id);
											app17_.style.display ="none";
											var app18_ = document.getElementById("app18_"+data.data[i].id);
											app18_.style.display ="none";
											for(var ws=0;ws<WinShowParms.length;ws++){
									      		if(WinShowParms[ws]==1){
									      			app1_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==2){
									      			app2_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==3){
									      			app3_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==4){
									      			app4_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==5){
									      			app5_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==6){
									      			app6_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==7){
									      			app7_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==8){
									      			app8_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==9){
									      			app9_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==10){
									      			app10_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==11){
									      			app11_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==12){
									      			app12_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==13){
									      			app13_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==14){
									      			app14_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==15){
									      			app15_.style.display ="block";
									      		}
												if(WinShowParms[ws]==16){
									      			app16_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==17){
									      			app17_.style.display ="block";
									      		}
									      		if(WinShowParms[ws]==18){
									      			app18_.style.display ="block";
									      		}
									      	}
									      	var app_ = document.getElementById("app_"+data.data[i].id);
											vehicles[k].infowindow.setContent(app_);
										}
											//document.getElementById('weizhi').innerHTML = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
											//document.getElementById('weizhi').title  = data.data[i].vhcCode+"： " + data.data[0].positionLast.memo;
											if(map.getZoom()<13){
												map.setZoom(13);
											}
													if(db==1){
															  map.setCenter(new google.maps.LatLng(data.data[0].positionLast.lat,data.data[0].positionLast.lng));
													}
				    						}
				    					}
		    	   					}
		      					}
    				    }
		      	   }
		      	  updateCurMenu(data);
		      	}
	        },
	        error: function() {
	         
			    }
	   });	   
    }
    
    function showCarName(){
	    if(namekg == false){
	      setbsCookie("isShowCarName",false);
	      namekg = true;
	      if(mapType==1){
	      	for(var j=0;j<markers.length;j++){
	      		if(markers[j].label != null){
	      			baidMap.removeOverlay(markers[j].label);
	      		}
		  	 }
	      }else if(mapType==3){
				for(var i = 0; i < gdMarkers.length;i++){
					gdMarkers[i].marker.setLabel(null);
				}
		  }else if(mapType==4){
			 xyMap.getOverlayLayer().clear(labels);
		  }
	    }else{
	      namekg = false;
	      setbsCookie("isShowCarName",true);
	      if(mapType==1){
		     // if(baidMap.getZoom()>12){
		      	for(var j=0;j<markers.length;j++){
		      		if(markers[j].label != null){
		      			baidMap.addOverlay(markers[j].label);
		      		}
			  	 }
		      //}
	      }else if(mapType==3){
				for(var i = 0; i < gdMarkers.length;i++){
					if(gdMarkers[i].label!=null)
					gdMarkers[i].marker.setLabel(gdMarkers[i].label);
				}
		  }else if(mapType==4){
			  for(var i = 0; i < xyMarkers.length;i++){
				  if(xyMarkers[i].label!=null)
				  xyMap.getOverlayLayer().addOverlay(xyMarkers[i].label);
			  }
		  }
	    }
    }
    var mapshowkg = false;
   function showMap(){
    	 if(mapshowkg == false){
	      mapshowkg = true;
	      document.getElementById("idx_top").style.display="none";
	      document.getElementById("index_main").className="cpageShowCanvas";
	      $(".list_main").height($(window).height()-$(".idx_top").height()-40);
	      $("#closefullscreenbtn").hide();
		  $("#fullscreenbtn").show();
	    }else{
	      mapshowkg = false;
	      document.getElementById("idx_top").style.display="";
	      document.getElementById("index_main").className="pageShowCanvas";
	      $(".list_main").height($(window).height()-($(".main_top").height()+$(".idx_top").height())-20);
	      $("#closefullscreenbtn").show();
		  $("#fullscreenbtn").hide();
	    }
    }
    var countnum;
    function setCount(){
    	clearTimeout(countnum);
    	num_s=getRefreshTime();
    	countDown();
	}
    function countDown(){
        //console.info(num_s >= 0);
        if (num_s >= 0){
        	/*alert(num == 10 && newdata!= null);
        	if(num == 10 && newdata!= null){
        		//reEquipmentStatus(newdata);
        	}
            var str = '';
            str = "<font color='red'>"+ num+" </font>" + "秒后刷新 ";
            document.getElementById('autoDir').innerHTML ="";
            document.getElementById('autoDir').innerHTML = str;*/
          //alert(num_s);
            document.getElementById('autoDir').innerHTML = "<font color='red'>"+num_s+"</font>" + " 秒后刷新 ";
            num_s--;
            countnum=setTimeout(countDown,1000);
        }else{
           num_s = getRefreshTime();
           if(alSwitch==true){
           	 al();
           }
           countDown();
        }
    }
   /////////////////////////显示车牌号码begin/////////////////////////////
   function LableMarker(map, text, latLng){
		 this.map_ = map;
		 this.text_ = '<div class="iconTheStyle" style="background:#f5fcb8;  font-size:12px; color:#000000; font-weight:bold; white-space:nowrap; border:1px solid #666666;">'+text+'</div>';
		 this.latLng_ = latLng;
		 this.div_ = null;
		 //this.setMap(map);
	}
	try{ 
		// 继承自  google.maps.OverlayView
		LableMarker.prototype = new google.maps.OverlayView();
	}catch(e){}
	// 当准备将 悬浮层 添加到地图上时 调用
	LableMarker.prototype.onAdd = function(){
		 var div = document.createElement('DIV');
		 div.style.border = 'none';
		 div.style.position='absolute';   
		 div.innerHTML = this.text_;   
		 this.div_ = div;   
		 var panes = this.getPanes();
		 panes.overlayLayer.appendChild(div);
	};
	  
	// 当第一次在地图上显示时 调用
	LableMarker.prototype.draw = function(){
		 var overlayProjection = this.getProjection();
		 var latLng = overlayProjection.fromLatLngToDivPixel(this.latLng_);
		 // 设置层的大小 和 位置
		 var div = this.div_;
		 var size = new google.maps.Size(10, -10); // 修正坐标的值;
		 div.style.left = (latLng.x + size.width) + 'px';
		 div.style.top = (latLng.y + size.height) + 'px';
	};
	// 当设置 悬浮层的 setMap(null) 会自动调用 
	LableMarker.prototype.onRemove = function(){
		 this.div_.parentNode.removeChild(this.div_);
		 this.div_ = null;
	};
	
	//地图添加MAPabc
	function addMAPabc(map){//添加MAPabc的瓦片 参数为地图对象  
	    var _tileSize = new google.maps.Size(256,256);
	    var getTileUrl = function(tile,zoom){
	        return "http://emap" + ((tile.x + tile.y) % 4) + ".mapabc.com/mapabc/maptile?v=w2.99&x=" + tile.x + "&y=" + tile.y + "&zoom=" + (17-zoom);  
	    }; 
	    var imageMapType = new google.maps.ImageMapType({alt:"MAPabc",isPng:true,maxZoom:18,minZoom:1,name:"MAPabc",tileSize: new google.maps.Size(256, 256),opacity:1.0,getTileUrl:getTileUrl});  
	    map.mapTypes.set('MAPabc',imageMapType);  
	}
	//显示路况信息
	
	var isShowTraffic=true;
	var trafficLayer=null;
	function showTraffic(){
		 if(mapType==2){
			 if(isShowTraffic){
				document.getElementById("traffic-switcher").className="maplibTcBtn google";
				trafficLayer= new google.maps.TrafficLayer();
				trafficLayer.setMap(map);
				isShowTraffic=false;
			 }else{
				document.getElementById("traffic-switcher").className="maplibTcBtnOff maplibTcBtn google";
				trafficLayer.setMap(null);
				isShowTraffic=true;
			 }
		 }else if(mapType==3){
			 if(isShowTraffic){
			 	trafficLayer.show();
			 	isShowTraffic=false;
			 }else{
				trafficLayer.hide();
			 	isShowTraffic=true; 
			 }	
		 }else if(mapType==4){
			alert("我秀地图不提供免费的实时路况信息!");
	     }else{
		 	addOrDelTra();
		 }
	}
	
	var temp=0;
	var traffic = new BMap.TrafficLayer();
	function addOrDelTra(){
		// 创建交通流量图层实例
		temp = temp+1;
		if(temp>2){
			temp=1;
		}
		if(temp == 1){
			document.getElementById("traffic-switcher").className="maplibTcBtn google";
			baidMap.addTileLayer(traffic)
		}
		if(temp == 2){
			document.getElementById("traffic-switcher").className="maplibTcBtnOff maplibTcBtn google";
			baidMap.removeTileLayer(traffic)
		}
	}
	
	
	/////////////////////////显示车牌号码end/////////////////////////////
	
	var isShowToolPane=false;
	function showtoolPanel(){
		isShowToolPane=true;
	 	$("#tools_box").show();
	}
	function hidetoolPanel(){
		setTimeout(function(){
						if(!isShowToolPane){
							$("#tools_box").hide();
							isShowToolPane=false;
							$("#showHistoryWin").animate( { width: 0}, 200 );
							$("#showHistoryWin").hide();
							historyQuery.isShowHistoryWin = false;
						}
					},500);
	}
	function updateWeizhi(id){
		$.ajax({
			 	type: "POST",
		        dataType: "json",
		        //url: "json/vehicleAction_refreshPostion.action",
		        url: "json/vehicleAction_terRefreshPostion.action",
		        data: {ids:id},
		        success: function(data){
			        if(data.flag){
			        	newdata = data;
			        	reEquipmentStatus(newdata);
			        	if(carList){
    				   		for(var i=0;i<data.data.length;i++){
	    						for(var j=0;j<carList.data.length;j++){
	    							if(data.data[i].vehicleId == carList.data[j].id){
	    								carList.data[j].positionLast = null;
	    								carList.data[j].positionLast = data.data[i];
	    							}
	    						}
	    					}
    				   }
			        	if(mapType==1){
    		   				updateBaiduMap();
    	   				}
				     }
		        },
		        error: function(){
				}
		   });
	}
	var obd_id=0;
	function getObdData(){
		
		$.ajax({
	        type: "POST",
	        dataType: "json",
	        url: "json/obdAction_getOBDdata.action",
	        data: {vid:obd_id},
	        success: function(json){ 
				if(json.data.length>0){
					var html="";
					var obd= json.data[0];
					if(json.type==1){
						html="<ul><li>电量百分比："+obd[0]+"</li>"
						+"<li>母线电压："+obd[1]+"</li>"
						+"<li>电机温度："+obd[2]+"</li>"
						+"<li>控制器温度："+obd[3]+"</li>"
						+"<li>母线电流："+obd[4]+"</li>"
						+"<li>档位："+obd[5]+"</li>"
						+"<li>ACC："+obd[6]+"</li>"
						+"<li>最高电压电池号："+obd[7]+"</li>"
						+"<li>最高电压单体编号："+obd[8]+"</li>"
						+"<li>最高单体电压："+obd[9]+"</li>"
						+"<li>最低电压电池号："+obd[10]+"</li>"
						+"<li>最低电压单体编号："+obd[11]+"</li>"
						+"<li>最低单体电压："+obd[12]+"</li>"
						+"<li>最高温度电池号："+obd[13]+"</li>"
						+"<li>最高温度单体编号："+obd[14]+"</li>"
						+"<li>最高温度："+obd[15]+"</li>"
						+"<li>最低温度电池号："+obd[16]+"</li>"
						+"<li>最低温度单体编号："+obd[17]+"</li>"
						+"<li>最低温度："+obd[18]+"</li></ul>";
					}else if(json.type==3){
						html="<ul><li>电压："+obd[0]+"</li>"
						+"<li>电流："+obd[1]+"</li>"
						+"<li>最大电压："+obd[2]+"</li>"
						+"<li>最小电压："+obd[3]+"</li>"
						+"<li>最大电压电池号："+obd[4]+"</li>"
						+"<li>最小电压电池号："+obd[5]+"</li>"
						+"<li>最高温度："+obd[6]+"</li>"
						+"<li>最大温度电池号："+obd[7]+"</li>"
						+"<li>最小温度："+obd[8]+"</li>"
						+"<li>最小温度电池号："+obd[9]+"</li>"
						+"<li>故障等级："+obd[10]+"</li>"
						+"<li>故障代码："+obd[11]+"</li>"
						+"<li>充电状态："+obd[12]+"</li>"
						+"<li>平均温度："+obd[13]+"</li>"
						+"<li>电量百分比："+obd[14]+"</li>"
						+"<li>绝缘状态："+obd[15]+"</li>"
						+"<li>功率："+obd[16]+"</li>"
						+"<li>快速充电电流："+obd[17]+"</li>"
						+"<li>慢速充电电流："+obd[18]+"</li></ul>";
					}else if(json.type==4){
						html="<ul><li>行驶里程："+obd[0]+"</li>"
						+"<li>总里程："+obd[1]+"</li>"
						+"<li>瞬时油耗："+obd[2]+"</li>"
						+"<li>百公里油耗："+obd[3]+"</li>"
						+"<li>平均油耗："+obd[4]+"</li>"
						+"<li>本次油耗："+obd[5]+"</li>"
						+"<li>累计油耗："+obd[6]+"</li>"
						+"<li>累计行驶时间："+obd[7]+"</li>"
						+"<li>累计怠速时间："+obd[8]+"</li>"
						+"<li>平均热车时间："+obd[9]+"</li>"
						+"<li>行驶时间："+obd[10]+"</li>"
						+"<li>车速："+obd[11]+"</li>"
						+"<li>发动机转速："+obd[12]+"</li>"
						+"<li>平均速度："+obd[13]+"</li>"
						+"<li>最高速度："+obd[14]+"</li>"
						+"<li>发动机最高转速："+obd[15]+"</li>"
						+"<li>水温："+obd[16]+"</li>"
						+"<li>冷却液温度："+obd[17]+"</li>"
						+"<li>发动机负荷："+obd[18]+"</li>"
						+"<li>节气门开度："+obd[19]+"</li>"
						+"<li>点火次数："+obd[20]+"</li>"
						+"<li>碰撞预警："+obd[21]+"</li>"
						+"<li>车身故障码："+obd[22]+"</li>"
						+"<li>电瓶电压："+obd[23]+"</li></ul>";
					}else{
						html="累积里程："+obd[0]+" km<br/>"
						+"瞬时油耗："+obd[1]+"<br/>"
						+"平均油耗："+obd[2]+"<br/>"
						+"行驶时间："+obd[3]+"<br/>"
						+"车速："+obd[4]+" km/h<br/>"
						+"动力负荷："+obd[5]+"<br/>"
						+"水温："+obd[6]+" ℃<br/>"
						+"节气门开度："+obd[7]+"<br/>"
						+"发动机转速："+obd[8]+"<br/>"
						+"蓄电池电压："+obd[9]+" V<br/>"
						+"故障码："+obd[10]+"<br/>";
					}
					
					$("#obdinfo").html(html);
				}else{
					$("#obd_null").show();
					$("#obd_nonull").hide();

				}
		    },
	        error: function(){
	        	 
			}
	   });
	}
	function opobd(vid){
		$("#obd_nonull").show();
		$("#obd_null").hide();
		$("#obdinfo").html("");
		$("#trackContentWin_obd").fadeIn("fast");
		$("#trackContentWin_obd").center();
		
		obd_id = vid;
		getObdData(vid);
	}
	function openMapSearchInput(){
		$("#mapsearch_input").val("");
		if($('#mapSearch_div').css('display')=='block'){
			$("#mapSearch_div").hide();
			baidMap.clearOverlays();
			var obj = getUserStatus();//取用户状态
			if(obj!=null){
				var point = new BMap.Point(obj.lng,obj.lat);
				baidMap.centerAndZoom(point,13);
			}else{
				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 = new BMap.Point(lng,lat);
				if(lat==0 && lng==0){
					baidMap.centerAndZoom(new BMap.Point(116.404,39.915),15);
				}else{
					baidMap.centerAndZoom(point,15);
				}
			}
		}else{
			$("#mapSearch_div").show();
		} 
	}
</script>


<style type="text/css">
.address{width: 420px; height: 20px; line-height: 20px; position: absolute; z-index: 10;top: -28px;}
.address span{display:inline-block; float:left;}
.address .map_time{margin-left:5px; margin-right:15px;}


/*--map 弹出框--*/
.map_tanchu_wrap p{
margin:0; 
padding:5px 10px; 
font-size:12px;
background:#fff;
}

.map_tanchu_areaQuery_wrap {
background: transparent ; 
background-color: #FFFFFF;
width:300px; 
height:150px;
margin:0 3px;
/*margin-left:100px;*/
box-shadow:0px 2px 2px #d9d7d4
}

.map_tanchu_areaQuery_wrap p{
margin:0; 
padding:5px 10px; 
font-size:12px;
background:#fff;
}
.map_tanchu_areaQuery_wrap p b{
display: block;
overflow: hidden; margin-bottom:5px;
}
.areaQuery_img{margin-top: -2px; display: inlin-block;}


.baiduareaQuery_img{margin-top: -2px; display: block; float: left;}


.xboxcontent_areaQuery {
display:block; 
border:0 solid #c2c1be; 
border-width:0 1px; 
background-color: #FFFFFF;
height: 120px;
margin-top: 22px;
overflow: auto;
width: 298px;
}

.baiduboxcontent_areaQuery {
display:block; 
height: 100px;
margin-top: 22px;
overflow: auto;
width: 300px;
}

.baiduboxcontent_areaQuery p b{
display: block;
overflow: hidden; margin-bottom:5px;
}


.baiduboxcontent_areaQuery p p{
margin:0; 
padding:5px 10px; 
font-size:12px;
background:#fff;
}

.map_tanchu_wrap {
background: transparent; 
width:300px; 
overflow:hidden;
height:auto;
margin:0 3px;
margin-left:100px;
box-shadow:0px 2px 2px #d9d7d4
}

.xtop, .xbottom {
display:block; 
background:transparent; 
font-size:1px;
}
.xb1, .xb2, .xb3, .xb4 {
display:block; 
overflow:hidden;
}
.xb1, .xb2, .xb3 {
height:1px;
}
.xb2, .xb3, .xb4 {
background:#fff; 
border-left:1px solid #c2c1be;
border-right:1px solid #c2c1be;
}
.xb1 {
margin:0 5px; 
background:#c2c1be;
}
.xb2 {
margin:0 3px;
border-width:0 2px;
}
.xb3 {
margin:0 2px;
}
.xb4 {
height:2px; 
margin:0 1px;
}

.xboxcontent {
display:block; 
border:0 solid #c2c1be; 
border-width:0 1px; 
height:auto;

}

span {
	_overflow: hidden;
}
.arrow {
	position: absolute;
	margin-top:-2px;
	margin-left:50px;
	width: 0;
	height: 0;
	font-size: 0;
	border-width: 12px;
	border-style: solid dashed dashed dashed;
	border-color: #ffffff transparent transparent transparent;
	z-index:20;
}
.arrow_bg{
	position: absolute;
	margin-top:-1px;
	margin-left:50px;
	width: 0;
	height: 0;
	font-size: 0;
	border-width: 12px;
	border-style: solid dashed dashed dashed;
	border-color: #c2c1be transparent transparent transparent;
	z-index:15;
}
	.maplibTcBtn {
    background-color: #8EA8E0;
    border: 1px solid #8BA4DC;
    border-radius: 3px;
    box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.35);
    color: #FFFFFF;
    cursor: pointer;
    margin: 0;
    padding: 2px 6px;
    position: absolute;
    right: 90px;
    text-align: center;
    top: 55px;
    white-space: nowrap;
    width: 60px;
    z-index: 10;
}
.maplibTcBtn.google {
    right: 100px;
    top: 45px;
}
.maplibTcBtnOff {
    background-color: #FFFFFF;
    color: #000000;
}
.maplibTcBtn span {
    font:  12px/1.3em arial,simsun,sans-serif;
}
</style>
 </head>
  <body>
  	<div class="map_message">
		    <div style="float:right">
		    	<ul>
		    		<li>
                    	<select id="select" onchange="cutoverMap();"  style="font-weight: normal; color: #C33;">
					 		 <option value="1" >百度地图</option>
					         <option value="2" selected>谷歌地图</option>
					         <option value="3" >高德地图</option>
					         <!-- <option value="4" >我秀地图</option> -->
					 	</select>
                    </li>
                    <li  style="margin:0px 10px;"><span class="marker_fenge_line"></span></li>
                	<li id="mapsearch">
                    	<a href="javascript:;" onclick="openMapSearchInput();">
                    			<span class="sousuo_ico"></span>
		                    	搜索
		                </a>
	                    <!-- 百度地图搜索 -->
	                    <div id="mapSearch_div" class="mapSearch_div" style="display:none;">
	                            <input id="mapsearch_input" type="text" placeholder="请输入关键字进行搜索" />
	                    </div>
	                    <div id="searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;">
                    	</div>
                    </li>
                    <li id="gd_mapsearch">
                    	<a href="javascript:;" onclick="openGdMapSearchInput();">
                    			<span class="sousuo_ico"></span>
		                    	搜索
		                </a>
	                    <!-- 高德地图搜索 -->
	                    <div id="gd_mapSearch_div" class="mapSearch_div" style="display:none;">
	                            <input id="gd_mapsearch_input" type="text" placeholder="请输入关键字进行搜索" />
	                    </div>
	                    <div id="gd_searchResultPanel" style="border:1px solid #C0C0C0;width:150px;height:auto; display:none;">
                    	</div>
                    </li>
                    
                	<li id="markerPermissionsPanelBtn">
                    	<a href="javascript:;" onclick="openmarkerPanel(1);">
		                	<span class="marker_biaozhu"></span>
		                   	 标注
		                </a>
                    </li>
                    <li id="fencePermissionsPanelBtn" style="display: none;">
                    	<a href="javascript:;" onclick="openmarkerPanel(2);">
		                	<span class="weilan"></span>
		                    	围栏
		                </a>
                    </li>
                    <li>
                    	<a href="javascript:;" onmouseover="showtoolPanel();"  onmouseout="isShowToolPane=false;hidetoolPanel();">
                            <span class="marker_gongju"></span>
                            <span>工具</span>
                            <span class="marker_gongju_xiala" style="margin-left:7px; margin-right:0px;"></span>
                        </a>
                        
                        <!--工具条-->
                        <div  onmouseout="isShowToolPane=false;hidetoolPanel();" onmouseover="showtoolPanel();" class="gongju_main" id="tools_box" style="display:none;">
                            <a href="javascript:;" onclick="isShowToolPane=false;openDistance();">
                                <span class="marker_ceju"></span>
                                	测距
                            </a>
                            <a id="thisAreaQuery" href="javascript:;" onclick="isShowToolPane=false;addRectangShape();">
                                <span class="marker_quyu"></span>
                                	当前区域查寻
                                <!-- 
                                <label onclick="historyQuery.showHistoryWin(event);" style="display: inline;">
                                	<img src="<%=path %>/gpsonline/image/tool/dot_2.gif" style="display: inline-block; height: 8px; width: 8px;"></img>
                                </label> -->
                            </a>
                            <a id="historyAreaQuery" href="javascript:isShowToolPane=false;historyQuery.toHistoryQuery(null);">
                             <span class="area_history_query"></span>
                                 	历史区域查询
                            </a>
                        </div>
                         <div  class="gongju_main"  style="width: 0px;position: absolute;;margin-left: 80px;margin-top:28px;display:none;" id="showHistoryWin" onmouseover="isShowToolPane=true;historyQuery.isShowHistoryWin=true;" onmouseout="isShowToolPane=false;historyQuery.isShowHistoryWin=false;historyQuery.closeHistoryWin(event);">
                            <a href="javascript:historyQuery.toHistoryQuery(null);">
                                 	历史区域查询
                            </a>
                        </div>
                        <!--工具条 end-->
                    </li>
                    <li>
                    	<a href="javascript:showMap()" id="closefullscreenbtn" style="display:<%=isFull==null ? "":"none"%>">
		                	<span class="marker_quanping"></span>
		                    	全屏地图
		                </a>
                        <a href="javascript:showMap();" id="fullscreenbtn" style="display:none">
		                	<span class="marker_quanping_out"></span>
		                    	退出全屏
		                </a>
                    </li>
                    <li><span class="marker_fenge_line"></span></li>
                    	<span class="marker_shebei" style="display: none;">
                    		 <input style="display: none;" id="largeDateShowVehicle" type="checkbox" name="checkbox1" value="checkbox" onclick="largeDataShowAllVechileonMap(this)" >数据过多时仍显示所有设备
                    	</span>
                    <li id="eqname">
                    	<span class="marker_shebei">
                             <input type="checkbox" name="checkboxcarname" value="checkbox" id="isShowCarName" onclick="showCarName();" >显示设备名
                        </span>
                    </li>
                    <li id="markerNamePermissionsPanelBtn">
                    	<span class="marker_shebei">
                             <input id="bzShowNamekbox" name="bzcheckbox" type="checkbox" value="checkbox" onclick="showMarkerName(this);" >显示标注名
                        </span>
                    </li>
                </ul>   
		    </div>
  			<!--  <div id="weizhi" > </div> -->
  			<span  id="weizhi2" style='float: left;white-space:nowrap;display:inline-block; overflow:hidden;text-overflow: ellipsis;width: 410px;position: absolute;' title=""></span>
  	</div>
  	
  	<div class="map_canvas">
	  	<div class="address" style="width:auto;z-index:10000;">
	  			<span id="autoDir" class="map_time"></span>
	  	</div>
	  	<div id="container" style="display:none;"></div>
	  	
	    <div id="map_canvas" style="width:100% !important; height:100% !important;position: absolute;">	  	
	    </div>
	    
	    <div id="close_stree" style="right: 5px;top:3px; z-index: 999999;position: absolute;display: none;"><a href="javascript:;" title="关闭" class="close_stree_view" onclick="streeViewObject.close();"></a></div>
  		<div id="pano_container" style="height: 100%;width: 50%;float:right;background-color:#f7f8f9; display: none;"></div>  
	    
	    <div id="tencMap" style="width:100%; height:100%;position: absolute;display: none;">	  	
	    </div>
	    
    </div>
    
    <div id="traffic-switcher" onClick="showTraffic();" class="maplibTcBtnOff maplibTcBtn google">
			    <span>路况信息</span>
	</div>
	
	<div id="fence-msg" class="maplibTcBtnOff maplibTcBtn google" style="width: 240px;right: 42%;display: none;">
			    <span id ="fence_lien" style="display: none;">电子围栏---规划路线<span style="color: red;">(ctrl+左键,ECS结束)</span></span>
			    <span id ="fence_poly" style="display: none;">电子围栏---多边形<span style="color: red;">(ECS键结束)</span></span>
	</div>
	
	<form  id="toHistoryQuery" action="<%=path %>/gpsonline/jsp/monitor/historyQuery.jsp" target="_blank" method="post">
		<!-- <input id="toHistoryQuery_ids" name="ids" value="" type="hidden"/> -->
		<input id="toHistoryQuery_center_lng" name="center_lng" value="" type="hidden"/>
		<input id="toHistoryQuery_center_lat" name="center_lat" value="" type="hidden"/>
		<input id="toHistoryQuery_mapType" name="mapType" value="" type="hidden"/>
		<input id="toHistoryQuery_zoom" name="zoom" value="" type="hidden"/>
	</form>
	<!-- <script type="text/javascript" src="http://api.ishowchina.com/v4/webapi/js/auth?v=3.6.3&t=jsmap&ak=9ba19ce78eb21f44e35001481ac941df"></script> -->
  </body>
</html>