/*	Networkcar confidential and proprietary.
*	Copyright 2009 Networkcar, Inc. All rights reserved.
*	Author: Chaz Watson
*/
function Vehicle(H,F,K,E,I,C,G,J,D,L,B,A){this.stage=null;this.dirty=true;this.num=H;this.id="V"+H;CONST_PINTYPE_DEFAULT="0";CONST_PINTYPE_VEHICLETRACK_START="1";CONST_PINTYPE_VEHICLETRACK_MOVING="2";CONST_PINTYPE_VEHICLETRACK_IDLE="3";CONST_PINTYPE_VEHICLETRACK_STOP="4";CONST_PINTYPE_VEHICLELOCATION="5";if(F==""){F=CONST_PINTYPE_DEFAULT}this.pinType=F;this.vid=K;this.vin=E;this.lat=I;this.lon=C;if("g"==G.charAt(0)){this.img="/js/map/img/on.png"}if("y"==G.charAt(0)){this.img="/js/map/img/off.png"}if("r"==G.charAt(0)){this.img="/js/map/img/stopped.png"}this.imgBlank="/Images/1.gif";this.label=J;this.msg=D;this.keystate=L;this.trip=B;this.includeMe=true;this.onStage=false;Vehicle.prototype.createPin=function(){var P=new Position(this.lat,this.lon);var N=new Icon(this.img,10,18,22,22);var O=new String(this.msg);if(O.indexOf("$revgeo$")>0){O=O.replace("$revgeo$",_revgeowait)+"<iframe src='/blank.html' onload=\"rgiw('"+this.id+"')\" frameBorder=0 height=0 width=0/>"}var M=new Pin(P,O,"mouseover",N);M.setId(this.id);M.setNCObject(this);EventRegistry.addListener(M,"rightclick",this.eventRightClick);EventRegistry.addListener(M,"dblclick",this.eventDoubleClick);return M};Vehicle.prototype.createPinLabel=function(){var P=new Position(this.lat,this.lon);var O=new TextOverlay("<div style='position: absolute; width: 200px; height: 0px; align: center;'><table align=center style='background-color: FFFFFF; filter: alpha(opacity=80); opacity: .80; border-width: 1px; border-style: solid; border-color: gray; border-collapse: collapse;' id='vehicleLabel'><tr><td style='padding: 0 4 0 5;'><b>"+this.label+"</b></td</tr></table></div>",0,0);var N=new Icon(this.imgBlank,99,-4,200,25,O);var M=new Pin(P,"","",N);M.setId("L"+this.id);return M};Vehicle.prototype.getIcon=function(){var M=new Icon(this.img,10,18,22,22);return M};Vehicle.prototype.eventRightClick=function(N){var Q=N.getNCObject();if(Q.vin!=""){var M=_temp_MousePosX-Utilities.getAbsoluteLeft(_divMap);var R=_temp_MousePosY-Utilities.getAbsoluteTop(_divMap);var P=new Array();var O=0;if(_showFullRightClickMenu){P[O++]=new MenuItem("Vehicle Profile","/networkcar/ted/flltvehiclefastfacts?AccountID="+Q._user_acctid+"&vin="+Q.vin)}if(Q.pinType!=CONST_PINTYPE_VEHICLELOCATION){P[O++]=new MenuItem("Location Detail","/networkcar/ted/flltvehiclelocation?AccountID="+Q._user_acctid+"&vin="+Q.vin)}if(_showFullRightClickMenu){P[O++]=new MenuItem("Maintenance Alerts","/networkcar/ted/flltvehiclealerts?AccountId="+Q._user_acctid+"&vin="+Q.vin);if(_hasLndmrkGeofencePriv){P[O++]=new MenuItem("Create Landmark","/networkcar/ted/flltnewlndmrk?lat="+Q.lat+"&lon="+Q.lon);P[O++]=new MenuItem("Create Circular Geofence","/networkcar/ted/flltnewcirculargeofence?lat="+Q.lat+"&lon="+Q.lon);P[O++]=new MenuItem("Create Polygonal Geofence","/networkcar/ted/flltnewpolygonalgeofence?lat="+Q.lat+"&lon="+Q.lon+"&z="+_zoom.getZoomLevel())}}_stage.createPopupMenu(N,M,R,P)}};Vehicle.prototype.eventDoubleClick=function(M){_stage.map.centerOnPosition(M.getPosition(),_stage.map.getZoomController().zoomInOneLevel())};Vehicle.prototype.hide=function(){this.includeMe=false};Vehicle.prototype.show=function(){this.includeMe=true};Vehicle.prototype.included=function(){return this.includeMe}};