<%@ 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+"/";
%>

<!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% }
</style>
<style type="text/css">
body{font-size:12px;}
.video_wrap{width:550px; overflow:hidden; border:1px solid #9e9e9e; position:absolute;}
.video_title{height:20px; background:#005bac; line-height:20px; color:#fff}
.ico_video{background:url(./gpsonline/image/video/ico_video.png) no-repeat; width:14px; height:14px; display:block; float:left; margin-top:3px; margin-left:5px; margin-right:5px;}
.video_close{background:url(./gpsonline/image/video/video_close.gif) no-repeat; width:16px; height:16px; display:block; float:right; margin-right:2px; margin-top:2px;}
.video_main{margin:2px;}
</style>
	<link rel="stylesheet" href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css" />
    <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://ditu.google.cn/maps/api/js?sensor=false&libraries=drawing&key=AIzaSyDZis631eei5VArZqB-lP2DDOSgPrhLR5A" charset="utf-8"></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/cmonitor/Menu.js"></script>	

    <script type="text/javascript" src="<%=path%>/gpsonline/js/cmonitor/baiduMap.js"></script>
    <script type="text/javascript" src="<%=path%>/gpsonline/js/Base64.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/tool/distance.js"></script>	
	<script type="text/javascript" src="<%=path%>/gpsonline/js/MianMap/MianMap.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">

   var map;
   var markersArray =[];
   var id;
   var url;
   var carList;
   var infowindow2;
   var infowindowArray =[];
   var vehicles = [];
   var namekg = true;
   var setT;
   var yanchiAl = null;
   var url="<%=path%>";
   var num = 10;
   
   function MapData(){
	   	if(map){
	   		if(map.getBounds()){
		   		closeMask();
		   		clearTimeout(setT);
		   		google.maps.event.addListener(map, 'drag', function(){
		        	clearTimeout(yanchiAl);
		        	yanchiAl=setTimeout("al()",500);
		      	});
	   		}else{
		   		setTimeout("MapData()",100);
		   	}
	   	}else{
	   		setTimeout("MapData()",100);
	   	}
   }
   var tcarsid ;
   function initialize(ids){
	    mapType = $("#mapType").val();
	    //console.info("mapType:--->"+mapType);
	    //console.info("ids:--->"+ids);
	    tcarsid = ids;
	    num = getRefreshTime();
		var lat=31.23;
		var lng=121.47;
		if(ids == ""){
			setTimeout("initialize(cartIds)",500);
		}else if(ids == "-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(typeof(google)=="undefined"){
				setTimeout("initialize(tcarsid)",500);
				return;
			}
			
			$.ajax({
	        type: "POST",
	        dataType: "json",
	        async:false,
	        url: "json/vehicleAction_byids.action",
	        data: {ids:ids},
	        success: function(data){
		      	if(data.flag==true){


		      		carList=data;
		      		id=ids;
		      		if(mapType==1){
		      			baiduMap(ids,false);
						return;
		      		}
		      		url="<%=basePath%>";
		      		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;
		      			}
		      		}
		      		countDown();    //每隔15秒执行函数al
		      		var 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"]
								                }
				          
			        };
			        map = new google.maps.Map(document.getElementById("map_canvas"),
			            mapOptions);
			        
			        getScript("gpsonline/js/monitor/infobox.js");
 	   				getScript("gpsonline/js/tool/distance.js");  
 	   				getScript("gpsonline/js/tool/areaQuery.js");
 	   				getScript("gpsonline/js/tool/baiduAreaQuery.js");       
			        
			        addMAPabc(map);
			        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(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);  
							//alert(carname);
							markersArray.push(marker);
							var boxText = document.createElement("div");
							//var carname = encodeURI(URIstring);
							boxText.className = "map_tanchu_wrap";
							var temp,temp1,temp2,temp3,temp4;
							if(data.data[x].positionLast.temperature != null && data.data[x].positionLast.temperature <=100){
								temp=data.data[x].positionLast.temperature +" ℃";
							}else{
								temp="无效";
							}
							if(data.data[x].positionLast.temp1 != null && data.data[x].positionLast.temp1 <=100){
								temp1=data.data[x].positionLast.temp1 +" ℃";
							}else{
								temp1="无效";
							}
							if(data.data[x].positionLast.temp2 != null && data.data[x].positionLast.temp2 <=100){
								temp2=data.data[x].positionLast.temp2 +" ℃";
							}else{
								temp2="无效";
							}
							if(data.data[x].positionLast.temp3 != null && data.data[x].positionLast.temp3 <=100){
								temp3=data.data[x].positionLast.temp3 +" ℃";
							}else{
								temp3="无效";
							}
							if(data.data[x].positionLast.temp4 != null && data.data[x].positionLast.temp4 <=100){
								temp4=data.data[x].positionLast.temp4 +" ℃";
							}else{
								temp4="无效";
							}
												if(alarmType=="Bus_client"){
													boxText.innerHTML = "<b class='xtop'>" +
												    	"<b class='xb1'></b>" +
												        "<b class='xb2'></b>" +
												        "<b class='xb3'></b>" +
												        "<b class='xb4'></b>" +
												    "</b>" +
												    "<div class='xboxcontent'><p>" +
													"<b>设备名称：</b>"+data.data[x].vhcCode+"</br>"
													+"<b>SIM卡号：</b>"+data.data[x].simCode+"</br>"
													+"<b>接收时间：</b>"+data.data[x].positionLast.recvtime+"</br>"
													+"<b>速度：</b>"+data.data[x].positionLast.speed+"km/h </br>"
													+"<b>方向：</b>"+direction+"</br>"
													+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
													+"<b>油量：</b>"+data.data[x].positionLast.oilMN1+" L</br>"
													+"<b>当日里程：</b>"+data.data[x].positionLast.distance+" km</br>"
													+"<b>总里程：</b>"+data.data[x].positionLast.totalDistance+" km</br>"
													+"<b>状态：</b>"+data.data[x].positionLast.state2+"</br>"
													+"<b>位置：</b>"+data.data[x].positionLast.memo+"</br>"
													+"<b>OBD数据：</b><a href='javascript:opobd("+data.data[x].id+");'><font color='#0000FF'>详细</font></a></br>"
													
													+"<a id='track_"+data.data[x].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a> <a id='' onclick='voiceStar(\""+data.data[x].voiceCode+"\",\""+data.data[x].dataCode+"\")' href='javascript:;'><font color='#0000FF'>视频</font> | </a>  <a id='playback_"+data.data[x].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+data.data[x].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
												} else{
													boxText.innerHTML = "<b class='xtop'>" +
												    	"<b class='xb1'></b>" +
												        "<b class='xb2'></b>" +
												        "<b class='xb3'></b>" +
												        "<b class='xb4'></b>" +
												    "</b>" +
												    "<div class='xboxcontent'><p>" +
												    "<b>设备名称：</b>"+data.data[x].vhcCode+"</br>"
													+"<b>SIM卡号：</b>"+data.data[x].simCode+"</br>"
													+"<b>接收时间：</b>"+data.data[x].positionLast.recvtime+"</br>"
													+"<b>速度：</b>"+data.data[x].positionLast.speed+"km/h </br>"
													+"<b>方向：</b>"+direction+"</br>"
													+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
													+"<b>油量：</b>"+data.data[x].positionLast.oilMN1+" L</br>"
													+"<b>当日里程：</b>"+data.data[x].positionLast.distance+" km</br>"
													+"<b>总里程：</b>"+data.data[x].positionLast.totalDistance+" km</br>"
													+"<b>状态：</b>"+data.data[x].positionLast.state2+"</br>"
													+"<b>位置：</b>"+data.data[x].positionLast.memo+"</br>"
													+"<b>OBD数据：</b><a href='javascript:opobd("+data.data[x].id+");'><font color='#0000FF'>详细</font></a></br>"
													
													+"<a id='track_"+data.data[x].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a>  <a id='playback_"+data.data[x].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+data.data[x].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
												}
							var myOptions = {
								 content: boxText
								,disableAutoPan: false
								,maxWidth: 0
								,pixelOffset: new google.maps.Size(-163, -305)
								,zIndex: null
								,boxStyle: { 
								  // background: "url('tipbox.gif') no-repeat"
								  // background: " no-repeat"
								  //,opacity: 0.75
								  //
								   background: "no-repeat"								  
								   ,width: "430px"
								 }
								,closeBoxMargin: "10px 35px 0px -20px"
								,closeBoxURL: "<%=path%>/gpsonline/image/monitor/close.gif"
								,infoBoxClearance: new google.maps.Size(1, 1)
								,isHidden: false
								,pane: "floatPane"
								,enableEventPropagation: false
							};
							
							google.maps.event.addListener(marker, "click", function (e) {
								markerObject.closeInfowindow();//关闭打开的标注弹出框
						    	if(menu!=null){
						        	menu.hide();
						        }
							    for(var i=0;i<vehicles.length;i++){
							    	  if(vehicles[i].infowindow){
							          	vehicles[i].infowindow.close();
							          }
							    }
								infowindow.open(map, this);
								infowindow.show();
								document.getElementById('weizhi').innerHTML = "位置： " + 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.marker = marker;
							vehicle.icon = data.data[x].icon;
							vehicle.infowindow = infowindow;
							vehicle.latlng = myLatlng;
							vehicle.voiceCode = data.data[x].voiceCode;
							vehicle.dataCode = data.data[x].dataCode;
							vehicle.simCode = data.data[x].simCode;
							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();
				 }
	        },
	        error: function() {
	           
			    }
	   });
	}
	   setT=setTimeout("MapData()",100);
	   countDown();
	   //star();
    }
   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);
	}
    var newdata;
    var counter=0;
    var timestamp=0;
    function al(){
    	   var p = new Object();
          /* p.leftLat = map.getBounds().getSouthWest().lat();
           p.leftLng = map.getBounds().getSouthWest().lng();
           p.rightLat = map.getBounds().getNorthEast().lat();
           p.rightLng = map.getBounds().getNorthEast().lng();
          // alert(p.leftLat);*/
            if(id != "" && id != null){
            $.ajax({
	        type: "POST",
	        dataType: "json",
	        async:true,
	        url: "json/vehicleAction_onlinevids.action",
	        data: {ids:-1,
	        timestamp:timestamp
	     //   ,'p.leftLat':p.leftLat,
	      //  'p.leftLng':p.leftLng,
	    //    'p.rightLat':p.rightLat,
	      //  'p.rightLng':p.rightLng
	        },
	        success: function(data){
		      	if(data.flag==true){
		      		counter=0;
		      		timestamp= data.timestamp;
    				//alert(map.getBounds().getSouthWest());
    				//alert(map.getBounds().getNorthEast());
    				reEquipmentStatus(data);
    				newdata=data;
    				if(mapType==1){
		   				updateBaiduMap();
		   				return false;
		   			}
    					//alert(data.data.length);
    				if(data.data.length>0){
    					//deleteOverlays();
    				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){
	    							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 contentString = document.createElement("div");
											contentString.className = "map_tanchu_wrap";
											
											var temp,temp1,temp2,temp3,temp4;
											if(data.data[i].temperature != null && data.data[i].temperature <=100){
												temp=data.data[i].temperature +" ℃";
											}else{
												temp="无效";
											}
											if(data.data[i].temp1 != null && data.data[i].temp1 <=100){
												temp1=data.data[i].temp1 +" ℃";
											}else{
												temp1="无效";
											}
											if(data.data[i].temp2 != null && data.data[i].temp2 <=100){
												temp2=data.data[i].temp2 +" ℃";
											}else{
												temp2="无效";
											}
											if(data.data[i].temp3 != null && data.data[i].temp3 <=100){
												temp3=data.data[i].temp3 +" ℃";
											}else{
												temp3="无效";
											}
											if(data.data[i].temp4 != null && data.data[i].temp4 <=100){
												temp4=data.data[i].temp4 +" ℃";
											}else{
												temp4="无效";
											}
											if(alarmType=="Bus_client"){
												contentString.innerHTML = "<b class='xtop'>" +
											    	"<b class='xb1'></b>" +
											        "<b class='xb2'></b>" +
											        "<b class='xb3'></b>" +
											        "<b class='xb4'></b>" +
											    "</b>" +
											    "<div class='xboxcontent'><p>" +
												"<b>设备名称：</b>"+vehicles[k].vhcCode+"</br>"
												+"<b>SIM卡号：</b>"+vehicles[k].simCode+"</br>"
												+"<b>接收时间：</b>"+data.data[i].recvtime+"</br>"
												+"<b>速度：</b>"+data.data[i].speed+"km/h </br>"
												+"<b>方向：</b>"+direction+"</br>"
												+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
												+"<b>油量：</b>"+data.data[i].oilMN1+" L</br>"
												+"<b>当日里程：</b>"+data.data[i].distance+" km</br>"
												+"<b>总里程：</b>"+data.data[i].totalDistance+" km</br>"
												+"<b>状态：</b>"+data.data[i].state2+"</br>"
												+"<b>位置：</b>"+data.data[i].memo+"</br>"
												+"<b>OBD数据：</b><a href='javascript:opobd("+vehicles[k].id+");'><font color='#0000FF'>详细</font></a></br>"
												
												+"<a id='track_"+vehicles[k].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a><a id='' onclick='voiceStar(\""+vehicles[k].voiceCode+"\",\""+vehicles[k].dataCode+"\")' href='javascript:;'><font color='#0000FF'>视频</font> | </a>   <a id='playback_"+vehicles[k].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
											} else{
												contentString.innerHTML = "<b class='xtop'>" +
											    	"<b class='xb1'></b>" +
											        "<b class='xb2'></b>" +
											        "<b class='xb3'></b>" +
											        "<b class='xb4'></b>" +
											    "</b>" +
											    "<div class='xboxcontent'><p>" +
												"<b>设备名称：</b>"+vehicles[k].vhcCode+"</br>"
												+"<b>SIM卡号：</b>"+vehicles[k].simCode+"</br>"
												+"<b>接收时间：</b>"+data.data[i].recvtime+"</br>"
												+"<b>速度：</b>"+data.data[i].speed+"km/h </br>"
												+"<b>方向：</b>"+direction+"</br>"
												+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
												+"<b>油量：</b>"+data.data[i].oilMN1+" L</br>"
												+"<b>当日里程：</b>"+data.data[i].distance+" km</br>"
												+"<b>总里程：</b>"+data.data[i].totalDistance+" km</br>"
												+"<b>状态：</b>"+data.data[i].state2+"</br>"
												+"<b>位置：</b>"+data.data[i].memo+"</br>"
												+"<b>OBD数据：</b><a href='javascript:opobd("+vehicles[k].id+");'><font color='#0000FF'>详细</font></a></br>"
												
												+"<a id='track_"+vehicles[k].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a>  <a id='playback_"+vehicles[k].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+vehicles[k].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼ </font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
											}
											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);
											
											
					    					
					    					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].marker.setMap(map);
												//vehicles[k].label.setMap(null);
												vehicles[k].label = new LableMarker(map,vehicles[k].vhcCode,myLatlng);
					    						
												if(namekg == true){
													//vehicles[k].label.setMap(null);
												}else{
													//vehicles[k].label.setMap(map);	
												}
												
											}
	    							
	    					}
	    				}
    				}
    			
    				}
				 }else{
				 	counter++;
	            	if(counter>=4){
	            		alert("请先登录");
	            	}
				 }
	        },
	        error: function() {
	            	counter++;
	            	if(counter>=4){
	            		alert("请先登录");
	            	}
			    }
	   });
            }
	    	
    }

    
    function updateMarkerData(id){
		centerMap(id,1,true);
	}
   	var isUpdate = false;
    function centerMap(id,db,isDatabase) {
    	 markerObject.closeInfowindow();//关闭打开的标注弹出框
	     if(menu!=null){
        	menu.hide();
         }
	     var tdata=1;
	        if(isDatabase==true){
	        	tdata=0;
	     }
    	//alert(id);
   		$.ajax({
	        type: "POST",
	        dataType: "json",
	        async:true,
	        url: "json/vehicleAction_byids.action",
	        data: {ids:id,t:tdata},
	        success: function(data){
		      	if(data.flag==true){		      			
		      		if(mapType==1){
		   				centerBaiduMap(data,db);
						return false;
		   			}	      		
    				if(data.data.length>0){
    					for(var i=0;i<data.data.length;i++){
    						
		      					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){
	    							 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();
								//alert(newtime-oldtime);
								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 contentString = document.createElement("div");
							contentString.className = "map_tanchu_wrap";
							var temp,temp1,temp2,temp3,temp4;
							if(data.data[i].temperature != null && data.data[i].temperature <=100){
								temp=data.data[i].temperature +" ℃";
							}else{
								temp="无效";
							}
							if(data.data[i].temp1 != null && data.data[i].temp1 <=100){
								temp1=data.data[i].temp1 +" ℃";
							}else{
								temp1="无效";
							}
							if(data.data[i].temp2 != null && data.data[i].temp2 <=100){
								temp2=data.data[i].temp2 +" ℃";
							}else{
								temp2="无效";
							}
							if(data.data[i].temp3 != null && data.data[i].temp3 <=100){
								temp3=data.data[i].temp3 +" ℃";
							}else{
								temp3="无效";
							}
							if(data.data[i].temp4 != null && data.data[i].temp4 <=100){
								temp4=data.data[i].temp4 +" ℃";
							}else{
								temp4="无效";
							}
							
							if(alarmType=="Bus_client"){
								contentString.innerHTML = "<b class='xtop'>" +
							    	"<b class='xb1'></b>" +
							        "<b class='xb2'></b>" +
							        "<b class='xb3'></b>" +
							        "<b class='xb4'></b>" +
							    "</b>" +
							    "<div class='xboxcontent'><p>" +
								"<b>设备名称22：</b>"+data.data[i].vhcCode+"</br>"
								+"<b>SIM卡号：</b>"+data.data[i].simCode+"</br>"
								infoBox	+"<b>接收时间：</b>"+data.data[i].positionLast.recvtime+"</br>"
								+"<b>速度：</b>"+data.data[i].positionLast.speed+"km/h </br>"
								+"<b>方向：</b>"+direction+"</br>"
								+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
								+"<b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br>"
								+"<b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br>"
								+"<b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br>"
								+"<b>状态：</b>"+data.data[i].positionLast.state2+"</br>"
								+"<b>位置：</b>"+data.data[i].positionLast.memo+"</br>"
								+"<b>OBD数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br>"
								+"<a id='track_"+data.data[i].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a><a id='' onclick='voiceStar(\""+data.data[i].voiceCode+"\",\""+data.data[i].dataCode+"\")' href='javascript:;'><font color='#0000FF'>视频</font> | </a><a id='playback_"+data.data[i].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
							} else{
								contentString.innerHTML = "<b class='xtop'>" +
							    	"<b class='xb1'></b>" +
							        "<b class='xb2'></b>" +
							        "<b class='xb3'></b>" +
							    "</b>" +
							    "<div class='xboxcontent'><p>" +
								"<b>设备名称：</b>"+data.data[i].vhcCode+"</br>"+
								"<b>备注：</b>"+data.data[i].remark+"</br>"
								+"<b>SIM卡号333：</b>"+data.data[i].simCode+"</br>"
								+"<b>接收时间：</b>"+data.data[i].positionLast.recvtime+"</br>"
								+"<b>速度：</b>"+data.data[i].positionLast.speed+"km/h </br>"
								+"<b>方向：</b>"+direction+"</br>"
								+"<b>温度：</b>"+temp+" | <b>温度1：</b>"+temp1+" | <b>温度2：</b>"+temp2+"<br><b>温度3：</b>"+temp3+" | <b>温度4：</b>"+temp4+"</br>"
								+"<b>油量：</b>"+data.data[i].positionLast.oilMN1+" L</br>"
								+"<b>当日里程：</b>"+data.data[i].positionLast.distance+" km</br>"
								+"<b>总里程：</b>"+data.data[i].positionLast.totalDistance+" km</br>"
								+"<b>状态：</b>"+data.data[i].positionLast.state2+"</br>"
								+"<b>位置：</b>"+data.data[i].positionLast.memo+"</br>"
								+"<b>OBD数据：</b><a href='javascript:opobd("+data.data[i].id+");'><font color='#0000FF'>详细</font></a></br>"
								+"<a id='track_"+data.data[i].id+"' onclick='openTrackFrame(this,event)' href='javascript:;'><font color='#0000FF'>跟踪</font> | </a><a id='playback_"+data.data[i].id+"' onclick='openBackFrame(this,event);' href='javascript:;'><font color='#0000FF'>回放</font> | </a>  <a id='more_"+data.data[i].id+"' href='javascript:;' onclick=\"showSecondMenu(this,event);\"><font color='#0000FF'>更多▼</font></a></p></div><b class='xbottom'><b class='xb4'></b><b class='xb3'></b><b class='xb2'></b><b class='xb1'></b></b><span class='arrow_bg'></span><span class='arrow'></span>";
							}
							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.setContent(contentString);
	    					vehicles[k].infowindow.open(map,vehicles[k].marker);
							document.getElementById('weizhi').innerHTML = "位置： " + data.data[0].positionLast.memo;
							map.setZoom(13);
										if(db==1||db==2){
												  map.setCenter(new google.maps.LatLng(data.data[0].positionLast.lat,data.data[0].positionLast.lng));
										}
	    						}
	    					}
		      				
	    				
    				    }
		      	   }
		      	  if(db==0||db==1){
		      	  	 updateCurMenu(data);
		      	  }
		      	}
	        },
	        error: function() {
	           
			    }
	   });
    }
    
    function showCarName(){

	    if(namekg == false){
	      namekg = true;
	      if(mapType==1){
		      	for(var j=0;j<markers.length;j++){
		      		if(markers[j].label != null){
			      		console.info(markers[j].label);
		      			baidMap.removeOverlay(markers[j].label);
		      		}
			  	 }
		      }else{
		      	 for(var j=0;j<vehicles.length;j++){
					//vehicles[j].label.setMap(null);
			  	 }
		      }
	    }else{
	      namekg = false;
	      if(mapType==1){
		      	for(var j=0;j<markers.length;j++){
		      		if(markers[j].label != null){
		      			//markers[j].label.setMap(null);
		      			console.info(markers[j].label);
		      			baidMap.addOverlay(markers[j].label);
		      		}
			  	 }
		      }else{
		      	 for(var j=0;j<vehicles.length;j++){
					//vehicles[j].label.setMap(map);
			  	 }
		      }
	    }
    }
    var mapshowkg = false;
    function showMap(){
    	/* if(mapshowkg == false){
	      mapshowkg = true;
	      document.getElementById("idx_top").style.display="none";
	      //alert(222);
	      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=getRefreshTime();
    	countDown();
	}
    function countDown(){
        if (num >= 0){
        	/*if(num == 13 && newdata!= null){
        		
        	}*/
            var str = '';
            str = "<font color='red'>"+ num+" </font>" + "秒后刷新 ";
            document.getElementById('autoDir').innerHTML = str;
            num=num-ynum;
            countnum = setTimeout(countDown, xnum);
        }
        else{
           num = getRefreshTime();
            al();
            if(newdata!= null){
        	   //reEquipmentStatus(newdata);
       		}
           
           countDown();
        }
    }
   

	//MAPabc
	//地图添加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);  
	}  
	
	/////////////////////////显示车牌号码end/////////////////////////////
	
	
	var isShowToolPane=false;
	function showtoolPanel(){
		isShowToolPane=true;
	 	$("#tools_box").show();
	}
	function hidetoolPanel(){
		setTimeout(function(){
						if(!isShowToolPane){
							$("#tools_box").hide();
							isShowToolPane=false;
						}
					},500);
		
	}
	
	//显示路况信息
	
	var isShowTraffic=true;
	var trafficLayer=null;
	function showTraffic(){
		 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;
		 }
	}

	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 !=null && json.data.length>0){
					var obd= json.data[0];
					var 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){
		//alert($("#trackContentWin_obd"));
		//alert(vid);
		$("#obd_nonull").show();
		$("#obd_null").hide();
		$("#obdinfo").html("");
		$("#trackContentWin_obd").fadeIn("fast");
		$("#trackContentWin_obd").center();
		
		obd_id=vid;
		getObdData(vid);
		udptimer=setTimeout(getObdData,5000);
	}
	
</script>


<style type="text/css">


.address{width: 420px; height: 20px; line-height: 20px; position: absolute; z-index: 10; background: none repeat scroll 0 0 #F7F7F7; }
.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; 
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: 180px;
    top: 5px;
}
.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;display:none;">
					 		 <option value="1" >百度地图</option>
					         <option value="2"   selected>谷歌地图</option>
					 	</select>
                </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 href="javascript:;" onclick="isShowToolPane=false;addRectangShape();"> -->
                              <a href="javascript:;" onclick="begHuaYuan();">
                                <span class="marker_quyu"></span>
                               	 区域查车
                            </a>
                        </div>
                        <!--工具条 end-->
                    </li>
                    <li><span class="marker_fenge_line"></span></li>
                    <li>
                    	<span class="marker_shebei">
                             <input type="checkbox" name="checkbox1" id="checkbox1" value="checkbox" onclick="showCarName();" >显示设备名
                        </span>
                    </li>
                    <li id="markerNamePermissionsPanelBtn">
                    	<span class="marker_shebei">
                             <input  id="bzcheckbox" name="bzcheckbox" type="checkbox" value="checkbox" onclick="showMarkerName(this);" >显示标注名
                        </span>
                    </li>
                    <li id="settingBtn">
                    	<span class="marker_shebei" onclick="setSystemObject.openWin()"> 
                             设置
                        </span>
                    </li>
                </ul>   
            
		    </div>
		    
  			<div id="weizhi" ></div>
  	</div>
  	<div class="map_canvas">
  		
	  	<div class="address" style="width:auto;z-index:10;">
	  			<span id="autoDir" class="map_time"></span>
	  	</div>
	    <div id="map_canvas" style="width:100%; height:100%;position: absolute;">
	    	
	    </div>
		 <div id="traffic-switcher" onClick="showTraffic();" class="maplibTcBtnOff maplibTcBtn google">
			    <span>路况信息</span>
		</div><!-- display: none;
		<div id="video" style="height: 50%;width: 50%;position: absolute;background-color:#f7f8f9;display: none;">
			
			 <object id="dyPlay" classid="clsid:C37A731A-11E9-4fbb-913A-4C3679A42C46"  style="height: 100%;width: 100%;" > </object> 
			 <img  src="<%=path%>/gpsonline/image/monitor/close.gif" style="position: absolute; z-index:10;margin-left:97%;margin-top:5px;">
		</div>	
		 -->
		 <div class="video_wrap" id="video" style="height: 446px;width: 620px;position: absolute;background-color:#f7f8f9;display: none; z-index:10;">
			<div class="video_title">
		    	<a onclick="playclose()" class="video_close"  href="javascript:;"></a>
		        <span class="ico_video"></span><span id="title_cp"></span>
		    </div>
		    <div class="video_main" id="video_main">
		    	
		    	<!--视频调用放在这里
		   			<iframe id="videoiframe" name="videoiframe" src="" style="z-index:1000;" marginwidth="0" marginheight="0" scrolling="no"  frameborder="0" ></iframe>
		   		-->
		    </div>
		</div>
    </div>
    <div id="fence-msg" class="maplibTcBtnOff maplibTcBtn google" style="width: 240px;right: 42%;display: none;top: 70px;z-index: 1000;">
			    <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>
  </body>
</html>