var map=null;var MessageFromDriverTimer=null;var DriverMesageNumber=0;var EightThousandPresent=false;var demo2_user=false;var ChatDemo=false;var requestedHeight=0;var requestedWidth=0;var dummyUser=null;var dummyPwd=null;window.onerror=stopError;window.onresize=an;var TheBrowser=null;var ControlPanelLockout=false;var AddressMarkersVisible=false;var dragShape=null;var dragShapetitle=null;var TOOLTIP_OFFSET_X= -10;var TOOLTIP_OFFSET_Y= -8;var TOOLTIP_OFFSET_X2= -5;var TOOLTIP_OFFSET_Y2= -12;var INFOPANE_OFFSET_X=0;var INFOPANE_OFFSET_Y=0;var m_firstRetrieve=true;var e;var santaTimer=null;var santaDirection=0;var santaLoc=0;var santaYLoc=null;var rpt_reportName=null;var rpt_VehicleID=null;var rpt_fromDate=null;var rpt_toDate=null;var rpt_History=new Array();var rpt_historySub=null;var rpt_Timeout=null;var rpt_Report=new fl("");var rpt_lastVehicleId=null;var rpt_lastLat=null;var rpt_lastLon=null;var rpt_lastOri=null;var rpt_lastVel=null;var rpt_lastTime=null;var rpt_precision=null;var rpt_precisionType=null;var rpt_linesPrinted=null;var rpt_miles=null;var rpt_idling=null;var rpt_lastSwitches=null;var rpt_stopped=null;var rpt_lastStopTime=null;var rpt_lastStartTime=null;var rpt_totRunTime=null;var rpt_totStopTime=null;var rpt_IgnitionMovement=null;var rpt_vehNames=new Array();var offlineReportType=null;var Pto1=0;var Pto2=0;var Pto3=0;var Pto4=0;var rpt_GraphArray1=new Array();var rpt_GraphArray2=new Array();var rpt_FirstArray=null;var rpt_chartTitle=null;var locs=null;var latlonlocs=null;var rSub1=0;var rLat=null;var rLon=null;var m_groupView=false;var m_StartupView="";var m_historicalMarker=null;var m_historicalData=null;var historicalIndex=0;var current_hindex=0;var historicalTimeout=500;var historicalPlaybackDirection=1;var historicalDateChanged=false;var historicalCenterCount=10;var historicalZoomCount=0;var historyIconFolder=null;var historyXCenter=null;var historyYCenter=null;var historyTagOffset=null;var historyWidth=null;var historyHeight=null;var historyLastDirection=0;var VaporTrailPoints=new Array;var VaporTrailStop=false;var PlayingVaporTrail=false;var VaporTrailTimeout=null;var m_ddlVehicleGroupEditor=null;var m_vehicleGroups=null;var m_ddlVehicleDriversEditor=null;var m_vehicleDrivers=null;var currentpanicentries=null;var ActivityTray=false;var Activitytop=0;var Activitybase=0;var ActWindowHeader="<img alt='' src='images/ActivityPlateDown.png' id='ActivityPanel' onclick='eq();' style='visibility: visible;'/>"+"<div style='overflow: hidden; background-color:transparent; opacity: 0.90; filter: alpha(opacity=90); position: absolute; width: 640px; height: 18px; left: 3px; top: 25px; visibility: visible; valign: top;' id='ActivHeader'>"+"<table id='jsGrid1' bgcolor='transparent' cellpadding='2px' cellspacing='0px' valign='top'>"+"<tr class='data hdr'>"+"<td><b>&nbsp;Date/Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;VehicleID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;Latitude&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;Longitude&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Speed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>Heading</b></td>"+"<td><b>Satellites</b></td>"+"<td><b>Ignition</b></td>"+"<td><b>Panic</b></td>"+"<td><b>Aux 1</b></td>"+"<td><b>Aux 2</b></td>"+"</tr></table>"+"</div>"+"<div style='overflow: hidden; background-color:transparent; opacity: 0.90; filter: alpha(opacity=90); position: absolute; width: 639px; height: 268px; left: 6px; top: 40px; visibility: visible;' id='ActivityMask'>"+"<div style='overflow: hidden; background-color:transparent; opacity: 0.90; filter: alpha(opacity=90); position: absolute; width: 640px; height: 510px; left: 0px; top: 0px; visibility: visible;' id='ActScroller'>"+"</div></div>";var ActivityHeader="<table id='jsGrid' bgcolor='transparent' cellpadding='2px' cellspacing='0px' valign='top'>"+"<tr class='data hdr'>"+"<td><b>&nbsp;Date/Time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;VehicleID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;Latitude&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;Longitude&nbsp;&nbsp;</b></td>"+"<td><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Speed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>"+"<td><b>Heading</b></td>"+"<td><b>Satellites</b></td>"+"<td><b>Ignition</b></td>"+"<td><b>Panic</b></td>"+"<td><b>Aux 1</b></td>"+"<td><b>Aux 2</b></td>"+"</tr>";var ActivityOut=ActivityHeader+"</table>";var accenture="";var rowtoggle;var ActivityContent=new Array;var ActivityCount=0;var ssdown=false;var ssup=false;var fenceUL=null;var fenceLR=null;var m_drawingFence=false;var m_fenceLatUL=0;var m_fenceLonUL=0;var m_fenceLatLR=0;var m_fenceLonLR=0;var MapFencesVisible=false;var AlertEditorOpen=false;var m_showGeoFences=false;var m_bLoggedIn=false;var m_bResizing=false;var m_bRepeat=false;var m_bViewHistory=false;var m_strDateTime;var m_gMap;var m_bOptimizeZoom=true;var m_bOptimizeZoomSet=false;var m_bCenterMap=false;var m_showTraffic=false;var t_showTraffic=null;var m_divMap;var m_lDivHeight=0;var m_lDivWidth=0;var m_ddlVehicles=null;var m_AlertVehicleList;var m_ZoneVehicleList;var m_OLRVehiclesList;var m_VTVehiclesList;var m_IGNVehicleList;var m_ddlCannery;var m_CanneryList;var m_ddlAlerts;var MarkerNames=new Array();var m_divROverlay;var object=new Array();var zoomvalue=0;var m_gMarkers=new Array();var windowWidth;var windowHeight;var m_TriggerMapControl=false;var cached_loader;var m_drawingFence=false;var m_CurrentUser=null;var m_AlertList;var m_demoUser=false;var m_SelectPoint=false;var queryStringParams=new Array();var m_AddressControl=null;var m_AddressType=null;var m_setValue=false;var m_setHistoryValue=false;var m_loadTimeout=null;var m_loadInterval=null;var m_maxHistoricalCenterCount=10;var ChatIsOpen=false;var m_checkMesagesTimeout=null;var ChatMsgNo=0;var ChatLines=new Array();var ChatWaitTime=10000;var clickedOnSerial=null;var cars=new Array();var lastCars=new Array();var MapAddresspins=new Array();var PinIds=new Array();var addrInfoBox=new Array();var addrInfoIds=new Array();var addrInfoBoxTimer=null;var IconFolders=new Array();var IconFolderToUse=null;var iNames=new Array();var iXcenter=new Array();var iYCenter=new Array();var iHeight=new Array();var iWidth=new Array();var carPins=new Array();var carInPanic=false;var maxCarsInPanic=0;var lastClickedBox=0;var vehicleToFollow=null;var t_followVehicle=null;var NewAddressMarker="New Address Marker";var NewAddressMarkerPresent=false;var xoffset=0;var yoffset=0;var DestinationMarker="Destination Marker";var DestinationPinPresent=false;var historyCarPin=null;var historyNameTag=null;var historyInfoBox=null;var FindResultArray=new Array();var ResultIds=new Array();var ResultInfo=new Array();var dragObject=null;var dragStartX=0;var dragStartY=0;var dragClickStartX=0;var dragClickStartY=0;var dragging=false;var wereloadingmarkers=false;var safariPadding="25px 0px 0px 0px";var novdatapresent=false;var CanneryPost="";var dtime="";var m_loadMarkerRunning=false;function U(){var currentDate=new Date();var day=currentDate.getDate();var month=currentDate.getMonth()+1;var year=currentDate.getFullYear();var hours=currentDate.getHours();var minutes=currentDate.getMinutes();var seconds=currentDate.getSeconds();var suffix="AM";if(hours<12){suffix="AM";}else{suffix="PM";}if(hours==0){hours=12;}if(hours>12){hours=hours-12;}if(minutes<10){minutes="0"+minutes;}if(seconds<10){seconds="0"+seconds;}if(month<10){month="0"+month;}if(day<10){day="0"+day;}var returnstring=month+"."+day+"."+year+" "+hours+":"+minutes+":"+seconds+" "+suffix;return returnstring;};function bc(){var currentDate=new Date();var day=currentDate.getDate();var month=currentDate.getMonth()+1;var hours=currentDate.getHours();var minutes=currentDate.getMinutes();var seconds=currentDate.getSeconds();if(hours==0){hours=12;}if(hours<10){hours="0"+hours;}if(minutes<10){minutes="0"+minutes;}if(seconds<10){seconds="0"+seconds;}if(month<10){month="0"+month;}if(day<10){day="0"+day;}var returnstring=month+"/"+day+" "+hours+":"+minutes+":"+seconds;return returnstring;};function stopError(){return true;};function hP(object){return false;element=document.getElementById(object);dragStartX=element.style.left;dragStartY=element.style.top;dragClickStartX=event.x;dragClickStartY=event.y;dragObject=element;dragging=true;dragging=true;if(m_loadTimeout!=null){clearTimeout(m_loadTimeout);clearInterval(m_loadInterval);wereloadingmarkers=true;}};function aP(object){if(dragging==true){var oldLeft=element.style.left;oldLeft=oldLeft.substring(0,oldLeft.length-2);var changeX=event.x-dragClickStartX;var newX=(oldLeft*1)+changeX;element.style.left=newX+"px";dragClickStartX=event.clientX;var oldTop=element.style.top;oldTop=oldTop.substring(0,oldTop.length-2);var changeY=event.y-dragClickStartY;var newY=(oldTop*1)+changeY;element.style.top=newY+"px";dragClickStartY=event.clientY;}};function hj(object){dragObject=null;dragging=false;if(wereloadingmarkers=true){m_loadTimeout=setTimeout("dv('"+sessionID+"');",4000);wereloadingmarkers=true;}};function A(event){var keycode;if(window.event){keycode=event.keyCode;}else if(e.which){keycode=e.which;}if(keycode==13){switch(event.srcElement.id){case "txtUserID":case "txtPassword":{element=document.getElementById("loginCell");if(gf()=="safari"){event.keyCode=null;}dummyUser="";dummyPwd="";logInUser();if(gf()=="safari"){return false;}else{return true;}break;}case "TextSearch":{element=document.getElementById("SearchCell");if(element!=null){dT();if(gf()=="safari"){return false;}else{return true;}}break;}case "textChatOutput":{eg();return false;break;}case "txtMessageToDriver":{gV();return false;break;}case "DTDtxtAddressFind":{if(addressFind.value.indexOf(';')> -1){var tmpArray=new Array();tmpArray=addressFind.value.split(';');rLat=tmpArray[0];rLon=tmpArray[1];Feed.MpPntRvGeo(rLat,rLon,aj);}else{aw();}return false;break;}default:{if(event.srcElement.id=="rStartLoc"||event.srcElement.id=="rEndLoc"||event.srcElement.id.substring(0,5)=="rStop"){if(gf()=="safari"){event.keyCode=null;}dU();if(gf()=="safari"){return false;}else{return true;}break;}}}}return true;};function setViewType(value){if(value==true){element=document.getElementById("ddlGroups");if(element.selectedIndex==0){value=false;;}else{if(element!=null){if(element.options.length==0){value=false;}}}}else{element=document.getElementById("ddlVehicles");if(element.selectedIndex==0){value=false;}}m_groupView=value;};function hl(){vehicleAddList=document.getElementById("vgVehicles");if(vehicleAddList!=null){if(vehicleAddList.selectedIndex!= -1){if(vehicleAddList.options[vehicleAddList.selectedIndex].value!= -1){vehicleGroupList=document.getElementById("vgUGroups");if(vehicleGroupList!=null){for(i=0;i<vehicleGroupList.length;i++){if(vehicleGroupList.options[i].value==vehicleAddList.options[vehicleAddList.selectedIndex].value){return;}}vehicleGroupList.options[vehicleGroupList.length]=new Option(vehicleAddList.options[vehicleAddList.selectedIndex].text,vehicleAddList.options[vehicleAddList.selectedIndex].value);}}}else{vehicleGroupList=document.getElementById("vgUGroups");vehicleGroupList.options.length=0;for(i=1;i<vehicleAddList.options.length;i++){vehicleGroupList.options[vehicleGroupList.options.length]=new Option(vehicleAddList.options[i].text,vehicleAddList.options[i].value);}}}};function hp(){vehicleAddList=document.getElementById("vdVehicles");if(vehicleAddList!=null){if(vehicleAddList.selectedIndex!= -1){if(vehicleAddList.options[vehicleAddList.selectedIndex].value!= -1){vehicleGroupList=document.getElementById("vdAssignedVehicles");if(vehicleGroupList!=null){for(i=0;i<vehicleGroupList.length;i++){if(vehicleGroupList.options[i].value==vehicleAddList.options[vehicleAddList.selectedIndex].value){return;}}vehicleGroupList.options[vehicleGroupList.length]=new Option(vehicleAddList.options[vehicleAddList.selectedIndex].text,vehicleAddList.options[vehicleAddList.selectedIndex].value);}}}else{vehicleGroupList=document.getElementById("vdAssignedVehicles");vehicleGroupList.options.length=0;for(i=1;i<vehicleAddList.options.length;i++){vehicleGroupList.options[vehicleGroupList.options.length]=new Option(vehicleAddList.options[i].text,vehicleAddList.options[i].value);}}}};function gS(allFlag){vehicleGroupList=document.getElementById("vgUGroups");if(vehicleGroupList!=null){if(allFlag){vehicleGroupList.options.length=0;return;}if(vehicleGroupList.selectedIndex!= -1){vehicleGroupList.remove(vehicleGroupList.selectedIndex);}}};function ha(allFlag){vehicleGroupList=document.getElementById("vdAssignedVehicles");if(vehicleGroupList!=null){if(allFlag){vehicleGroupList.options.length=0;return;}if(vehicleGroupList.selectedIndex!= -1){vehicleGroupList.remove(vehicleGroupList.selectedIndex);}}};function hf(){Feed.SVehGrp(m_CurrentUser,gH);};function ho(){Feed.SVehDrv(m_CurrentUser,gA);};function gH(results){if(results==null||results.value==null){AlertMessage("Failed to retrieve group entries.<br/><br/>Please dG and try again.");}else{vgVehicles=results.value;vgGroupList=document.getElementById("vgGroups");vgGroupList.options.length=0;m_vehicleGroups=vgVehicles;for(i=0;i<vgVehicles.Rows.length;i++){vgGroupList.options[vgGroupList.options.length]=new Option(vgVehicles.Rows[i].name,vgVehicles.Rows[i].id);}fr();}};function gA(results){if(results==null||results.value==null){AlertMessage("Failed to retrieve driver entries.<br/><br/>Please dG and try again.");}else{vdDrivers=results.value;vdDriverList=document.getElementById("vdDrivers");vdDriverList.options.length=0;m_vehicleDrivers=vdDrivers;for(i=0;i<vdDrivers.Rows.length;i++){vdDriverList.options[vdDriverList.options.length]=new Option(vdDrivers.Rows[i].Name,vdDrivers.Rows[i].id);}}};function fr(){groupFilter=document.getElementById("ddlGroups");groupFilter.options.length=0;groupFilter.options[groupFilter.options.length]=new Option("View All Vehicles");for(i=0;i<m_vehicleGroups.Rows.length;i++){groupFilter.options[groupFilter.options.length]=new Option(m_vehicleGroups.Rows[i].name,m_vehicleGroups.Rows[i].id);}};function hs(){vgGroupName=document.getElementById("vgtxtName");if(vgGroupName.value==""){AlertMessage("You must enter a name for this group.");return;}vgGroupList=document.getElementById("vgUGroups");if(vgGroupList.options.length==0){AlertMessage("Please add vehicles to your group list.");return;}vgSerialList="";for(i=0;i<vgGroupList.options.length;i++)vgSerialList=vgSerialList+vgGroupList.options[i].value+",";Feed.UVehGrp(m_CurrentUser,vgGroupName.value,vgSerialList,gH);};function hv(){vgGroupName=document.getElementById("txtDriverName");if(vgGroupName.value==""){AlertMessage("You must enter a name for this driver.");return;}vgGroupList=document.getElementById("vdAssignedVehicles");if(vgGroupList.options.length==0){AlertMessage("Please add vehicles to this driver.");return;}vdPhone1=document.getElementById("txtDriverPhone1").value;vdPhone2=document.getElementById("txtDriverPhone2").value;if(!dI(vdPhone1)){AlertMessage("Invalid character in phone entry 1");return;}if(!dI(vdPhone2)){AlertMessage("Invalid character in phone entry 2");return;}vdCarrier1=document.getElementById("DriverPROVIDER1").value;vdCarrier2=document.getElementById("DriverPROVIDER2").value;if(gh(vdPhone1," ")==""){vdCarrier1="";document.getElementById("DriverPROVIDER1").value="";}if(gh(vdPhone2," ")==""){vdCarrier2="";document.getElementById("DriverPROVIDER2").value="";}vgSerialList="";for(i=0;i<vgGroupList.options.length;i++)vgSerialList=vgSerialList+vgGroupList.options[i].value+",";Feed.UVehDrv(m_CurrentUser,vgGroupName.value,vdPhone1,vdPhone2,vdCarrier1,vdCarrier2,vgSerialList,gA);};function dI(value){validchars="1234567890";for(i=0;i<value.length;i++){if(validchars.match(value.charAt(i))==null)return false;}return true;};function hu(){var vgAddGroup=document.getElementById("divAddGroup");vgAddGroup.style.display="inline";vgAddGroup.style.visibility="visible";var vgRemoveGroup=document.getElementById("divRemoveGroup");vgRemoveGroup.style.display="none";vgRemoveGroup.style.visibility="hidden";vgGroupName=document.getElementById("vgtxtName");vgGroupName.value="";vgGroupList=document.getElementById("vgUGroups");vgGroupList.options.length=0;vgGroupName.focus();};function gL(action){switch(action){case "displayMessage":var vgAddGroup=document.getElementById("divAddGroup");vgAddGroup.style.display="none";vgAddGroup.style.visibility="hidden";var vgRemoveGroup=document.getElementById("divRemoveGroup");vgRemoveGroup.style.display="inline";vgRemoveGroup.style.visibility="visible";vgGroupList=document.getElementById("vgGroups");if(vgGroupList.selectedIndex!= -1){var table=document.getElementById("groupSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("noGroupSelected");table.style.display="none";table.style.visibility="hidden";}else{var table=document.getElementById("noGroupSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("groupSelected");table.style.display="none";table.style.visibility="hidden";}break;case "editGroup":he();break;case "removeGroup":vgGroupList=document.getElementById("vgGroups");if(vgGroupList.selectedIndex!= -1){Feed.DVehGrp(m_CurrentUser,vgGroupList.options[vgGroupList.selectedIndex].value,gH);}break;}};function hn(){var vgAddDriver=document.getElementById("divAddDriver");vgAddDriver.style.display="inline";vgAddDriver.style.visibility="visible";var vgRemoveDriver=document.getElementById("divRemoveDriver");vgRemoveDriver.style.display="none";vgRemoveDriver.style.visibility="hidden";vgGroupName=document.getElementById("txtDriverName");vgGroupName.value="";vgGroupList=document.getElementById("vdAssignedVehicles");vgGroupList.options.length=0;vdPhone1=document.getElementById("txtDriverPhone1");vdPhone2=document.getElementById("txtDriverPhone2");vdPhone1.value="";vdPhone2.value="";vdCarrier1=document.getElementById("DriverPROVIDER1");vdCarrier2=document.getElementById("DriverPROVIDER2");vdCarrier1.value="";vdCarrier2.value="";vgGroupName.focus();};function gy(action){switch(action){case "displayMessage":var vgAddDriver=document.getElementById("divAddDriver");vgAddDriver.style.display="none";vgAddDriver.style.visibility="hidden";var vgRemoveDriver=document.getElementById("divRemoveDriver");vgRemoveDriver.style.display="inline";vgRemoveDriver.style.visibility="visible";vgGroupList=document.getElementById("vdDrivers");if(vgGroupList.selectedIndex!= -1){var table=document.getElementById("driverSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("noDriverSelected");table.style.display="none";table.style.visibility="hidden";}else{var table=document.getElementById("noDriverSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("driverSelected");table.style.display="none";table.style.visibility="hidden";}break;case "editDriver":hb();break;case "removeDriver":vgGroupList=document.getElementById("vdDrivers");if(vgGroupList.selectedIndex!= -1){Feed.DVehDrv(m_CurrentUser,vgGroupList.options[vgGroupList.selectedIndex].value,gA);}break;}};function he(){var vgAddGroup=document.getElementById("divAddGroup");vgAddGroup.style.display="inline";vgAddGroup.style.visibility="visible";var vgRemoveGroup=document.getElementById("divRemoveGroup");vgRemoveGroup.style.display="none";vgRemoveGroup.style.visibility="hidden";vgGroupsList=document.getElementById("vgGroups");if(vgGroupsList.selectedIndex!= -1){groupName=document.getElementById("vgtxtName");groupName.value=m_vehicleGroups.Rows[vgGroupsList.selectedIndex].name;vgListing=document.getElementById("vgUGroups");vgListing.options.length=0;vehicleAddList=document.getElementById("vgVehicles");serialString=m_vehicleGroups.Rows[vgGroupsList.selectedIndex].serials;for(i=0;i<vehicleAddList.options.length;i++){if(serialString.match(vehicleAddList.options[i].value)!=null){vgListing.options[vgListing.options.length]=new Option(vehicleAddList.options[i].text,vehicleAddList.options[i].value);}}}};function hb(){vgGroupsList=document.getElementById("vdDrivers");if(vgGroupsList.selectedIndex!= -1){var vgAddDriver=document.getElementById("divAddDriver");vgAddDriver.style.display="inline";vgAddDriver.style.visibility="visible";var vgRemoveDriver=document.getElementById("divRemoveDriver");vgRemoveDriver.style.display="none";vgRemoveDriver.style.visibility="hidden";groupName=document.getElementById("txtDriverName");groupName.value=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].Name;vgListing=document.getElementById("vdAssignedVehicles");vgListing.options.length=0;vehicleAddList=document.getElementById("vdVehicles");serialString=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].VehicleList;for(i=0;i<vehicleAddList.options.length;i++){if(serialString.match(vehicleAddList.options[i].value)!=null){vgListing.options[vgListing.options.length]=new Option(vehicleAddList.options[i].text,vehicleAddList.options[i].value);}}phone1=document.getElementById("txtDriverPhone1");phone2=document.getElementById("txtDriverPhone2");carrier1=document.getElementById("DriverPROVIDER1");carrier2=document.getElementById("DriverPROVIDER2");phone1.value=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].Phone1;phone2.value=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].Phone2;if(m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].SMSCarrier1!=null){carrier1.value=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].SMSCarrier1;}else{carrier1.value="";}if(m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].SMSCarrier2!=null){carrier2.value=m_vehicleDrivers.Rows[vgGroupsList.selectedIndex].SMSCarrier2;}else{carrier2.value="";}}};function qs(){var query=window.location.search.substring(1);var parms=query.split('&');for(var i=0;i<parms.length;i++){var pos=parms[i].indexOf('=');if(pos>0){var key=parms[i].substring(0,pos);var val=parms[i].substring(pos+1);queryStringParams[key]=val;}}};function as(){qs();if(queryStringParams["h"]!=null){requestedHeight=queryStringParams["h"]*1;}if(queryStringParams["w"]!=null){requestedWidth=queryStringParams["w"]*1;}dummyUser=bF("USFTLoginID");dummyPwd=bF("USFTPassword");dS("USFTLoginID","");dS("USFTPassword","");if(dummyUser!=""&&dummyUser!=null){if(dummyPwd!=""&&dummyPwd!=null){dummyPwd=ab(dummyPwd);loginUserTimer=setTimeout("logInUser('"+document.getElementById("loginCell")+"')",1000);}}else if(queryStringParams["login"]!=null){if(queryStringParams["pwd"]!=null){dummyUser=queryStringParams["login"];dummyPwd=ab(queryStringParams["pwd"]);loginUserTimer=setTimeout("logInUser('"+document.getElementById("loginCell")+"')",1000);}}else{if(queryStringParams["demo"]!=null){dK();}else{if(queryStringParams["DemoChat"]!=null){fF();}}}};function ab(pwd){var decptd="";var dateis=new Date;var xor_key=(dateis.getDate()%3)+1;for(i=0;i<pwd.length;i++){decptd+=String.fromCharCode(xor_key^pwd.charCodeAt(i));}return decptd;};function fa(){bp(" ");if(m_historicalMarker!=null){if(m_historicalMarker.tooltip!=null)m_gMap.getPane(G_MAP_MARKER_PANE).removeChild(m_historicalMarker.tooltip);if(m_historicalMarker.infoPane!=null)m_gMap.getPane(G_MAP_FLOAT_PANE).removeChild(m_historicalMarker.infoPane);m_gMap.removeOverlay(m_historicalMarker);}m_bViewHistory=false;if(m_demoUser&&m_CurrentUser.match("livedemo")==null)dK();else logInUser();m_historicalMarker=null;m_historicalData=null;historicalPlaybackDirection=0;current_hindex=0;if(map.GetShapeLayerCount()>1){map.DeleteAllShapeLayers();}};function ssrReportTypeClicked(){rpt_IgnitionMovement=document.getElementById("rptIgnition");var divMinStopTime1=document.getElementById("divMinStopTime1");var divMinStopTime2=document.getElementById("divMinStopTime2");if(rpt_IgnitionMovement.checked){divMinStopTime1.style.visibility="hidden";divMinStopTime2.style.visibility="hidden";}else{divMinStopTime1.style.visibility="visible";divMinStopTime2.style.visibility="visible";}};function ssOrReportTypeClicked(){ddldivOLRIdle=document.getElementById("divOLRIdle");var rpt_Ignition=document.getElementById("rptIgnition");if(rpt_Ignition.checked){ddldivOLRIdle.style.visibility="hidden";}else{ddldivOLRIdle.style.visibility="visible";}};function hS(){var point=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(m_gMap.fromDivPixelToLatLng(new GPoint(0,0),true),m_gMap.getZoom());var offset=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(this.getPoint(),m_gMap.getZoom());var anchor=this.getIcon().iconAnchor;var width=this.getIcon().iconSize.width;var height=100;var pos=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(offset.x-point.x-anchor.x+width+TOOLTIP_OFFSET_X2,offset.y-point.y-anchor.y+TOOLTIP_OFFSET_Y2));pos.apply(this.tooltip);this.tooltip.style.display="block";};function ct(){this.tooltip.style.display="none";};function eA(){addressLAT=document.getElementById("addressLAT");addressLON=document.getElementById("addressLON");Feed.MpPntRvGeo(addressLAT.value,addressLON.value,ez);};function ez(response){if(response!=null){addressText=document.getElementById("txtAddressFind");addressText.value=response.value;}};function fc(){addressFind=document.getElementById("txtAddressFind");map.Find(null,addressFind.value,null,null,null,null,true,true,null,true,ed);};function ed(layer,resultsArray,places,hasMore,veErrorMessage){if(places[0]==null){AlertMessage("Address not found.");}else{place=places[0].LatLong;addressLAT=document.getElementById("addressLAT");addressLON=document.getElementById("addressLON");addressLAT.value=place.Latitude;addressLON.value=place.Longitude;}};function fI(){addressFind=document.getElementById("txtAddressFind");window.parent.map.Find(null,addressFind.value,null,null,null,null,true,true,null,true,ed);};function showAddress(strControl,dLat,dLon,sType){m_AddressControl=strControl;m_AddressType=sType;document.body.style.cursor='wait';Feed.MpPntRvGeo(dLat,dLon,gI);};function gI(response){var strResponse="";if(response!=null){switch(m_AddressType){case "1":strResponse=" Heading change at:<br>";break;case "2":strResponse=" Stopped at:<br>";break;case "3":strResponse=" Stayed at:<br>";break;case "4":strResponse=" Continued to:<br>";break;default:strResponse="";break;}aaddrcontrol=document.getElementById("address_"+m_AddressControl);if(aaddrcontrol!=null){aaddrcontrol.innerHTML=strResponse+response.value;}}m_AddressControl="";m_AddressTyep="";document.body.style.cursor='auto';};function hU(type){if(type==0){titleBar=document.getElementById("titleBar");titleBar.style.visibility="visible";}};function cz(){titleBar=document.getElementById("titleBar");titleBar.style.visibility="hidden";};function fx(){gm(map.GetZoomLevel(),'set');if(m_drawingFence==true){P();}if(MarkerNames!=null){gn();}if(carInPanic==true){gN();}};function fG(){if(carInPanic==true){gN();}};function stripID(value){allowed_chars="1234567890";new_id="";for(i=0;i<value.length;i++){if(value.charAt(i)!=")"&&value.charAt(i)!="("){if(allowed_chars.match(value.charAt(i))!=null){new_id=new_id+value.charAt(i);}}}return new_id;};function clearFence(){map.DeleteAllPolygons();if(fenceUL!=null){map.DeleteShape(fenceUL);fenceUL=null;}if(fenceLR!=null){map.DeleteShape(fenceLR);fenceLR=null;}};function bQ(variable){var query=window.location.search.substring(1);var vars=query.split("&");for(var i=0;i<vars.length;i++){var pair=vars[i].split("=");if(pair[0]==variable){return pair[1];}}};function dF(report){aF("divReportSelector");var sessionQueryKey=document.getElementById("SESSIONKEY");m_divTitlebar=document.getElementById("divReportPlate");m_divROverlay=document.getElementById("divROverlay");m_divTitlebar.style.width="744px";m_divROverlay.style.width='708px';bD();m_divTitlebar.style.height='763px';m_divROverlay.innerHTML="<iframe src='"+report+".aspx?SESSIONID="+sessionQueryKey.getAttribute("value")+"' style='background-color: Transparent; width:100%; height:100%;' frameBorder=0 allowtransparency='true' />";m_divROverlay.style.visibility="visible";m_divTitlebar.style.visibility="visible";bj("divReportPlate");};function cC(){m_rptType=0;aF("divReportPlate");clearTimeout(m_loadTimeout);clearInterval(m_loadInterval);dq();};function dV(i){if(m_bLoggedIn){m_vgodiv=document.getElementById("divVehicleAction");m_vgodiv.style.display="block";bm();var originalPoint=map.LatLongToPixel(new VELatLong(cars.Rows[i].lt*1,cars.Rows[i].ln*1));if(originalPoint.x+m_vgodiv.clientWidth>windowWidth){m_vgodiv.style.left=(windowWidth-m_vgodiv.clientWidth)+8+"px";}else{m_vgodiv.style.left=originalPoint.x+8+"px";}if(originalPoint.y+m_vgodiv.clientHeight>windowHeight){m_vgodiv.style.top=windowHeight-m_vgodiv.clientHeight-50+"px";}else{m_vgodiv.style.top=originalPoint.y+"px";}bj("divVehicleAction");vapId=document.getElementById("vapId");vapId.value=cars.Rows[i].s;vapName=document.getElementById("vapName");vapName.value=cars.Rows[i].n;vapFlagColor=document.getElementById("vapFlagColor");vapFlagColor.value=cars.Rows[i].cl;vapTextColor=document.getElementById("vapTextColor");vapTextColor.value=cars.Rows[i].tc;element=document.getElementById("vehicle_address");element.innerText="";var imageloc="images/";if(cars.Rows[i].iconFolder==null||cars.Rows[i].iconFolder==""){imageloc+="default/";}else{imageloc+=cars.Rows[i].Image+"/";}imageloc+="Master1.gif";var VehIcon=document.getElementById("VehIcon");VehIcon.src=imageloc;IconFolderToUse=null;var followme=document.getElementById("followme");if(vehicleToFollow==cars.Rows[i].s){followme.innerHTML="<img alt='' onclick=\"by();\" src='images/vapSTOPfollowvehicle0.gif' onmouseover=\"this.src='images/vapSTOPfollowvehicle1.gif'\" onmouseout=\"this.src='images/vapSTOPfollowvehicle0.gif'\" onmousedown=\"this.src='images/vapSTOPfollowvehicle0.gif'\" />";}else{followme.innerHTML="<img alt='' onclick=\"by();\" src='images/vapfollowvehicle0.gif' onmouseover=\"this.src='images/vapfollowvehicle1.gif'\" onmouseout=\"this.src='images/vapfollowvehicle0.gif'\" onmousedown=\"this.src='images/vapfollowvehicle0.gif'\" />";}}else{AlertMessage("You must be logged in to use this feature.");}};function gR(){if(!m_bLoggedIn){AlertMessage("You must be logged in to use this feature.");}else{Feed.SIcnFld(bL);}};function bL(result){if(result!=null){IconFolders=result.value;var divInfo="<table style='vertical-align:top;'><tr valign='top' align='center' style='vertical-align:top;'>";for(var i=0;i<IconFolders.Rows.length;i++){divInfo+="<td valign='top' style='vertical-align:bottom; cursor:pointer;'><img alt='' valign='top' onclick='useIcon("+i+");' src='images/"+IconFolders.Rows[i].iconFolder+"/Master.gif' /></td>";var j=(i+1)%8;if(j==0){divInfo+="</tr><tr valign='top' align='center' style='vertical-align:top;'>";}}divInfo+="</tr></table>";var divIconSelector=document.getElementById("divIconSelector");divIconSelector.innerHTML=divInfo;m_divIOverlay=null;m_divIOverlay=document.getElementById("divIconSelectorOverlay");bj("divIconSelectorOverlay");}Feed.SAdrMrk(ci);};function bG(){aF("divIconSelectorOverlay");};function useIcon(id){if(ControlPanelLockout==true||m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}IconFolderToUse=id;var VehIcon=document.getElementById("VehIcon");VehIcon.src="images/"+IconFolders.Rows[id].iconFolder+"/Master1.gif";bG();};function hd(){if(ControlPanelLockout==true||m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}if(vapName.value!=""){for(i=0;cars.Rows.length;i++){if(clickedOnSerial==cars.Rows[i].s){var iconFolder=null;if(IconFolderToUse!=null){iconFolder=IconFolders.Rows[IconFolderToUse].iconFolder;}cars.Rows[i].cl=vapFlagColor;cars.Rows[i].tc=vapTextColor;bn();Feed.UVeh(cars.Rows[i].s.toString(),vapName.value,cars.Rows[i].cl.value,cars.Rows[i].tc.value,iconFolder);break;}}}else{AlertMessage("You must supply the Flag Text.");}};function fK(){bn();skypeLink=document.getElementById("vaSkypeCallLink");skypeLink.href="#";skypeLink=document.getElementById("vaSkypeCallLink1");skypeLink.href="#";var ourCar=0;for(i=0;cars.Rows.length;i++){if(clickedOnSerial==cars.Rows[i].s){ourCar=i;break;}}m_vgodiv=document.getElementById("divSkypeDialer");bm();var originalPoint=map.LatLongToPixel(new VELatLong(cars.Rows[ourCar].lt*1,cars.Rows[ourCar].ln*1));m_vgodiv.style.left=originalPoint.x+20+"px";m_vgodiv.style.top=originalPoint.y+"px";bj("divSkypeDialer");Feed.SSkypNum(cars.Rows[ourCar].s.toString(),fD);};function fD(results){if(results!=null&&results.value!=null){var phoneNos=new Array();phoneNos=results.value;skypeLink=document.getElementById("vaAssignedDrivers");skypeLink.options.length=0;for(i=0;i<phoneNos.Rows.length;i++){if(phoneNos.Rows[i].Phone1!=null)skypeLink.options.add(new Option(phoneNos.Rows[i].Phone1,phoneNos.Rows[i].Phone1));if(phoneNos.Rows[i].Phone2!=null)skypeLink.options.add(new Option(phoneNos.Rows[i].Phone2,phoneNos.Rows[i].Phone2));}if(skypeLink.options.length!=0){skypeLink.selectedIndex=0;gB();}}skypeNo=document.getElementById("skypeNo");skypeNo.focus();};function gB(){phoneNos=document.getElementById("vaAssignedDrivers");if(phoneNos.options.length!=0){skypeLink=document.getElementById("vaSkypeCallLink");skypeLink.href="skype:+"+phoneNos.options[phoneNos.selectedIndex].text+"?call";}};function cr(){skypeLink=document.getElementById("vaSkypeCallLink");skypeLink.href="#";skypeLink=document.getElementById("vaSkypeCallLink1");skypeLink.href="#";m_alertdiv=document.getElementById("divSkypeDialer");aF("divSkypeDialer");};function hO(event){var keycode;if(window.event){keycode=event.keyCode;}else if(e.which){keycode=e.which;}if(keycode==13){var skypeButton=document.getElementById("vaSkypeCallLink1");skypeButton.click();}else{gg(-1);}};function gg(key){skypeNo=document.getElementById("skypeNo");switch(key){case-1:break;case 10:skypeNo.value+="*";break;case 11:skypeNo.value+="#";break;default:skypeNo.value+=key;}skypeLink=document.getElementById("vaSkypeCallLink1");if(skypeNo.value!=""){skypeLink.href="skype:+"+skypeNo.value+"?call";}else{skypeLink.href="#";}skypeNo.focus();};function bn(){aF("divColorPopOverLay");aF("divVehicleAction");};function fV(){if(m_bLoggedIn){m_alertdiv=null;m_alertdiv=document.getElementById("divVehicleGroupOverlay");m_alertdiv.style.display="block";m_alertdiv.style.position="absolute";m_alertdiv.style.visibility="visible";bj("divVehicleGroupOverlay");hf();}else{AlertMessage("You must be logged in to use this feature.");}};function cq(){aF("divVehicleGroupOverlay");var vgAddGroup=document.getElementById("divAddGroup");vgAddGroup.style.display="inline";vgAddGroup.style.visibility="hidden";var vgRemoveGroup=document.getElementById("divRemoveGroup");vgRemoveGroup.style.display="none";vgRemoveGroup.style.visibility="hidden";};function fW(){if(m_bLoggedIn){m_alertdiv=null;m_alertdiv=document.getElementById("divVehicleDriverOverlay");m_alertdiv.style.display="block";m_alertdiv.style.position="absolute";m_alertdiv.style.top="5px";m_alertdiv.style.left="-220px";m_alertdiv.style.visibility="visible";bj("divVehicleDriverOverlay");ho();}else{AlertMessage("You must be logged in to use this feature.");}};function cu(){aF("divVehicleDriverOverlay");var vgAddDriver=document.getElementById("divAddDriver");vgAddDriver.style.display="inline";vgAddDriver.style.visibility="hidden";var vgRemoveDriver=document.getElementById("divRemoveDriver");vgRemoveDriver.style.display="none";vgRemoveDriver.style.visibility="hidden";};function fz(){if(m_bLoggedIn){bj("divAddressesOverlay");document.getElementById('addressAdd').style.display="inline";}else{AlertMessage("You must be logged in to use this feature.");}};function cX(){if(NewAddressMarkerPresent){NewAddressPin.Hide();map.DeleteShape(NewAddressPin);NewAddressMarkerPresent=false;}aF("divAddressesOverlay");document.getElementById('addressAdd').style.visibility="hidden";document.getElementById('addressRemove').style.visibility="hidden";m_SelectPoint=false;};function eE(){if(ChatIsOpen!=true){var crlf=String.fromCharCode(13)+String.fromCharCode(10);if(m_bLoggedIn){m_divOLROverlay=null;m_divOLROverlay=document.getElementById("divOnlineChatOverlay");m_divOLROverlay.style.marginTop=parseInt(0);bj("divOnlineChatOverlay");ChatLines=new Array();ChatLines.push("Live Chat Support hours are 7am to 7pm Central Time Monday through Friday,"+crlf+"and 9am to 4pm Central Time on Saturdays."+crlf+crlf);ChatLines.push(dtime+" - "+m_CurrentUser+": "+"*** Live Support Session Opened ***"+crlf);dO();ChatIsOpen=true;ChatWaitTime=5000;gl();m_divOLROverlay=null;}else{AlertMessage("You must be logged in to use this feature.");}}};function cy(){clearTimeout(m_checkMesagesTimeout);aF("divOnlineChatOverlay");var sessionID=document.getElementById("SESSIONKEY").getAttribute("value");ChatWaitTime=10000;gl();ChatIsOpen=false;};function eg(){var ChatIP=document.getElementById("textChatOutput");if(ChatIP.value!=""){var crlf=String.fromCharCode(13)+String.fromCharCode(10);var currentTime=new Date();ChatLines.push(currentTime+" - "+m_CurrentUser+": "+ChatIP.value+crlf);dO();Feed.IOnlCht(m_CurrentUser,ChatIP.value);ChatIP.value="";}};function gl(){clearTimeout(m_checkMesagesTimeout);var sessionID=document.getElementById("SESSIONKEY").getAttribute("value");m_checkMesagesTimeout=setTimeout("au('"+sessionID+"');",ChatWaitTime);};function au(){Feed.ChkOnlMsg(m_CurrentUser,ChatMsgNo*1,am)};function am(Response){var crlf=String.fromCharCode(13)+String.fromCharCode(10);if(Response!=null&&Response.value!=null){if(ChatIsOpen!=true){eE();}var ChatMsg=Response.value;if(ChatMsg.Rows.length>0){for(var i=0;i<ChatMsg.Rows.length;i++){ChatLines.push(ChatMsg.Rows[i].PostTime+" - "+ChatMsg.Rows[i].SenderUserID+": "+ChatMsg.Rows[i].MsgPayload);ChatMsgNo=ChatMsg.Rows[i].MsgNumber;}dO();}}var WaitTime=5000;if(ChatIsOpen==true){WaitTime=5000;}gl();};function dO(){var crlf=String.fromCharCode(13)+String.fromCharCode(10);var opLine="";for(var i=0;i<ChatLines.length;i++){opLine+=ChatLines[i];}var chatOp=document.getElementById("ChatIP");chatOp.value=opLine;chatOp.scrollTop=chatOp.scrollHeight;};function cf(Response){ChatMsgNo=Response.value;gl();};function dX(){bj("divNAVMessageCenter");};function da(){ce();cb();aF("divNAVMessageCenter");};function gr(cbElement,targetfield){var strContent="";var cblist=document.getElementsByName(cbElement);for(var i=1;i<cblist.length;i++){if(cblist[i].checked==true){strContent=strContent+cblist[i].parentNode.innerText+";";}else{cblist[0].checked=false;}}if(targetfield!=null&&targetfield!=""){m_divOLROverlay=document.getElementById(targetfield);m_divOLROverlay.value="";m_divOLROverlay.value=strContent;}};function gs(cbElement,targetfield){var strContent="";var cblist=document.getElementsByName(cbElement);if(cblist[0].checked==true){for(var i=1;i<cblist.length;i++){cblist[i].checked=true;strContent=strContent+cblist[i].parentNode.innerText+";";}if(targetfield!=null&&targetfield!=""){m_divOLROverlay=document.getElementById(targetfield);m_divOLROverlay.value="";m_divOLROverlay.value=strContent;}}};function gz(){var divCNAVUnitlist=document.getElementById("CNAVUnitList");divCNAVUnitlist.style.visibility="visible";divCNAVUnitlist.style.display="block";divCNAVUnitlist.focus;};function ce(){var divCNAVUnitlist=document.getElementById("CNAVUnitList");divCNAVUnitlist.style.visibility="hidden";divCNAVUnitlist.style.display="none";};function gx(){var divCNAVDispatchDroplist=document.getElementById("CNAVDispatchDroplist");divCNAVDispatchDroplist.style.visibility="visible";divCNAVDispatchDroplist.style.display="block";divCNAVDispatchDroplist.focus;};function cG(){var divCNAVDispatchDroplist=document.getElementById("CNAVDispatchDroplist");divCNAVDispatchDroplist.style.visibility="hidden";divCNAVDispatchDroplist.style.display="none";};function dW(AId,BId){var e1=document.getElementById(AId);var e2=document.getElementById(BId);var l1=e1.value.length;(l1>230)?e1.value=e1.value.substring(0,230):e2.innerHTML=(230-l1).toString()+" Characters remaining.";};function hw(){bj("divCannery");dZ();ai();CanneryPost="DispatchReturnOptions";};function hA(){bj("divCannery");dZ();ai();CanneryPost="MessageReturnOptions";};function ai(){var counter=document.getElementById("Label2");var strList="";var count=0;var n=0;var cblist=document.getElementsByName('cmbox');for(var i=0;i<cblist.length;i++){if(cblist[i].checked==true){n++;}}var string="("+n.toString()+" are currently selected)";counter.innerHTML=string;};function dZ(){Feed.SCanRsp(m_CurrentUser,fn);};function fn(data){if(data.value!=null){m_CanneryList=data.value;var string="";var checkedstate="";for(var i=0;i<m_CanneryList.Rows.length;i++){if(m_CanneryList.Rows[i].Activated){checkedstate='checked'}else{checkedstate=''};string+="<label class='whiteType' style='padding-right:3px; display:block;'><input type='checkbox' id='cmbox' name='cmbox' value = '"+i.toString()+"' "+checkedstate+" onclick='ai();'/>"+m_CanneryList.Rows[i].CannedMsg+"</label>";}document.getElementById("CanneryList").innerHTML=string;}hx();};function fO(){var strList="";var count=0;var cblist=document.getElementsByName('cmbox');for(var i=0;i<cblist.length;i++){if(cblist[i].checked==true){if(count>0){strList+="; ";}strList+=cblist[i].parentNode.innerText;count+=1;}}if(CanneryPost=="MessageReturnOptions"){var canResponse=document.getElementById("MessageReturnOptions");canResponse.value=strList;}else{var canResponse=document.getElementById("DispatchReturnOptions");canResponse.value=strList;}aF("divCannery");};function cb(){aF("divCannery");var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";};function aL(){var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";};function hI(){var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CannedMsgtxt");divCanneryEdit.value="";var divCanneryEdit=document.getElementById("CanAutoSelcted");divCanneryEdit.checked=false;};function hD(){var cblist=document.getElementsByName('cmbox');for(var i=0;i<cblist.length;i++){cblist[i].checked=false;}var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";};function hy(){var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";};function hx(){var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";};function aa(){var divCanneryEdit=document.getElementById("CanneryRUSure");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryTask");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryAdd");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CanneryRemove");divCanneryEdit.style.visibility="hidden";divCanneryEdit.style.display="none";var divCanneryEdit=document.getElementById("CannerySelect");divCanneryEdit.style.visibility="visible";divCanneryEdit.style.display="block";};function aO(){oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");var inputCannedMsgtxt=document.getElementById("CannedMsgtxt");var inputCanAutoSelected=document.getElementById("CanAutoSelcted");Feed.ICanRsp(m_CurrentUser,sessionQueryKey,inputCannedMsgtxt.value,inputCanAutoSelected.checked,dZ);};function fm(){oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");var cblist=document.getElementsByName('cmbox');for(var i=0;i<cblist.length;i++){if(cblist[i].checked==true){Feed.DCanRsp(m_CurrentUser,sessionQueryKey,cblist[i].parentNode.innerText,dZ);}}};function hH(){var TargetRecipients=document.getElementById("MessageTo");var TargetDevices=new Array();var MessageContent=document.getElementById("mText");var ReturnOptions=document.getElementById("MessageReturnOptions");var itext=document.getElementById("iText");var crlf=String.fromCharCode(13)+String.fromCharCode(10);var MsgType="3";var msgOpts=new Array();var stringMsg="";var i=0;var e=0;var n=0;var recipients=new Array();recipients=TargetRecipients.value.split(';');for(e=0;e<recipients.length-1;e++){for(i=0;i<cars.Rows.length;i++){if(UCase(gh(cars.Rows[i].n))==UCase(gh(recipients[e]))){TargetDevices[n]=cars.Rows[i].s;n=n+1;break;}}}if(ReturnOptions.value!=''){MsgType="2";var j=0;for(var i=1;i<10;i++){msgOpts.push("");}msgOpts=ReturnOptions.value.split(';');for(i=0;i<msgOpts.length;i++){msgOpts[i]=msgOpts[i];}}oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");for(i=0;i<TargetDevices.length;i++){var targetdevice=TargetDevices[i];Feed.IMsgCpl(m_CurrentUser,sessionQueryKey,targetdevice.toString(),MsgType,MessageContent.value,msgOpts);stringMsg=dtime+" - "+m_CurrentUser+" to "+recipients[i]+": "+MessageContent.value;if(ReturnOptions.value!=''){stringMsg+=" (Return Options:"+ReturnOptions.value+")"}itext.value+=stringMsg+crlf;}itext.scrollTop=itext.scrollHeight;};function hE(){var TargetRecipients=document.getElementById("DispatchTo");var TargetDevices=new Array();var MessageContent=document.getElementById("dText");var DispatchReturnOptions=document.getElementById("DispatchReturnOptions");var itext=document.getElementById("iText");var crlf=String.fromCharCode(13)+String.fromCharCode(10);var MsgType="3";var msgOpts=new Array();var stringMsg="";var i=0;var e=0;var n=0;var recipients=new Array();recipients=TargetRecipients.value.split(';');for(e=0;e<recipients.length-1;e++){for(i=0;i<cars.Rows.length;i++){if(UCase(gh(cars.Rows[i].n))==UCase(gh(recipients[e]))){TargetDevices[n]=cars.Rows[i].s;n=n+1;break;}}}if(DispatchReturnOptions.value!=''){MsgType="2";var j=0;for(var i=1;i<10;i++){msgOpts.push("");}msgOpts=DispatchReturnOptions.value.split(';');for(i=0;i<msgOpts.length;i++){msgOpts[i]=msgOpts[i];}}oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");for(i=0;i<TargetDevices.length;i++){addressFind=document.getElementById("DTDtxtAddressFind");if(addressFind.value=="1234 North Any Street, City, State"||gh(addressFind.value,"")==""){AlertMessage("A destination has not been defined.");return false;}if(addressFind.value.indexOf(';')> -1){var tmpArray=new Array();tmpArray=addressFind.value.split(';');rLat=tmpArray[0];rLon=tmpArray[1];Feed.MpPntRvGeo(rLat,rLon,aj);gY("Please verify the address is correct and press Send.");return false;}else{if(rLat==null||rLon==null){aw();gY("Please verify the address is correct and press Send.");return false;}var targetdevice=TargetDevices[i];if(MessageContent.value!=''){Feed.IMsgCpl(m_CurrentUser,sessionQueryKey,targetdevice.toString(),MsgType,MessageContent.value,msgOpts);stringMsg=dtime+" - "+m_CurrentUser+" to "+recipients[i]+": "+MessageContent.value;if(DispatchReturnOptions.value!=''){stringMsg+=" (Return Options:"+DispatchReturnOptions.value+")"}itext.value+=stringMsg+crlf;}var addrs=addressFind.value.split(',');Feed.IDrvDir(m_CurrentUser,targetdevice.toString(),gh(addrs[0]),gh(addrs[1]),gh(addrs[2]),rLat+"",rLon+"",bV);stringMsg=dtime+" - "+recipients[i]+" Dispatched to "+addressFind.value+".";itext.value+=stringMsg+crlf;}}itext.scrollTop=itext.scrollHeight;dX();};function fS(){if(m_bLoggedIn){bn();bj("divSendDirections");var center=map.GetCenter();var addressLAT=center.Latitude;var addressLON=center.Longitude;var pixel=map.LatLongToPixel(center);pixel.x=pixel.x-0;pixel.y=pixel.y-0;var LL=map.PixelToLatLong(pixel);var imgloc="images/CrossHairs.gif";DestinationPin=new VEShape(VEShapeType.Pushpin,LL);DestinationPin.SetTitle(DestinationMarker);DestinationPin.SetCustomIcon(imgloc);map.AddShape(DestinationPin);DestinationPinPresent=true;rLat=null;rLon=null;addressFind=document.getElementById("DTDtxtAddressFind");addressFind.value="1234 North Any Street, City, State";addressFind.focus();}else{AlertMessage("You must be logged in to use this feature.");}};function bV(){if(DestinationPinPresent){DestinationPin.Hide();map.DeleteShape(DestinationPin);DestinationPinPresent=false;}aF("divSendDirections");};function aj(response){if(response!=null){addressText=document.getElementById("DTDtxtAddressFind");addressText.value=response.value;}};function aw(){addressFind=document.getElementById("DTDtxtAddressFind");map.Find(null,addressFind.value,null,null,null,null,true,true,null,true,aN);};function aN(layer,resultsArray,places,hasMore,veErrorMessage){if(places[0]==null){AlertMessage("Address not found.");return;}else{place=places[0].LatLong;var addressLAT=place.Latitude;var addressLON=place.Longitude;var addressFind=document.getElementById("DTDtxtAddressFind");addressFind.value=places[0].Name;var pixel=map.LatLongToPixel(new VELatLong(addressLAT,addressLON));pixel.x=pixel.x-25;pixel.y=pixel.y-25;var LL=map.PixelToLatLong(pixel);DestinationPin.SetPoints(LL);rLat=LL.Latitude;rLon=LL.Longitude;}};function UCase(strInput){return strInput.toUpperCase();};function ib(str){var str=str.replace(/^\s\s*/,''),ws=/\s/,i=str.length;while(ws.test(str.charAt(--i)));return str.slice(0,i+1);};function dg(response){DriverMesageNumber=response.value;MessageFromDriverTimer=setInterval("aU();",15000);};function fU(id){if(m_bLoggedIn){bn();m_divOLROverlay=null;m_divOLROverlay=document.getElementById("divSendMessageToDriver");var txtMessageToDriver=document.getElementById("txtMessageToDriver");txtMessageToDriver.value="";mtdPhoneNo=document.getElementById("mtdPhoneNo");mtdPhoneNo.value="";mtdCarrier=document.getElementById("mtdCarrier");mtdCarrier.value="";m_divOLROverlay.style.marginTop=parseInt(0);m_divOLROverlay.style.position="absolute";m_divOLROverlay.style.top="4px";m_divOLROverlay.style.left="22px";m_divOLROverlay.style.height="400px";bj("divSendMessageToDriver");txtMessageToDriver.focus();}else{AlertMessage("You must be logged in to use this feature.");}};function ca(){aF("divSendMessageToDriver");};function gV(){var txtMessageToDriver=document.getElementById("txtMessageToDriver");if(gh(txtMessageToDriver.value," ")==""){AlertMessage("You must enter a message to send.");return;}clickedOnSerial+="";mtdPhoneNo=document.getElementById("mtdPhoneNo");mtdCarrier=document.getElementById("mtdCarrier");if(mtdPhoneNo.value==""){AlertMessage("You must enter a phone number.");return;}if(mtdCarrier.value==""){AlertMessage("You must select a carrier.");return;}Feed.IDrvMsg(m_CurrentUser,txtMessageToDriver.value,mtdPhoneNo.value+"@"+mtdCarrier.value,hK)};function hK(results){ActionCompleted("Text message sent to driver");ca();oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");};function aU(){oSESSIONKEY=document.getElementById("SESSIONKEY");var sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SDrvMsg(m_CurrentUser,sessionQueryKey,DriverMesageNumber*1,aT);};function aT(results){driverResponse=results.value;var carName="";var crlf=String.fromCharCode(13)+String.fromCharCode(10);if(driverResponse!=null&&typeof(driverResponse)=="object"&&driverResponse.Rows.length>0){for(var i=0;i<cars.Rows.length;i++){if(cars.Rows[i].s==driverResponse.Rows[0].Sender||cars.Rows[i].s==driverResponse.Rows[0].VehicleId){carName=cars.Rows[i].n;}}var stringMsg="";if(driverResponse.Rows[0].Type==3&&driverResponse.Rows[0].DeviceInitiated==1){NAVMsghandle=document.getElementById("divNAVMessageCenter");if(NAVMsghandle.style.visibility!="visible"){dX();}stringMsg="";var currentTime=new Date();stringMsg=dtime+" - "+carName+": "+driverResponse.Rows[0].Question;var itext=document.getElementById("iText");itext.value+=stringMsg+""+crlf;}else{if(driverResponse.Rows[0].Type==4){if(driverResponse.Rows[0].Response==0){stringMsg+="Yes";}else{stringMsg+="No";}}else if(driverResponse.Rows[0].Type==3){stringMsg+=driverResponse.Rows[0].Response;}else if(dB(driverResponse.Rows[0].Response)){switch(driverResponse.Rows[0].Response){case "0":stringMsg+=driverResponse.Rows[0].Option1;break;case "1":stringMsg+=driverResponse.Rows[0].Option2;break;case "2":stringMsg+=driverResponse.Rows[0].Option3;break;case "3":stringMsg+=driverResponse.Rows[0].Option4;break;case "4":stringMsg+=driverResponse.Rows[0].Option5;break;case "5":stringMsg+=driverResponse.Rows[0].Option6;break;case "6":stringMsg+=driverResponse.Rows[0].Option7;break;case "7":stringMsg+=driverResponse.Rows[0].Option8;break;case "8":stringMsg+=driverResponse.Rows[0].Option9;break;}}else{stringMsg+=driverResponse.Rows[0].Response;}NAVMsghandle=document.getElementById("divNAVMessageCenter");if(NAVMsghandle.style.visibility!="visible"){dX();}var currentTime=new Date();stringMsg=dtime+" - "+carName+": Response:"+stringMsg+" (Original Message:"+driverResponse.Rows[0].Question+")";var itext=document.getElementById("iText");itext.value+=stringMsg+crlf;}itext.scrollTop=itext.scrollHeight;}else{}};function fv(event){var keycode;if(window.event){keycode=event.keyCode;}else if(e.which){keycode=e.which;}else{du(-1);}};function du(key){mtdPhoneNo=document.getElementById("mtdPhoneNo");switch(key){case-1:break;case 10:mtdPhoneNo.value+="*";break;case 11:mtdPhoneNo.value+="#";break;default:mtdPhoneNo.value+=key;}};function eD(){m_divROverlay=document.getElementById("divLoadNotification");m_divROverlay.style.visibility="visible";vloader_src=document.getElementById("vloader");if(vloader_src!=null)vloader_src.src=cached_loader.src;};function bK(){m_divROverlay=document.getElementById("divLoadNotification");m_divROverlay.style.visibility="hidden";};function eJ(){bj("divSearchResults");};function cg(){aD();m_divROverlay=document.getElementById("divSearchResults");aF("divSearchResults");};function aD(){if(FindResultArray.length>0){for(var i=0;i<FindResultArray.length;i++){FindResultArray[i].Shape.Hide();ResultInfo[i].Hide();}}};function fg(message){m_divROverlay=document.getElementById("divDemoNotification");m_divROverlay.style.marginTop=parseInt(0);m_divROverlay.style.display="block";m_divROverlay.style.visibility="visible";m_divROverlay.style.position="absolute";m_divROverlay.style.width="488px";m_divROverlay.style.height="308px";m_divROverlay.style.top="162px";m_divROverlay.style.left="262px";m_divROverlay=null;vloader_src=document.getElementById("vloader");if(vloader_src!=null)vloader_src.src=cached_loader.src;};function bz(){m_divROverlay=document.getElementById("divDemoNotification");m_divROverlay.style.visibility="hidden";m_divROverlay=null;};function dL(message){m_divROverlay=document.getElementById("divGeneralNotification");bm();m_divROverlay.style.top=parseInt(windowHeight/2);m_divROverlay.style.left=parseInt(windowWidth/2-130);m_divROverlay.style.visibility="visible";textMessage=document.getElementById("GENERALTEXTMSG");textMessage.innerHTML=message;vloader_src=document.getElementById("vloader");if(vloader_src!=null)vloader_src.src=cached_loader.src;};function bB(){m_divROverlay=document.getElementById("divGeneralNotification");m_divROverlay.style.visibility="hidden";};function AlertMessage(message){textMessage=document.getElementById("divXMessage");textMessage.innerHTML=message;bj("divMessageWithX");};function dc(){aF("divMessageWithX");};function gY(message){textMessage=document.getElementById("divBlankMsg");textMessage.innerHTML=message;bj("divBlankMsgWithX");};function cE(){aF("divBlankMsgWithX");};function ActionCompleted(message){textMessage=document.getElementById("divOutput");textMessage.innerHTML=message;bj("divActionCompleted");};function cY(){aF("divActionCompleted");};function bD(){windowWidth=parseInt(window.screen.width-20);windowHeight=parseInt(window.screen.height-190);};function bm(){if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}if(requestedHeight!=0&&requestedWidth!=0){windowHeight=requestedHeight;windowWidth=requestedWidth;}};function ae(){bm();var ob=document.getElementById("divMap");ob.style.visibility="hidden";elementMainTable=document.getElementById("tblMain");currentTime=new Date();m_strDateTime=currentTime;eC();TheBrowser=gf();if(TheBrowser=="safari"){browserSafari=true;my_object=document.getElementById("txtUserID");my_object.style.color="#000000";my_object=document.getElementById("txtPassword");my_object.style.color="#000000";my_object=document.getElementById("TextSearch");my_object.style.color="#000000";document.getElementById('vehicleGroups').style.padding=safariPadding;document.getElementById('tblAddressesOverlay').style.padding=safariPadding;document.getElementById('tblAlertOverlay').style.padding=safariPadding;document.getElementById('tblVehicleDriver').style.padding=safariPadding;document.getElementById('divRouting').style.padding=safariPadding;document.getElementById('tblOnlineChat').style.padding=safariPadding;}var strParams=location.pathname.split("/");var strPage=strParams[strParams.length-1];m_divMap=document.getElementById("divMap");switch(strPage){case "map.aspx":m_ddlVehicles=document.getElementById("ddlVehicles");m_ddlAlerts=document.getElementById("ddlAlertList");m_ddlCannery=document.getElementById("ddlCannery");m_AlertVehicleList=document.getElementById("ddlVehicleSpeedAlert");m_ZoneVehicleList=document.getElementById("ddlVehicleZoneAlert");m_OLRVehiclesList=document.getElementById("ddlOLRVehicles");m_VTVehiclesList=document.getElementById("ddlVTVehicles");m_IGNVehicleList=document.getElementById("ddlVehicleIgnAlert");m_ddlVehicleGroupEditor=document.getElementById("vgVehicles");m_ddlVehicleDriversEditor=document.getElementById("vdVehicles");hz();ey();dv(-1);tooltip=document.createElement("div");as();break;}dR();ob=document.getElementById("divMap");ob.style.visibility="visible";ActivityTray=false;Feed.SIcnFld(dQ);m_loadTimeout=setTimeout("cv('');",2000);ob=null;};function cv(){aF("splash");};function an(){var strParams=location.pathname.split("/");var strPage=strParams[strParams.length-1];switch(strPage){case "map.aspx":dR();break;default:break;}};function ap(){var strParams=location.pathname.split("/");var strPage=strParams[strParams.length-1];switch(strPage){case "map.aspx":break;}};function bJ(){AlertMessage("Your Microsoft Virtual Earth token has expired<br/>because your session exceeded their time limit.<br/>(This is their rule, not ours.)<br/> Please log in again");dG();};function bM(){};function ey(){map=new VEMap('divMap');var token=document.getElementById("token");if(token!=null){map.SetClientToken(token.value);}else{}map.LoadMap(new VELatLong(37.160317,-99.667969),4,VEMapStyle.Hybrid,false,VEMapMode.Mode2D,false,0);map.HideDashboard();map.AttachEvent('ontokenexpire',bJ);map.AttachEvent('ontokenerror',bM);map.AttachEvent('onclick',eu);map.AttachEvent('onmousemove',eB);map.AttachEvent("onmouseover",eH);map.AttachEvent("onmouseout",eG);map.AttachEvent("onmousedown",et);map.AttachEvent("onmouseup",eI);map.AttachEvent("onendzoom",fx);map.AttachEvent("onendpan",fG);Feed.SMblCar(bI);};function bI(response){SMSPROVIDERGFOBJ=document.getElementById("SMSPROVIDERGF");SMSPROVIDERSZOBJ=document.getElementById("SMSPROVIDERSZ");SMSPROVIDERSPOBJ=document.getElementById("SMSPROVIDERSP");SMSPROVIDERIGNOBJ=document.getElementById("SMSPROVIDERIGN");DriverPROVIDER1=document.getElementById("DriverPROVIDER1");DriverPROVIDER2=document.getElementById("DriverPROVIDER2");mtdCarrier=document.getElementById("mtdCarrier");if((SMSPROVIDERGFOBJ!=null)&&(SMSPROVIDERSZOBJ!=null)&&(SMSPROVIDERSPOBJ!=null)){for(var i=(SMSPROVIDERGFOBJ.options.length-1);i>=0;i--){SMSPROVIDERGFOBJ.options[i]=null;}for(var i=(SMSPROVIDERSZOBJ.options.length-1);i>=0;i--){SMSPROVIDERSZOBJ.options[i]=null;}for(var i=(SMSPROVIDERSPOBJ.options.length-1);i>=0;i--){SMSPROVIDERSPOBJ.options[i]=null;}for(var i=(SMSPROVIDERIGNOBJ.options.lenght-1);i>=0;i--){SMSPROVIDERIGNOBJ.options[i]=null;}for(var i=(mtdCarrier.options.length-1);i>=0;i--){mtdCarrier.options[i]=null;}for(var i=(DriverPROVIDER1.options.lenght-1);i>=0;i--){DriverPROVIDER1.options[i]=null;}for(var i=(DriverPROVIDER2.options.lenght-1);i>=0;i--){DriverPROVIDER2.options[i]=null;}providers=response.value;if(providers!=null&&typeof(providers)=="object"&&providers.Rows.length>0){DriverPROVIDER1.options[i]=new Option("","");DriverPROVIDER2.options[i]=new Option("","");for(var i=0;i<providers.Rows.length;i++){SMSPROVIDERGFOBJ.options[i]=new Option(providers.Rows[i].name,providers.Rows[i].URL);SMSPROVIDERSZOBJ.options[i]=new Option(providers.Rows[i].name,providers.Rows[i].URL);SMSPROVIDERSPOBJ.options[i]=new Option(providers.Rows[i].name,providers.Rows[i].URL);SMSPROVIDERIGNOBJ.options[i]=new Option(providers.Rows[i].name,providers.Rows[i].URL);DriverPROVIDER1.options[i+1]=new Option(providers.Rows[i].name,providers.Rows[i].URL);DriverPROVIDER2.options[i+1]=new Option(providers.Rows[i].name,providers.Rows[i].URL);mtdCarrier.options[i+1]=new Option(providers.Rows[i].name,providers.Rows[i].URL);}}}};function StandardizeTimeFormat(inboundatum,outboundatum){var indat=inboundatum.toString();var outboundatum="";var datetimeset=indat.split(" ");var newdatetime="";if(TheBrowser=="internet explorer"){newdatetime=datetimeset[0]+" ";newdatetime+=datetimeset[1]+" ";newdatetime+=datetimeset[2]+" ";newdatetime+=datetimeset[5]+" ";newdatetime+=datetimeset[3];}else{newdatetime=datetimeset[0]+" ";newdatetime+=datetimeset[1]+" ";newdatetime+=datetimeset[2]+" ";newdatetime+=datetimeset[3]+" ";newdatetime+=datetimeset[4];}return newdatetime;};function dv(sessionID){if(m_bViewHistory){clearInterval(m_loadInterval);return;}m_loadMarkerRunning=true;groupFilter=document.getElementById("ddlGroups");if(sessionID!=null&&sessionID!=''&&sessionID!= -1){if(m_groupView){if(m_vehicleGroups.Rows[groupFilter.selectedIndex-1].serials!=null){var filterString=m_vehicleGroups.Rows[groupFilter.selectedIndex-1].serials;while(filterString.charAt(filterString.length-1)==" "||filterString.charAt(filterString.length-1)==","){filterString=filterString.substring(0,filterString.length-1);}Feed.SLvData(sessionID,filterString,dP);}else{Feed.SLvData(sessionID,"0",dP);}}else if(m_ddlVehicles.value!=""&&m_ddlVehicles.value!=null&&m_ddlVehicles.value!= -1){if(!m_bViewHistory){Feed.SLvData(sessionID,m_ddlVehicles.value,dP);}}else{Feed.SLvData(sessionID,"0",dP);}}};function dP(response){dtime=U();var dtimeNoYear=bc();clearInterval(m_loadInterval);if(m_bViewHistory){return;}m_divROverlay=document.getElementById("divLoadNotification");if(m_divROverlay!=null){if(m_divROverlay.style.visibility!="hidden"){bK();}}cars=response.value;if(cars!=null&&typeof(cars)=="object"&&cars.Rows.length>0){if(carPins.length!=cars.Rows.length){m_firstRetrieve=true;}if(m_firstRetrieve==true){lastCars=cars;}for(var i=0;i<carPins.length;i++){carPins[i].Hide();nameTags[i].Hide();infoBoxes[i].Hide();}aE();var carWeAreFollowing=0;if(m_firstRetrieve==true){carPins=new Array();nameTags=new Array();infoBoxes=new Array();if(map.GetShapeLayerCount()>1){map.DeleteAllShapeLayers();}}var minLat=50000000;var minLon=50000000;var maxLat= -50000000;var maxLon= -50000000;var NeedToLoadDropDown=0;var cnavunitlistText="";var cnavdisplist="";var cnavunitcount=1;if(m_ddlVehicles.options.length==0){bPopulateOptions=true;cnavunitlistText="<label class='whiteType' style='padding-right:3px;display:block;'><input name='cbvlist' value='1' type='checkbox' id='cb1' onclick='gs(\"cbvlist\",\"MessageTo\");' />ALL Devices</label>";cnavdisplist="<label class='whiteType' style='padding-right:3px;display:block;'><input name='cbdlist' value='1' type='checkbox' id='cd1' onclick='gs(\"cbdlist\",\"DispatchTo\");' />ALL Devices</label>";m_ddlVehicles.options[0]=new Option("View All Vehicles","-1");m_ddlVehicleGroupEditor[0]=new Option("Add All Vehicles","-1");m_ddlVehicleDriversEditor[0]=new Option("Add All Vehicles","-1");m_AlertVehicleList.options[0]=new Option("View All Vehicles","-1");m_ZoneVehicleList.options[0]=new Option("View All Vehicles","-1");m_OLRVehiclesList.options[0]=new Option("All Vehicles","-1");m_IGNVehicleList.options[0]=new Option("All Vehicles","-1");NeedToLoadDropDown=1;}PinIds=new Array();var points=new Array;ActivityOut=ActivityHeader;ActivityCount=0;for(var i=0;i<cars.Rows.length;i++){var eightcheck=cars.Rows[i].s+"";if(eightcheck.substring(0,1)=="8"){EightThousandPresent=true;}if(vehicleToFollow!=null){if(cars.Rows[i].s==vehicleToFollow){carWeAreFollowing=i;}}if(NeedToLoadDropDown==1){m_ddlVehicles.options[m_ddlVehicles.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);if(cars.Rows[i].s>=8000000){cnavunitcount=cnavunitcount+1;cnavunitlistText+="<label class='whiteType' style='padding-right:3px;display:block;'><input name='cbvlist' value='"+cnavunitcount.toString()+"' type='checkbox' id='cb"+cnavunitcount.toString()+"' onclick='gr(\"cbvlist\",\"MessageTo\");' />"+cars.Rows[i].n+"</label>";cnavdisplist+="<label class='whiteType' style='padding-right:3px;display:block;'><input name='cbdlist' value='"+cnavunitcount.toString()+"' type='checkbox' id='cd"+cnavunitcount.toString()+"' onclick='gr(\"cbdlist\",\"DispatchTo\");' />"+cars.Rows[i].n+"</label>";}m_ddlVehicleGroupEditor.options[m_ddlVehicleGroupEditor.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_ddlVehicleDriversEditor.options[m_ddlVehicleDriversEditor.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_AlertVehicleList.options[m_AlertVehicleList.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_ZoneVehicleList.options[m_ZoneVehicleList.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_OLRVehiclesList.options[m_OLRVehiclesList.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_VTVehiclesList.options[m_VTVehiclesList.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);m_IGNVehicleList.options[m_IGNVehicleList.options.length]=new Option(cars.Rows[i].n,cars.Rows[i].s);}points[i]=new VELatLong(cars.Rows[i].lt*1,cars.Rows[i].ln*1);if((cars.Rows[i].lt*1)<minLat){minLat=cars.Rows[i].lt*1};if((cars.Rows[i].lt*1)>maxLat){maxLat=cars.Rows[i].lt*1};if((cars.Rows[i].ln*1)<minLon){minLon=cars.Rows[i].ln*1};if((cars.Rows[i].ln*1)>maxLon){maxLon=cars.Rows[i].ln*1};var direction=(Math.floor(((cars.Rows[i].o*1)+5)/10)*10);if(direction>=360){direction=0};var mapstyle=map.GetMapStyle();if(mapstyle=="b"){var be=map.GetBirdseyeScene();var maporentation=be.GetOrientation();if(maporentation=="East"){direction=direction+270};if(maporentation=="South"){direction=direction+180};if(maporentation=="West"){direction=direction+90};if(direction>360){direction=direction-360};}var tmpXCenter=0;var tmpYCenter=0;if(cars.Rows[i].XCenter!=null){tmpXCenter=13-cars.Rows[i].XCenter;}if(cars.Rows[i].YCenter!=null){tmpYCenter=13-cars.Rows[i].YCenter;}var imageloc="<img style='margin: "+tmpYCenter+"px 0px 0px "+tmpXCenter+"px' src='images/";var imageFolder="default";if(cars.Rows[i].iconFolder!=null&&cars.Rows[i].iconFolder!=""){imageFolder=cars.Rows[i].iconFolder;}imageloc+=imageFolder+"/v"+direction+".gif'/>";var tempTime=cars.Rows[i].timeStamp;var revisedTime="";revisedTime=StandardizeTimeFormat(tempTime);var kph=Math.round(cars.Rows[i].v*1.60934);var string="<br/><br/>"+"&nbsp;&nbsp;&nbsp;&nbsp;<b>VehicleID:</b>"+cars.Rows[i].s+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Latitude: </b>"+cars.Rows[i].lt+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Longitude: </b>"+cars.Rows[i].ln+"<br />";if(cars.Rows[i].address==null||cars.Rows[i].address==""){string+="&nbsp;&nbsp;&nbsp;&nbsp;<b>Address: </b>&nbsp;&nbsp;Coming Soon<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;"+"<br />";}else{var tmpstr=new Array;tmpstr=cars.Rows[i].address.split("^",2);string+="&nbsp;&nbsp;&nbsp;&nbsp;<b>Address: </b>"+tmpstr[0]+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+tmpstr[1]+"<br />";}string+="&nbsp;&nbsp;&nbsp;&nbsp;<b>Heading: </b>"+cars.Rows[i].o+"&#176 / "+ac(cars.Rows[i].o,cars.Rows[i].v)+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Velocity: </b>"+cars.Rows[i].v+" mph / "+kph+" kph<br />";string+="&nbsp;&nbsp;&nbsp;&nbsp;<b>Last Moved: </b>";if(cars.Rows[i].LastMoved!=null&&cars.Rows[i].LastMoved!=""){var lmovtime=cars.Rows[i].LastMoved;var rmovtime="";rmovtime=StandardizeTimeFormat(lmovtime);string+=rmovtime;}string+="<br />&nbsp;&nbsp;&nbsp;&nbsp;<b>Last Update: </b>"+revisedTime+"<br />";var idCheck=cars.Rows[i].s*1;idCheck=idCheck+"";if((idCheck.substring(0,1)=="7"&&idCheck.length>4)||(idCheck.substring(0,1)=="8"&&idCheck.length>4)||(idCheck.substring(0,2)=="14"&&idCheck.length==7)){string=string+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Power: </b>"+cars.Rows[i].Power+"%<br />"+""}else{if(cars.Rows[i].ignition==1){string=string+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Ignition: </b>On<br />"+""};if(cars.Rows[i].ignition== -1){string=string+"&nbsp;&nbsp;&nbsp;&nbsp;<b>Ignition: </b>Off<br />"+""};}if(cars.Rows[i].sats){string=string+"&nbsp;&nbsp;&nbsp;&nbsp;<b>GPS Satellites: </b>"+cars.Rows[i].sats+"<br />"+"";}else{string=string+"&nbsp;&nbsp;&nbsp;&nbsp;<b>GPS Satellites: </b>Not Available<br />"+"";}string=string+"<br/><Center>Click Vehicle for further options</center><br/>";var divInfoVar="<div style='background:URL(images/CurrentDeviceData.png) no-repeat top right Transparent; color:white; font-family:arial; font-size:12px; width:297px; height:253px;'>"+string+"</div>";var originalPoint=map.LatLongToPixel(new VELatLong(cars.Rows[i].lt*1,cars.Rows[i].ln*1));var newx=originalPoint.x;var newy=originalPoint.y;pixel=new VEPixel(newx,newy);newLatLon=map.PixelToLatLong(pixel);if(i+1>carPins.length){carPins[i]=new VEShape(VEShapeType.Pushpin,newLatLon);map.AddShape(carPins[i]);carPins[i].SetTitle(cars.Rows[i].s.toString());nameTags[i]=new VEShape(VEShapeType.Pushpin,newLatLon);map.AddShape(nameTags[i]);infoBoxes[i]=new VEShape(VEShapeType.Pushpin,newLatLon);map.AddShape(infoBoxes[i]);infoBoxes[i].Hide();}carPins[i].SetPoints(newLatLon);carPins[i].SetCustomIcon(imageloc);carPins[i].ShowIcon();carPins[i].SetPoints(newLatLon);carPins[i].Show();var sw=cars.Rows[i].switches;if(sw==2||sw==3||sw==6||sw==7||sw==10||sw==11||sw==14||sw==15){carInPanic=true;}if(lastCars.Rows.length>0){if(cars.Rows[i].lt!=lastCars.Rows[i].lt||cars.Rows[i].ln!=lastCars.Rows[i].ln){for(k=0;k<29;k++){if(ActivityContent[k+1]!=null){ActivityContent[k]=ActivityContent[k+1];}}var dActivity=document.getElementById("Activity");if(dActivity.up){if(rowtoggle==true){rowtoggle=false;accenture=" alt";}else{rowtoggle=true;accenture=" bg";}var ignition="?";if(cars.Rows[i].ignition==1){ignition="On"};if(cars.Rows[i].ignition== -1){ignition="Off"};var sats="?";if(cars.Rows[i].sats!=0){sats=cars.Rows[i].sats};var panic="Off";if(cars.Rows[i].panic==1){ignition="On"};var switches=cars.Rows[i].switches;var aux1="Off";if(switches==4||switches==5||switches==6||switches==7||switches==12||switches==13||switches==14||switches==15){aux1="On";}var aux2="Off";if(switches>7){aux2="On";}ActivityContent[29]="<tr class='data"+accenture+"'><td class='l'>"+dtimeNoYear+"&nbsp;</td><td class='c'>"+cars.Rows[i].n+"&nbsp;&nbsp;</td><td>"+cars.Rows[i].lt+"&nbsp;&nbsp;</td><td>"+cars.Rows[i].ln+"&nbsp;</td><td>"+cars.Rows[i].v+"mph/"+kph+"kph&nbsp;&nbsp;</td><td>"+cars.Rows[i].o+"&nbsp;&nbsp;</td><td>"+sats+"&nbsp;&nbsp;</td><td>"+ignition+"</td><td>"+panic+"</td><td>"+aux1+"</td><td class='r'>"+aux2+"</td></tr>";ActivityCount=ActivityCount+1;}}}var tagwidth=cars.Rows[i].n.length*10;if(TheBrowser=="safari"){tagwidth=tagwidth*1.2};var divVar="<div style='font-family:arial;font-size:14px;color: #"+cars.Rows[i].tc+";font-weight:bold;border:solid 1px Black;background-color: #"+cars.Rows[i].cl+";width:"+tagwidth+"px;'>&nbsp;"+cars.Rows[i].n+"</div>";nameTags[i].SetCustomIcon(divVar);nameTags[i].ShowIcon();nameTags[i].Show();infoBoxes[i].SetCustomIcon(divInfoVar);infoBoxes[i].Hide();PinIds[i]=carPins[i].GetId();}var divCNAVdispatchdroplist=document.getElementById("CNAVDispatchDroplist");divCNAVdispatchdroplist.innerHTML+=cnavdisplist;var divCNAVUnitlist=document.getElementById("CNAVUnitList");divCNAVUnitlist.innerHTML+=cnavunitlistText;if(carInPanic==true){gN();}lastCars=cars;var dActivity=document.getElementById("Activity");if(dActivity.up){for(k=0;k<29;k++){if(ActivityContent[k]==null){ActivityContent[k]="<tr class='data bg'><td class='l'>&nbsp;&nbsp;</td><td class='c'>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td class='r'>&nbsp;</td></tr>";};if(ActivityContent[k]!=null){ActivityOut=ActivityOut+ActivityContent[k];}}ActivityOut=ActivityOut+"</table>";var m_divROverlay=document.getElementById("ActScroller");m_divROverlay.innerHTML=ActivityOut;if(TheBrowser=="safari"){G("ActScroller",0,-100,640,600,1500,null);}else{G("ActScroller",0,-237,640,600,1500,null);}}else{if(TheBrowser=="safari"){G("ActScroller",0,-100,640,600,0,null);}else{G("ActScroller",0,-237,640,600,0,null);}}if(m_bCenterMap||vehicleToFollow!=null){if(vehicleToFollow!=null){var latCenter=cars.Rows[carWeAreFollowing].lt*1;var lonCenter=cars.Rows[carWeAreFollowing].ln*1;}else{var latCenter=(maxLat+minLat)/2;var lonCenter=(maxLon+minLon)/2;}var center=new VELatLong(latCenter,lonCenter);map.SetCenter(center);}if(m_bOptimizeZoom){map.SetMapView(points);var gzv=map.GetZoomLevel();if(gzv>17){gzv=gzv-2;}gm(gzv,"set");}for(var i=0;i<carPins.length;i++){var originalPoint=map.LatLongToPixel(new VELatLong(carPins[i].Latitude,carPins[i].Longitude));var newx=originalPoint.x+cars.Rows[i].width-cars.Rows[i].tagOffset;var newy=originalPoint.y-15;pixel=new VEPixel(newx,newy);var newNameLatLon=map.PixelToLatLong(pixel);nameTags[i].SetPoints(newNameLatLon);newx=originalPoint.x+cars.Rows[i].width-cars.Rows[i].infoOffset;newy=originalPoint.y+5;pixel=new VEPixel(newx,newy);var newInfoLatLon=map.PixelToLatLong(pixel);infoBoxes[i].SetPoints(newInfoLatLon);}if(m_showTraffic){map.LoadTraffic(true);}else{map.ClearTraffic();}for(var i=0;i<addrInfoBox.length;i++){if(MapAddresspins[i]!=null){var originalPoint=map.LatLongToPixel(new VELatLong(MapAddresspins[i].Latitude,MapAddresspins[i].Longitude));var newx=originalPoint.x+50;var newy=originalPoint.y-5;pixel=new VEPixel(newx,newy);var newInfoLatLon=map.PixelToLatLong(pixel);addrInfoBox[i].SetPoints(newInfoLatLon);}}if(m_CurrentUser=="proparkyale"){Feed.SAddr(m_CurrentUser,gF);}if(novdatapresent==true){cF();};var date=new Date();var d=date.getDate();var m=date.getMonth()+1;if(santaTimer==null&&m==12&&(d==24||d==25)){santaTimer=setTimeout("showSanta()",4000);}if(EightThousandPresent&&MessageFromDriverTimer==null){Feed.SDrvMsgMx(dg);}}else{noVehicleDataPresent();novdatapresent=true;m_bOptimizeZoomSet=false;}oSessionKey=document.getElementById("SESSIONKEY");if(oSessionKey!=null){var sessionID=oSessionKey.getAttribute("value");m_loadTimeout=setTimeout("dv('"+sessionID+"');",4000);}if(m_firstRetrieve){m_firstRetrieve=false;m_bCenterMap=false;m_bOptimizeZoom=false;}if(!MapFencesVisible){updateMapFences();}};function aE(){if(maxCarsInPanic>0){for(var i=0;i<maxCarsInPanic;i++){var panicNumber="panicDiv"+i;var panicDiv=document.getElementById(panicNumber);panicDiv.parentNode.removeChild(panicDiv);}}carInPanic=false;maxCarsInPanic=0;};function gN(){aE();for(var i=0;i<cars.Rows.length;i++){var sw=cars.Rows[i].switches;if(sw==2||sw==3||sw==6||sw==7||sw==10||sw==11||sw==14||sw==15){carInPanic=true;var originalPoint=map.LatLongToPixel(new VELatLong(cars.Rows[i].lt,cars.Rows[i].ln));newx=originalPoint.x-37;newy=originalPoint.y-37;var panicNumber="panicDiv"+maxCarsInPanic;var panicDiv=document.createElement('DIV');panicDiv.setAttribute('id',panicNumber);panicDiv.style.width=120;panicDiv.style.height=120;panicDiv.style.position="absolute";panicDiv.style.left=newx+"px";panicDiv.style.top=newy+"px";panicDiv.innerHTML="<img id='Img"+1000+maxCarsInPanic+"' alt='' src='images/AlertGIF.gif' onclick='aB("+i+");' onmouseover='eY("+i+");'/>";panicDiv.style.opacity="0.65";panicDiv.style.filter="alpha(opacity=65)";panicDiv.style.display="block";document.body.appendChild(panicDiv);maxCarsInPanic++;}}};function eY(i){for(var n=0;n<PinIds.length;n++){if(n==i){infoBoxes[n].Show();}else{infoBoxes[n].Hide();}}};function aB(i){clickedOnSerial=cars.Rows[i].s;infoBoxes[i].hide;lastClickedBox=i;dV(i);};function noVehicleDataPresent(){m_divROverlay=document.getElementById("noVehicleDataPresent");m_divROverlay.style.marginTop=parseInt(0);m_divROverlay.style.position="absolute";m_divROverlay.style.top="200px";m_divROverlay.style.left="300px";bj("noVehicleDataPresent");novdatapresent=true;};function cF(){aF("noVehicleDataPresent");novdatapresent=false;};function G(elementID,newLeft,newTop,newWidth,newHeight,time,callback){var el=document.getElementById(elementID);if(el==null)return;var cLeft=parseInt(el.style.left);var cTop=parseInt(el.style.top);var cWidth=parseInt(el.style.width);var cHeight=parseInt(el.style.height);var totalFrames=1;if(time>0)totalFrames=time/40;var fLeft=newLeft-cLeft;if(fLeft!=0)fLeft/=totalFrames;var fTop=newTop-cTop;if(fTop!=0)fTop/=totalFrames;var fWidth=newWidth-cWidth;if(fWidth!=0)fWidth/=totalFrames;var fHeight=newHeight-cHeight;if(fHeight!=0)fHeight/=totalFrames;Q(elementID,cLeft,newLeft,fLeft,cTop,newTop,fTop,cWidth,newWidth,fWidth,cHeight,newHeight,fHeight,callback);};function Q(eID,cLeft,nLeft,fLeft,cTop,nTop,fTop,cWidth,nWidth,fWidth,cHeight,nHeight,fHeight,callback){var el=document.getElementById(eID);if(el==null)return;cLeft=dE(cLeft,nLeft,fLeft);cTop=dE(cTop,nTop,fTop);cWidth=dE(cWidth,nWidth,fWidth);cHeight=dE(cHeight,nHeight,fHeight);el.style.left=Math.round(cLeft)+'px';el.style.top=Math.round(cTop)+'px';el.style.width=Math.round(cWidth)+'px';el.style.height=Math.round(cHeight)+'px';if(cLeft==nLeft&&cTop==nTop&&cHeight==nHeight&&cWidth==nWidth){if(callback!=null)callback();return;}setTimeout('Q("'+eID+'",'+cLeft+','+nLeft+','+fLeft+','+cTop+','+nTop+','+fTop+','+cWidth+','+nWidth+','+fWidth+','+cHeight+','+nHeight+','+fHeight+','+callback+')',40);};function dE(currentVal,finalVal,frameAmt){if(frameAmt==0||currentVal==finalVal)return finalVal;currentVal+=frameAmt;if((frameAmt>0&&currentVal>=finalVal)||(frameAmt<0&&currentVal<=finalVal)){return finalVal;}return currentVal;};function gD(elementId,headerElement){var element=document.getElementById(elementId);var outerElement=document.getElementById("MasterMask");if(element.up==null||element.down){new Effect.Parallel([new Effect.Move("MasterMask",{x:0,y: -286,mode:'relative'}),new Effect.Scale("MasterMask",100,{scaleMode:{originalHeight:312,originalWidth:635},scaleContent:false,scaleX:false,scaleFrom:7})],{duration:0.37});element.up=true;element.down=false;ActivityTray=true;document.getElementById("Activity").innerHTML=ActWindowHeader;}else{new Effect.Parallel([new Effect.Move("MasterMask",{x:0,y:286,mode:'relative'}),new Effect.Scale("MasterMask",7,{scaleMode:{originalHeight:312,originalWidth:635},scaleContent:false,scaleX:false,scaleFrom:100})],{duration:0.37});element.down=true;element.up=false;ActivityTray=false;for(k=0;k<29;k++){ActivityContent[k]='';}var tmpObj=document.getElementById("Activity");tmpObj.innerHTML=ActWindowHeader;}};function eq(){gD("Activity","MoveActivityPanel");};function dR(){if(m_bResizing)return;bm();var pageContent=document.getElementById("pageContent");pageContent.style.height=parseInt(windowHeight)+"px";pageContent.style.width=parseInt(windowWidth)+"px";map.Resize(windowWidth,windowHeight);var object=document.getElementById("MasterMask");if(ActivityTray==false){object.style.top=parseInt(windowHeight-22)+"px";}if(ActivityTray==true){object.style.top=parseInt(windowHeight-22)+"px";}if(m_divMap!=null&&m_gMap!=null){m_bResizing=true;var tmpWidth=window.screen.width;var tmpHeight=window.screen.height-70;if(m_lDivWidth!=tmpWidth||Math.abs(m_lDivHeight-tmpHeight)>15){var gllCenter=m_gMap.getCenter();if(TheBrowser=="internet explorer"){m_lDivWidth=tmpWidth-20;m_lDivHeight=tmpHeight-160;}else{m_lDivWidth=tmpWidth-50;m_lDivHeight=tmpHeight-140;}m_divMap.style.width=m_lDivWidth+"px";m_divMap.style.height=m_lDivHeight+"px";m_gMap.setCenter(gllCenter);}}};function gm(value,vType){zoomvalue=map.GetZoomLevel();if(zoomvalue==value){return;}switch(vType){case 'in':if(zoomvalue<19){zoomvalue=zoomvalue+1;A_SLIDERS[0].f_setValue(20-zoomvalue);}break;case 'out':if(zoomvalue>2){zoomvalue=zoomvalue-1;A_SLIDERS[0].f_setValue(20-zoomvalue);}break;case 'change':zoomvalue=20-value;break;case 'set':zoomvalue=value;A_SLIDERS[0].f_setValue(20-zoomvalue);break;default:m_setValue=false;return false;break;}if(zoomvalue<14)m_maxHistoricalCenterCount=7;else if(zoomvalue>=14&&zoomvalue<16)m_maxHistoricalCenterCount=4;else if(zoomvalue>=16&&zoomvalue<18)m_maxHistoricalCenterCount=2;else if(zoomvalue>=18&&zoomvalue<20)m_maxHistoricalCenterCount=0;else m_maxHistoricalCenterCount=0;map.SetZoomLevel(zoomvalue);return false;};function dG(){m_demoUser=false;removeAddressMarkers();oSessionKey=document.getElementById("SESSIONKEY");if(oSessionKey!=null){ActionCompleted("Ending session");var existing_session=oSessionKey.getAttribute("value");oLoginCell=document.getElementById("loginCell");oLoginCell.innerHTML="Login";oLoginCell.setAttribute("onclick",logInUser);Feed.LOUsr(existing_session,ew);history.go(-1)}m_bOptimizeZoomSet=false;return true;};function ew(rvalue){oTextUserId=document.getElementById("txtUserID");oTextUserId.value='';oTextPassword=document.getElementById("txtPassword");oTextPassword.value='';oSessionContainer=document.getElementById("sessionContainer");oSessionKey=document.getElementById("SESSIONKEY");oSessionContainer.removeChild(oSessionKey);cleanMap();dS("USFTLoginID","");dS("USFTPassword","");oTextUserId.focus;oTextUserId=null;oTextPassword=null;m_groupView=false;m_bOptimizeZoomSet=false;m_loadTimeout=null;m_loadInterval=null;location.reload();};function logInUser(){if(dummyUser!=null&&dummyUser!=""){if(dummyPwd!=null&&dummyPwd!=""){clearTimeout(loginUserTimer);if(document.getElementById("txtUserID")==null){loginUserTimer=setTimeout("logInUser('"+document.getElementById("loginCell")+"')",1000);return null;}document.getElementById("txtPassword").value=dummyPwd;}document.getElementById("txtUserID").value=dummyUser;}var txtUserID=document.getElementById("txtUserID");var txtPassword=document.getElementById("txtPassword");m_CurrentUser=txtUserID.value;m_bViewHistory=false;var sessionKey=document.getElementById("SESSIONKEY");Feed.LIUsr(null,txtUserID.value,txtPassword.value,dY);m_TriggerMapControl=true;};function dK(field){oTxtUserId=document.getElementById("txtUserID");oTxtUserId.value="jdemo";oTxtPassword=document.getElementById("txtPassword");oTxtPassword.value="jdemo";m_demoUser=true;m_CurrentUser="jdemo";logInUser();m_TriggerMapControl=true;fg();};function fF(field){oTxtUserId=document.getElementById("txtUserID");oTxtUserId.value="ChatDemo";oTxtPassword=document.getElementById("txtPassword");oTxtPassword.value="ChatDemo";m_demoUser=true;m_CurrentUser="ChatDemo";ChatDemo=true;logInUser();m_TriggerMapControl=true;};function dY(response){if(response!=null){var sessionField=0;var limitationsField=1;var addressMarkersField=2;var messageField=3;var allowLogonField=4;var startupViewField=5;var DemoUserField=6;var Dealer_Id=7;var rvalue=response.value;var word=rvalue.split("|");if(m_CurrentUser.toLowerCase()=="livedemo"){m_demoUser=true;}if(word[messageField]!=null&&word[messageField]!=""){if(word[allowLogonField]!='1'){if(word[messageField]=='ATTI6'&&word[Dealer_Id]=="6"){bj("divSpcNotice");}else{AlertMessage(word[messageField]+"\nAccess to your account is currently restricted.");}dG();return;}else{if(word[messageField]=='ATTI6'&&word[Dealer_Id]=="6"){bj("divSpcNotice");}else{AlertMessage(word[messageField]);}}}if(word[limitationsField]=="99"){ControlPanelLockout=true;}else{ControlPanelLockout=false;}if(word[DemoUserField]=="1"){demo2_user=true;}else{demo2_user=false;}if(word[startupViewField]!=null&word[startupViewField]!=""){m_StartupView=word[startupViewField];}else{m_StartupView="";}cbAddressVisible=document.getElementById("cbAddressVisible");if(word[addressMarkersField]=="01"){AddressMarkersVisible=true;cbAddressVisible.setAttribute("checked","true");}else{cbAddressVisible.setAttribute("checked","false");}response.value=word[sessionField];if(response.value!="false"&&response.value!="False"&&response.value!=""){cleanMap();m_bLoggedIn=true;m_bRepeat=true;ActivityContent=new Array;eD();var object=document.getElementById("loginCell");object.innerHTML="<img alt='' src='images/blogoutlight.gif' id='loginImage' onmouseover=\"this.src='images/blogoutdark.gif'\" onmouseout=\"this.src='images/blogoutlight.gif'\" onclick='dG();' />";if(document.getElementById("SESSIONKEY")==null){var currentElement=document.createElement("input");currentElement.setAttribute("type","hidden");currentElement.setAttribute("name","SESSIONKEY");currentElement.setAttribute("id","SESSIONKEY");currentElement.value=response.value;document.getElementById("sessionContainer").appendChild(currentElement);}if(ControlPanelLockout==true){ControlPanelLockout=false;fb();document.getElementById("MiniPlate").style.visibility="hidden";ControlPanelLockout=true;}dQ();if(m_StartupView!=null&&m_StartupView!=""){if(m_StartupView=="Map"){map.SetMapStyle(VEMapStyle.Road);}else if(m_StartupView=="Hybrid"){map.SetMapStyle(VEMapStyle.Hybrid);}else if(m_StartupView=="Satallite"){map.SetMapStyle(VEMapStyle.Aerial);}}m_firstRetrieve=true;if(m_TriggerMapControl==true){m_TriggerMapControl=false;var myControl=document.getElementById("MapControl");if(myControl!=null){myControl.onclick();spanClicked(2)}}hf();dv(response.value);bx();if(AddressMarkersVisible==true){Feed.SAdrMrk(ci)}else{gO()}Feed.SOnlMsgMx(m_CurrentUser,cf);if(ChatDemo){eE();}}else{cleanMap();AlertMessage("Invalid Login Credentials.<br/><br/>Please re-enter your login name and password.");m_bRepeat=false;m_bLoggedIn=false;}}else if(response.value==null){cleanMap();AlertMessage("Invalid Login Credentials.<br/><br/>Please re-enter your login name and password.");m_bRepeat=false;m_bLoggedIn=false;}else{cleanMap();AlertMessage("Invalid Login Credentials.<br/><br/>Please re-enter your login name and password.");m_bRepeat=false;m_bLoggedIn=false;}};function bi(){result=cbAddressVisible.getAttribute("checked");if(result==true){gn();}else{removeAddressMarkers();}};function aW(){if(historicalIndex> -1&&historicalIndex<m_historicalData.Rows.length){var tempTime=m_historicalData.Rows[historicalIndex].timestamp;bp(m_historicalData.Rows[historicalIndex].timestamp);var direction=(Math.floor(((m_historicalData.Rows[historicalIndex].ori*1)+5)/10)*10);if(direction>=360){direction=0;}if(m_historicalData.Rows[historicalIndex].vel==0&&direction==0&&historyLastDirection!=0){direction=historyLastDirection;}historyLastDirection=direction;var mapstyle=map.GetMapStyle();if(mapstyle==VEMapStyle.Birdseye){var be=map.GetBirdseyeScene();var maporentation=be.GetOrientation();if(maporentation=="East"){direction=direction+270;}if(maporentation=="South"){direction=direction+180;}if(maporentation=="West"){direction=direction+90;}if(direction>360){direction=direction-360;}}var tmpXCenter=0;var tmpYCenter=0;if(historyXCenter!=null){tmpXCenter=13-historyXCenter;}if(historyYCenter!=null){tmpYCenter=13-historyYCenter;}var imageloc="<img style='margin: "+tmpYCenter+"px 0px 0px "+tmpXCenter+"px' src='images/"+historyIconFolder+"/"+"v"+direction+".gif'/>";var kph=Math.round(m_historicalData.Rows[historicalIndex].vel*1.60934);var string=""+"&nbsp;Latitude: <b>"+m_historicalData.Rows[historicalIndex].lat+"</b><br />"+"&nbsp;Longitude: <b>"+m_historicalData.Rows[historicalIndex].lon+"</b><br />"+"&nbsp;Heading: <b>"+m_historicalData.Rows[historicalIndex].ori+"&#176 / "+ac(m_historicalData.Rows[historicalIndex].ori,m_historicalData.Rows[historicalIndex].vel)+"</b><br />"+"&nbsp;Velocity: <b>"+m_historicalData.Rows[historicalIndex].vel+" mph / "+kph+" kph</b><br />"+"&nbsp;Last Moved: <b>"+tempTime+"</b><br />"+"&nbsp;Last Update: <b>"+tempTime+"</b><br />";if(m_historicalData.Rows[historicalIndex].sats){string=string+"&nbsp;GPS Satellites: <b>"+m_historicalData.Rows[historicalIndex].sats+"</b><br />"+"";}else{string=string+"&nbsp;GPS Satellites: <b>Not Available</b><br />"+"";}var ckwidth="&nbspLast Moved: "+tempTime;var wdth=ckwidth.length;ckwidth="&nbspLast Update: "+tempTime;if(ckwidth.length>wdth){wdth=ckwidth.length}var divInfoVar="<div style='filter: alpha(opacity=80); -moz-opacity: 0.70; opacity: 0.70; color:black; font-family:arial; font-size:12px;border:solid 1px Red;background-color:White;width:"+wdth*6+"px;'>"+string+"</div>";var lat=m_historicalData.Rows[historicalIndex].lat;var lon=m_historicalData.Rows[historicalIndex].lon;var newLatLon=new VELatLong(lat*1,lon*1);if(m_ddlVehicles.value.substring(0,1)!="7"){if(m_historicalData.Rows[historicalIndex].vel*1==0){var stopsign=new VEShape(VEShapeType.Pushpin,newLatLon);stopsign.SetCustomIcon("<img src='images/stop.png'/>");map.AddShape(stopsign);stopsign.ShowIcon();}}var originalPoint=map.LatLongToPixel(new VELatLong(m_historicalData.Rows[historicalIndex].lat*1,m_historicalData.Rows[historicalIndex].lon*1));var newx=originalPoint.x;var newy=originalPoint.y;pixel=new VEPixel(newx,newy);var newLatLon=map.PixelToLatLong(pixel);var newx=originalPoint.x+historyWidth-historyTagOffset;var newy=originalPoint.y-10;pixel=new VEPixel(newx,newy);var newNameLatLon=map.PixelToLatLong(pixel);newx=originalPoint.x+historyWidth;newy=originalPoint.y+10;pixel=new VEPixel(newx,newy);var newInfoLatLon=map.PixelToLatLong(pixel);if(historyCarPin!=null){historyCarPin.SetCustomIcon(imageloc);historyCarPin.SetPoints(newLatLon);historyCarPin.Show();historyNameTag.SetPoints(newNameLatLon);historyNameTag.Show();historyInfoBox.SetCustomIcon(divInfoVar);historyInfoBox.SetPoints(newInfoLatLon);}else{var pin=new VEShape(VEShapeType.Pushpin,newLatLon);pin.SetCustomIcon(imageloc);historyCarPin=pin;map.AddShape(historyCarPin);historyCarPin.ShowIcon();var tagwidth=m_historicalData.Rows[historicalIndex].n.length*10;if(TheBrowser=="safari"){tagwidth=tagwidth*1.2};var shape=new VEShape(VEShapeType.Pushpin,newNameLatLon);var divVar="<div style='filter:alpha(opacity=80);font-family:arial;font-size:14px;font-weight:bold;border:solid 1px Black;background-color:White;width:"+tagwidth+"px;'>"+m_historicalData.Rows[historicalIndex].n+"</div>";shape.SetCustomIcon(divVar);historyNameTag=shape;map.AddShape(historyNameTag);historyNameTag.ShowIcon();var shape=new VEShape(VEShapeType.Pushpin,newLatLon);shape.SetCustomIcon(divInfoVar);historyInfoBox=shape;map.AddShape(historyInfoBox);historyInfoBox.Hide();}if(historicalPlaybackDirection==1){var points=new Array(new VELatLong(m_historicalData.Rows[historicalIndex-1].lat,m_historicalData.Rows[historicalIndex-1].lon),new VELatLong(m_historicalData.Rows[historicalIndex].lat,m_historicalData.Rows[historicalIndex].lon));var vaptrail=new VEShape(VEShapeType.Polyline,points);vaptrail.SetLineColor(new VEColor(255,0,100,0.6));vaptrail.SetLineWidth(4);vaptrail.HideIcon();layer01.AddShape(vaptrail);}var center=new VELatLong(lat*1,lon*1);map.SetCenter(center);}};function fL(){if(m_ddlVehicles.options.length==2){m_ddlVehicles.value=m_ddlVehicles.options[1].value;}if(m_ddlVehicles.value==""||m_ddlVehicles.value==null||m_ddlVehicles.value== -1){AlertMessage("No Device or Vehicle has been selected for playback.<br/>Please select a device from the DEVICES tab<br/>in order to replay that device's history.");return;}ag();layer01=new VEShapeLayer();map.AddShapeLayer(layer01);Feed.SVehIcn(m_ddlVehicles.value,fA);};function fA(response){var tmpVehData=new Array();tmpVehData=response.value;if(tmpVehData!=null&&tmpVehData!=""){historyIconFolder=tmpVehData.Rows[0].Image;historyXCenter=tmpVehData.Rows[0].XCenter;historyYCenter=tmpVehData.Rows[0].YCenter;historyWidth=tmpVehData.Rows[0].width;historyHeight=tmpVehData.Rows[0].height;if(tmpVehData.Rows[0].tagOffset!=null||tmpVehData.Rows[0].tagOffset!=""){historyTagOffset=tmpVehData.Rows[0].tagOffset;}else{historyTagOffset=0;}}else{historyIconFolder="Default";historyXCenter=20;historyYCenter=20;historyTagOffset=9;historyWidth=40;historyHeight=40;}Feed.SHstPlay(m_ddlVehicles.value,m_strDateTime.getFullYear()+"/"+(m_strDateTime.getMonth()+1)+"/"+m_strDateTime.getDate(),"00:00:00",m_strDateTime.getFullYear()+"/"+(m_strDateTime.getMonth()+1)+"/"+m_strDateTime.getDate(),"23:59:59",fB);dL("<br/>Loading data for historical playback...<br/>Please Stand By...<br/>");};function fB(response){bB();if(response!=null){if(response.value!=null){m_historicalData=response.value;if(m_historicalData.Rows.length==0){AlertMessage("No history present for this date.");return;}historyCarPin=null;historyNameTag=null;historyInfoBox=null;gm(14,"set");historicalIndex=0;A_SLIDERS[1].n_maxValue=m_historicalData.Rows.length;A_SLIDERS[1].n_minValue=0;gG(1,'set');setTimeout("historicalPlaybackTick()",1000);}else{AlertMessage("No data found.<br/>Please rerun your query,<br/>or email support@usfleettracking.com");}}else{AlertMessage("Data returned is null.<br/>Please rerun your query,<br/>or email support@usfleettracking.com");}};function play(restart){if(restart==true){historicalDateChange=true;}if(m_historicalData==null||historicalDateChanged==true){m_bViewHistory=true;historicalPlaybackDirection=1;historicalTimeout=1000;fL();historicalDateChanged=false;}else{historicalPlaybackDirection=1;historicalTimeout=1000;}bp("Playing History");};function cU(){if(historicalPlaybackDirection!=1){historicalTimeout=500;historicalPlaybackDirection=1;}else{historicalTimeout-=100;if(historicalTimeout<=0)historicalTimeout=100;}ffspeed=">";if(historicalTimeout==500)ffspeed=">";if(historicalTimeout==400)ffspeed=">>";if(historicalTimeout==300)ffspeed=">>>";if(historicalTimeout==200)ffspeed=">>>>";if(historicalTimeout==100)ffspeed=">>>>>";bp("Fast Forward "+ffspeed);};function rewind(){if(historicalPlaybackDirection!= -1){if(historicalIndex>m_historicalData.Rows.length-2){historicalIndex=m_historicalData.Rows.length-2;}historicalPlaybackDirection= -1;}else{historicalTimeout-=100;if(historicalTimeout<=0)historicalTimeout=100;}rwspeed="<";if(historicalTimeout==500)rwspeed="<";if(historicalTimeout==400)rwspeed="<<";if(historicalTimeout==300)rwspeed="<<<";if(historicalTimeout==200)rwspeed="<<<<";if(historicalTimeout==100)rwspeed="<<<<<";bp(rwspeed+" Rewind");};function stop(){gC();pause();bp("Stopped");};function pause(){historicalPlaybackDirection=0;bp("Paused");};function gC(){current_hindex=0;historicalIndex=0;pause();bp("Skipping to start");};function gT(){if(m_historicalData!=null){historicalIndex=m_historicalData.Rows.length-2;current_hindex=m_historicalData.Rows.length-1;}pause();bp("Skipping to end");};function historicalPlaybackTick(){if(m_historicalData!=null&&historicalPlaybackDirection!=0){if(!m_bCenterMap){historicalCenterCount= -99;m_bCenterMap=true;}if(!m_bOptimizeZoom){historicalZoomCount= -99;m_bOptimizeZoom=true;}if(historicalIndex> -1&&historicalIndex<m_historicalData.Rows.length-1){setTimeout("historicalPlaybackTick()",historicalTimeout);historicalIndex=historicalIndex+historicalPlaybackDirection;gG(historicalIndex,"set");aW();}else{setTimeout("historicalPlaybackTick()",0);}}else{setTimeout("historicalPlaybackTick()",0);}};function bp(message){hMessage=document.getElementById("HISTORICALINFO");hMessage.innerHTML="<center style=\"color:White; font-size:8pt; font-family:Arial;\">"+message+"</center>";};function gG(value,vType){if(!m_setHistoryValue){switch(vType){case 'change':historicalIndex=value;current_hindex=value;historicalCenterCount= -99;break;case 'set':m_setHistoryValue=true;A_SLIDERS[1].f_setValue(value);break;default:return true;break;}}m_setHistoryValue=false;return true;};function eC(){cached_loader=new Image();cached_loader.src="images/rotator.gif";};function fP(str,ch,num){var resultStr='';resultStr=ef(str,ch,num);resultStr=ei(resultStr,ch,num);return resultStr;};function ef(str,ch,num){if(str+''=='undefined'||str==null)return null;if(ch+''=='undefined'||ch==null)return null;if(typeof(num)!=typeof(0))return null;str+='';ch+='';var resultStr=str;str+='';if(str.length<num){for(var i=0;i<num-str.length;i++)resultStr=ch+resultStr;}return resultStr;};function ei(str,ch,num){if(str+''=='undefined'||str==null)return null;if(ch+''=='undefined'||ch==null)return null;if(typeof(num)!=typeof(0))return null;str+='';ch+='';var resultStr=str;if(str.length<num){for(var i=0;i<num;i++)resultStr+=ch;}return resultStr;};function hT(){var point=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(m_gMap.fromDivPixelToLatLng(new GPoint(0,0),true),m_gMap.getZoom());var offset=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(this.getPoint(),m_gMap.getZoom());var anchor=this.getIcon().iconAnchor;var width=this.getIcon().iconSize.width;var height=100;var pos=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(offset.x-point.x-anchor.x+width+TOOLTIP_OFFSET_X,offset.y-point.y-anchor.y+TOOLTIP_OFFSET_Y));pos.apply(this.tooltip);this.tooltip.style.display="block";};function co(){this.tooltip.style.display="none";};function hC(){var point=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(m_gMap.fromDivPixelToLatLng(new GPoint(0,0),true),m_gMap.getZoom());var offset=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(this.getPoint(),m_gMap.getZoom());var anchor=this.getIcon().iconAnchor;var width=this.getIcon().iconSize.width;var height=100;var pos=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(offset.x-point.x-anchor.x+width+INFOPANE_OFFSET_X,offset.y-point.y-anchor.y+INFOPANE_OFFSET_Y));pos.apply(this.infoPane);this.infoPane.style.display="block";};function cB(){this.infoPane.style.display="none";};function cleanMap(ClearDropDown){if(ClearDropDown==null){ClearDropDown=true;}for(var i=0;i<m_gMarkers.length;i++){m_gMap.getPane(G_MAP_MARKER_PANE).removeChild(m_gMarkers[i].mkr.tooltip);m_gMap.getPane(G_MAP_FLOAT_PANE).removeChild(m_gMarkers[i].mkr.infoPane);}if(ClearDropDown){m_ddlVehicles.options.length=0;m_ddlVehicleGroupEditor.options.length=0;m_ddlVehicleDriversEditor.options.length=0;m_AlertVehicleList.options.length=0;m_ZoneVehicleList.options.length=0;m_OLRVehiclesList.options.length=0;m_VTVehiclesList.options.length=0;m_IGNVehicleList.options.lenght=0;}MapAddresspins=new Array();if(m_bViewHistory){play(true);}};function ag(){map.DeleteAllShapes();carPins=new Array();nameTags=new Array();infoBoxes=new Array();MapAddresspins=new Array();if(map.GetShapeLayerCount()>1){map.DeleteAllShapeLayers();}};var MINUTE=60*1000;var HOUR=60*MINUTE;var DAY=24*HOUR;var WEEK=7*DAY;function gW(x,y,callTo){var parent=document.getElementById("divVTCal");parent.style.visibility="visible";parent.style.display="block";parent.style.top=y;parent.style.left=x;var cal=new Calendar(0,null,callTo);cal.weekNumbers=false;cal.setDateFormat("%m/%d/%Y");var len=parent.childNodes.length;if(len>0){for(var i=0;i<len;i++){parent.removeChild(parent.childNodes[i]);}}cal.create(parent);cal.show();divVTCal.style.zIndex=999;CalendarActive=1;};function ec(x,y,callTo){var parent=document.getElementById("divCal");parent.style.visibility="visible";parent.style.display="block";parent.style.top=y+"px";parent.style.left=x+"px";var cal=new Calendar(0,null,callTo);cal.weekNumbers=false;cal.setDateFormat("%m/%d/%Y");var len=parent.childNodes.length;if(len>0){for(var i=0;i<len;i++){parent.removeChild(parent.childNodes[i]);}}cal.create(parent);cal.show();divCal.style.zIndex=999;CalendarActive=1;};function hz(){var parent=document.getElementById("divCalContainer");var cal=new Calendar(0,null,cw);cal.weekNumbers=false;cal.setDateFormat("%m/%d/%Y");cal.create(parent);cal.show();};function toTxtDate(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtDate").value=date;cal.hide();}};function bu(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtStartDate").value=date;cal.hide();var parent=document.getElementById("divCal");parent.style.visibility="hidden";parent.style.display="none";}};function bv(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtEndDate").value=date;cal.hide();var parent=document.getElementById("divCal");parent.style.visibility="hidden";parent.style.display="none";}};function VTSSelected(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtVTStartDate").value=date;cal.hide();var parent=document.getElementById("divVTCal");parent.style.visibility="hidden";parent.style.display="none";}};function VTESelected(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtVTEndDate").value=date;cal.hide();var parent=document.getElementById("divVTCal");parent.style.visibility="hidden";parent.style.display="none";}};function fM(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtOPSStartDate").value=date;cal.hide();}};function fJ(cal,date){if(cal.dateClicked){m_strDate=date;document.getElementById("txtOPSEndDate").value=date;cal.hide();}};function bb(calendar){if(calendar.dateClicked)AlertMessage(calendar.date.getdate())};function cw(cal,date){if(m_bLoggedIn){m_strDateTime=new Date(date);m_historicalData=null;historicalDateChanged=true;}else AlertMessage("<br/><br/>Please log in");};function onSelect(calendar,date){};function onClose(calendar){};function cj(){element=document.getElementById("vehicle_address");element.innerText="Looking up address...";Feed.MpPntRvGeo(cars.Rows[lastClickedBox].lt,cars.Rows[lastClickedBox].ln,bU);};function bU(result){element=document.getElementById("vehicle_address");if(result==null){element.innerText="Unable to reverse geocode this point.";}else{element.innerText="  "+result.value;}};function dD(id){if(ControlPanelLockout==true){AlertMessage("Sorry, this function has been locked at the<br/>request of the account owner.");return;}if(m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}var strSerial=cars.Rows[lastClickedBox].s+"";var idCheck=strSerial+"";switch(id){case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:break;case 7:if(idCheck.substring(0,1)!="8"){AlertMessage("Sorry, this feature is not supported for this device.");return;break;}dX();return;break;case 8:if(idCheck.substring(0,1)!="8"){AlertMessage("Sorry, this feature is not supported for this device.");return;break;}fS();return;break;case 9:fU(id);return;break;}if(idCheck.substring(0,1)=="7"||idCheck.substring(0,2)=="14"){AlertMessage("Sorry, this feature is not supported for this device.");return;}var strId=id+"";Feed.IBtnRqst(strSerial,strId,eh);};function eh(id){if(m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}var msg="Your request failed to process";if(id!=null){if(id.value!=null){msg="Your ";switch(id.value){case "1":msg+="'lock door' ";break;case "2":msg+="'unlock door' ";break;case "3":msg+="'honk horn' ";break;case "4":msg+="'disable starter' ";break;case "5":msg+="'enable starter' ";break;case "6":msg+="'remote start' ";break;}msg+="request has been processed";}}ActionCompleted(msg);};function ht(serial,color){element=document.getElementById("tbmrkr"+serial);if(element!=null){element.style.backgroundColor=color;}};function bT(serial){element=document.getElementById("tbmrkr"+serial);if(element!=null){if(element.style.backgroundColor.match("red")!=null){element.style.backgroundColor="white";}else{element.style.backgroundColor="red";}}};function bx(){if(currentpanicentries!=null){for(i=0;i<currentpanicentries.Rows.length;i++){if(currentpanicentries.Rows[i].enabled&&parseInt(currentpanicentries.Rows[i].code)==8){bT(currentpanicentries.Rows[i].serial);}}}if(m_bLoggedIn)setTimeout("bx()",250);};function dh(){Feed.SSysMsg(bO);};function bO(result){override=false;if(result!=null)if(result.value!=null){sysMsgs=result.value;for(i=0;i<sysMsgs.Rows.length;i++){if((sysMsgs.Rows[i].username==m_CurrentUser)&&(sysMsgs.Rows[i].enabled==true)){dL(sysMsgs.Rows[i].message);}if((sysMsgs.Rows[i].username=="allcall")&&(sysMsgs.Rows[i].enabled==true)){dL(sysMsgs.Rows[i].message);}}}};function bl(vType){var rptDate=new Date();var endDate=new Date();var dt=new Date();var sGMTOffSet=dt.getTimezoneOffset().toString();window.parent.clearTimeout(m_loadTimeout);window.parent.clearInterval(m_loadInterval);AjaxPro.timeoutPeriod=120*1000;document.getElementById("printRpt").style.visibility="hidden";document.getElementById("divResults").innerHTML='';var sessionQueryKey='';var dtFromDate=new Date();var dtToDate=new Date();var tmpReturn="";if(vType==8||vType==10||vType==11){var startDate=document.getElementById("txtStartDate").value;if(startDate==null||startDate==''){window.parent.AlertMessage("Please select begin date.");return false;}tmpReturn=gw(startDate);if(tmpReturn.length>0){window.parent.AlertMessage(tmpReturn);return false;}dtFromDate=new Date(startDate+' 00:00:00 AM');var endDate=document.getElementById("txtEndDate").value;if(endDate==null||endDate==''){window.parent.AlertMessage("Please select end date.");return false;}dtToDate=new Date(endDate+' 11:59:59 PM');tmpReturn=gw(endDate);if(tmpReturn.length>0){window.parent.AlertMessage(tmpReturn);return false;}}else{rptDate=document.getElementById("txtDate").value;if(rptDate==null||rptDate==''){window.parent.AlertMessage("Please select report date.");return false;}dtFromDate=new Date(rptDate+' 00:00:00 AM');dtToDate=new Date(rptDate+' 11:59:59 PM');tmpReturn=gw(rptDate);if(tmpReturn.length>0){window.parent.AlertMessage(tmpReturn);return false;}}var startTime='';var endTime='';var precision='';var type=0;var fromDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+dtFromDate.getHours()+':'+dtFromDate.getMinutes()+':'+dtFromDate.getSeconds();var toDate=dtToDate.getFullYear()+"/"+(dtToDate.getMonth()+1)+'/'+dtToDate.getDate()+" "+dtToDate.getHours()+':'+dtToDate.getMinutes()+':'+dtToDate.getSeconds();oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");switch(vType){case 1:var oddlVehicleID=document.getElementById("ddlVehicleID");rpt_VehicleId=oddlVehicleID.value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Vehicle Summary Report";gi();Feed.SGenRpt(sessionQueryKey,rpt_VehicleId,fromDate.toString(),toDate.toString(),"0",sGMTOffSet,gX);break;case 2:var oddlVehicleID=document.getElementById("ddlVehicleID");rpt_VehicleId=oddlVehicleID.value;fromDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("startHours").value+':'+document.getElementById("startMins").value+':'+document.getElementById("startSecs").value;toDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("endHours").value+':'+document.getElementById("endMins").value+':'+document.getElementById("endSecs").value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();type=document.getElementById("ddlPrecisionType").selectedIndex;precision=document.getElementById("precisionValue").value;if(type==0){rpt_precision=precision;}else{if(type==1){rpt_precision=precision*60;}else{rpt_precision=precision*3600;}}gi();Feed.SGenRpt(sessionQueryKey,rpt_VehicleId,fromDate.toString(),toDate.toString(),"0",sGMTOffSet,aM);break;case 3:var oddlVehicleID=document.getElementById("ddlVehicleID");rpt_VehicleId=oddlVehicleID.value;fromDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("startHours").value+':'+document.getElementById("startMins").value+':'+document.getElementById("startSecs").value;toDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("endHours").value+':'+document.getElementById("endMins").value+':'+document.getElementById("endSecs").value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();type=document.getElementById("ddlPrecisionType").selectedIndex;precision=document.getElementById("precisionValue").value;if(type==0){rpt_precision=precision;}else{if(type==1){rpt_precision=precision*60;}else{rpt_precision=precision*3600;}}gi();Feed.SGenRpt(sessionQueryKey,rpt_VehicleId,fromDate.toString(),toDate.toString(),"0",sGMTOffSet,hk);break;case 4:var oSpeedChange=document.getElementById("ddSpeedChange");rpt_precision=oSpeedChange.value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();gi();Feed.SGenRpt(sessionQueryKey,"0",fromDate.toString(),toDate.toString(),"0",sGMTOffSet,aX);break;case 5:rpt_precisionType=document.getElementById("ddlPrecisionType").selectedIndex;precision=document.getElementById("precisionValue").value;if(rpt_precisionType==0){rpt_precision=precision;}else{if(rpt_precisionType==1){rpt_precision=precision*60;}else{rpt_precision=precision*3600;}}rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();gi();Feed.SGenRpt(sessionQueryKey,"0",fromDate.toString(),toDate.toString(),"0",sGMTOffSet,ba);break;case 6:var oddlVehicleID=document.getElementById("ddlVehicleID");rpt_VehicleId=oddlVehicleID.value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Vehicle Mileage Report";gi();Feed.SGenRpt(sessionQueryKey,rpt_VehicleId,fromDate.toString(),toDate.toString(),"0",sGMTOffSet,gX);break;case 7:var oddlVehicleID=document.getElementById("ddlVehicleID");rpt_VehicleId=oddlVehicleID.value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Switches Report";gi();Feed.SGenRpt(sessionQueryKey,rpt_VehicleId,fromDate.toString(),toDate.toString(),"0",sGMTOffSet,hq);break;case 8:precision=document.getElementById("precisionValue").value;rpt_precision=precision;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Speeding Report";gi();Feed.SGenRpt(sessionQueryKey,"0",fromDate.toString(),toDate.toString(),rpt_precision,sGMTOffSet,hR);break;case 9:var sentTo=document.getElementById("ddlVehicleID").value;var sentFrom=document.getElementById("sentFrom").value;gi();Feed.SSntMsg(sessionQueryKey,sentTo,sentFrom,dtFromDate.toString(),toDate.toString(),sGMTOffSet,hJ);break;case 10:var rpt_feet=document.getElementById("txtFeet").value;var rpt_lat=document.getElementById("addressLAT").value;var rpt_lon=document.getElementById("addressLON").value;fromDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("startHours").value+':'+document.getElementById("startMins").value+':'+document.getElementById("startSecs").value;toDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+document.getElementById("endHours").value+':'+document.getElementById("endMins").value+':'+document.getElementById("endSecs").value;rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Proximity Report";gi();Feed.SUntNRad(sessionQueryKey,fromDate.toString(),toDate.toString(),rpt_feet,rpt_lat,rpt_lon,sGMTOffSet,fo);break;case 11:var strList="";var geoArray=new Array();var count=0;var tmpHours=0;var tmpMins=0;var tmpSecs=0;tmpHours=document.getElementById("startHours").value;tmpMins=document.getElementById("startMins").value;tmpSecs=document.getElementById("startSecs").value;if((!dI(tmpHours)||tmpHours<0||tmpHours>23)||(!dI(tmpMins)||tmpMins<0||tmpMins>59)||(!dI(tmpSecs)||tmpSecs<0||tmpSecs>59)){window.parent.AlertMessage("Please enter a valid Start Time.");return false;}fromDate=dtFromDate.getFullYear()+"/"+(dtFromDate.getMonth()+1)+'/'+dtFromDate.getDate()+' '+tmpHours+':'+tmpMins+':'+tmpSecs;var tmpHours=0;var tmpMins=0;var tmpSecs=0;tmpHours=document.getElementById("endHours").value;tmpMins=document.getElementById("endMins").value;tmpSecs=document.getElementById("endSecs").value;if((!dI(tmpHours)||tmpHours<0||tmpHours>23)||(!dI(tmpMins)||tmpMins<0||tmpMins>59)||(!dI(tmpSecs)||tmpSecs<0||tmpSecs>59)){window.parent.AlertMessage("Please enter a valid End Time.");return false;}toDate=dtToDate.getFullYear()+"/"+(dtToDate.getMonth()+1)+'/'+dtToDate.getDate()+' '+document.getElementById("endHours").value+':'+document.getElementById("endMins").value+':'+document.getElementById("endSecs").value;var tmpFromDate=new Date(fromDate);var tmpToDate=new Date(toDate);var tmpMilSecs=tmpToDate-tmpFromDate;tmpDays=Math.round(tmpMilSecs/(1000*60*60*24));if(tmpDays>7){window.parent.AlertMessage("Please reduce your date range to 7 days or less.");return false;}var cblist=document.getElementsByName('unitBox');for(var i=1;i<cblist.length;i++){if(cblist[i].checked==true){if(count>0){strList+=", ";}strList+=cblist[i].value;count+=1;}}if(count<1){window.parent.AlertMessage("Please select at least one Vehicle from the List.");return false;}var rpt_vehicles=strList;strList="";count=0;var cblist=document.getElementsByName('geoBox');for(var i=1;i<cblist.length;i++){if(cblist[i].checked==true){geoArray[count]=cblist[i].value+","+cblist[i].parentNode.innerText;count+=1;}}if(count<1){window.parent.AlertMessage("Please select at least one Zone from the List.");return false;}rpt_fromDate=fromDate.toString();rpt_toDate=toDate.toString();rpt_reportName="Zone Activity Report";gi();Feed.SGeoRpt(sessionQueryKey,rpt_vehicles,geoArray,fromDate.toString(),toDate.toString(),sGMTOffSet,cO);break;default:return false;break;}};function gi(){var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="visible";tmpDiv.style.display="block";};function dq(){var sessionID=document.getElementById("SESSIONKEY").getAttribute("value");m_loadTimeout=setTimeout("dv('"+sessionID+"');",4000);};function hX(){clearTimeout(m_loadTimeout);clearInterval(m_loadInterval);};function gw(pDate){var regExpDateFormat=/^\d{2}\/\d{2}\/\d{4}$/;if(!regExpDateFormat.test(pDate)){return "Invalid Date Format. Please correct to mm/dd/yyyy.";}else{var monthValue=pDate.split("/")[0];var dayValue=pDate.split("/")[1];var yearValue=pDate.split("/")[2];var tmpDate=new Date(yearValue,monthValue-1,dayValue);if((tmpDate.getMonth()+1!=monthValue)||(tmpDate.getDate()!=dayValue)||(tmpDate.getFullYear()!=yearValue)){return "Invalid Month, Day, or Year.";}else{return "";}}};function gX(response){rpt_history=response.value;rpt_historySub=0;rpt_linesPrinted=0;rpt_lastLat=null;rpt_lastLon=null;rpt_lastOri=null;rpt_GraphArray1=new Array();rpt_GraphArray2=new Array();rpt_FirstArray=null;rpt_chartTitle=null;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";rpt_Report=new fl();rpt_Report.append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Device ID: "+rpt_VehicleId+"<br>"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td colspan=\"4\" align='center' class=\"reportTitle\">"+rpt_reportName+"</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>");if(rpt_reportName=="Vehicle Mileage Report"){rpt_Report.append("<td class=\"reportColTitle\" width=\"75\">Time</td>"+"<td class=\"reportColTitle\" width=\"300\">Address</td>"+"<td class=\"reportColTitle\" width=\"130\">Speed</td>"+"<td class=\"reportColTitle\" width=\"170\">Distance</td>"+"</tr>");chartDiv=document.getElementById("WebChartMIL");chartDiv.innerHTML="";chartDiv.innerHTML="<center><p>Loading Report Chart</p></center>";chartDiv.innerHTML+="<center><img alt=\"Report Loading\" id=\"Chartloader\" src=\"images/redline2.gif\" width=\"150\" height=\"8\"/></center>";}else{rpt_chartTitle=null;rpt_Report.append("<td class=\"reportColTitle\" width=\"150\">Time</td>"+"<td class=\"reportColTitle\" width=\"325\">Address</td>"+"<td class=\"reportColTitle\" width=\"100\">Speed</td>"+"<td class=\"reportColTitle\" width=\"100\">Heading</td>"+"</tr>");chartDiv=document.getElementById("WebChartSTD");chartDiv.innerHTML="";chartDiv.innerHTML="<center><p>Loading Report Chart</p></center>";chartDiv.innerHTML+="<center><img alt=\"Report Loading\" id=\"Chartloader\" src=\"images/redline2.gif\" width=\"150\" height=\"8\"/></center>";}if(rpt_history==null||rpt_history.Rows.length==0){var divResults=document.getElementById("divResults");divResults.style.top="304px";divResults.innerHTML="<table style='background-color: Transparent;'><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";chartDiv.innerHTML="";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";var divResults=document.getElementById("divResults");divResults.style.top="304px";var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;Feed.MpPntRvGeo(lat,lon,gZ);};function gZ(response){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var divResults=document.getElementById("divResults");var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var ori=rpt_history.Rows[rpt_historySub].ori;var time=rpt_history.Rows[rpt_historySub].time;var dKPH=Math.round(vel*1.60934);var locDesc="";if(rpt_historySub==0){locDesc="Initial vehicle position at <br>";rpt_lastLat=lat;rpt_lastLon=lon;rpt_lastOri=ori;rpt_miles=0;}var miles=V(rpt_lastLat,rpt_lastLon,lat,lon);rpt_miles+=miles;miles=Math.round(rpt_miles*10)/10;var KMs=Math.round(rpt_miles*1.60934*10)/10;if(vel!=0&&rpt_lastVel==0){hours=rpt_lastTime.getHours()+"";minutes=rpt_lastTime.getMinutes()+"";seconds=rpt_lastTime.getSeconds()+"";while(hours.length<2){hours="&nbsp;&nbsp;"+hours;}while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}rpt_Report.append("<tr><td>"+hours+":"+minutes+":"+seconds+"</td><td>"+"Stayed at <br>"+"<span id=\"address_"+(rpt_historySub-1)+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+(rpt_historySub-1)+"','"+rpt_lastLat+"','"+rpt_lastLon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+rpt_lastLat+"  Lon:"+rpt_lastLon+"</a></span></td>"+"<td>0mph 0kph</td>");if(rpt_reportName=="Vehicle Mileage Report"){rpt_Report.append("<td></td></tr>");rpt_GraphArray1.push(rpt_miles);rpt_GraphArray2.push(0);}else{rpt_Report.append("<td>"+rpt_lastOri+"</td></tr>");rpt_GraphArray1.push(rpt_lastVel);rpt_GraphArray2.push(rpt_GraphArray1.length);}divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";locDesc="";rpt_lastVel=vel;}if(Math.abs(rpt_lastOri-ori)>30){locDesc="Heading change at <br>"}if(locDesc==""){locDesc="Continued to <br>";}if(response!=null){locDesc+=response.value+"</td>";}else{locDesc+="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+lat+"','"+lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+lat+"  Lon:"+lon+"</a></span></td>";}if((vel!=0&&rpt_lastVel!=0)||rpt_historySub==0||rpt_historySub==rpt_history.Rows.length-1){hours=time.getHours()+"";minutes=time.getMinutes()+"";seconds=time.getSeconds()+"";while(hours.length<2){hours="&nbsp;&nbsp;"+hours;}while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}rpt_Report.append("<tr><td>"+hours+":"+minutes+":"+seconds+"</td><td>"+locDesc+"<td>"+vel+"mph "+dKPH+"kph</td>");if(rpt_reportName=="Vehicle Mileage Report"){rpt_Report.append("<td>"+miles+"mi "+KMs+"km</td></tr>");rpt_GraphArray1.push(rpt_miles);rpt_GraphArray2.push(vel);}else{rpt_Report.append("<td>"+rpt_history.Rows[rpt_historySub].ori+"</td></tr>");rpt_GraphArray1.push(vel);rpt_GraphArray2.push(rpt_GraphArray1.length);}rpt_linesPrinted++;var waitCt=parseInt(rpt_linesPrinted/100)+1;if(rpt_linesPrinted%waitCt==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}}if(divResults.scrollHeight>400){divResults.style.top=295-(divResults.scrollHeight-400)+"px";}rpt_historySub++;if(rpt_historySub<rpt_history.Rows.length){rpt_lastLat=lat;rpt_lastLon=lon;rpt_lastOri=ori;rpt_lastVel=vel;rpt_lastTime=time;rpt_Timeout=setTimeout("gZ();",0);}else{divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";divResults.style.top="304px";if(rpt_GraphArray1.length==0){rpt_GraphArray1.push(null);}if(rpt_GraphArray2.length==0){rpt_GraphArray2.push(null);}if(rpt_reportName=="Vehicle Mileage Report"){rpt_chartTitle="Speed";Feed.DrwMilGrph(rpt_GraphArray1,rpt_GraphArray2,rpt_chartTitle);divResults.style.top="304px";var chartDiv=document.getElementById("WebChartMIL");chartDiv.innerHTML="";chartDiv.innerHTML="<iframe id=\"thechart\" src=\"ChartingMIL.aspx\" frameborder=\"0\" scrolling=\"no\" style=\"height: 295px; width:360px;\" allowtransparency='true'></iframe>";}else{rpt_chartTitle="Speed";Feed.DrwMilGrph(rpt_GraphArray1,rpt_GraphArray2,rpt_chartTitle);var chartDiv=document.getElementById("WebChartSTD");chartDiv.innerHTML="";chartDiv.innerHTML="<iframe id=\"thechart\" src=\"ChartingSTD.aspx\" frameborder=\"0\" scrolling=\"no\" style=\"height: 295px; width:360px;\" allowtransparency='true'></iframe>";}document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function aM(response){rpt_history=response.value;rpt_historySub=0;rpt_linesPrinted=0;rpt_GraphArray1=new Array();rpt_GraphArray2=new Array();rpt_FirstArray=null;rpt_chartTitle=null;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";rpt_Report=new fl();rpt_Report.append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Device ID: "+rpt_VehicleId+"<br>"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan=\"4\" align='center' class=\"reportTitle\">Enhanced Report</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"200\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"290\">Address</td>"+"<td class=\"reportColTitle\" width=\"105\">Speed</td>"+"<td class=\"reportColTitle\" width=\"60\">Heading</td>"+"</tr>");if(rpt_history==null||rpt_history.Rows.length==0){var divResults=document.getElementById("divResults");divResults.style.top="304px";divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";chartDiv=document.getElementById("WebChartSTD");chartDiv.innerHTML="";chartDiv.innerHTML="<center><p>Loading Report Chart</p></center>";chartDiv.innerHTML+="<center><img alt=\"Report Loading\" id=\"Chartloader\" src=\"images/redline2.gif\" width=\"150\" height=\"8\"/></center>";var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;Feed.MpPntRvGeo(lat,lon,aC);};function aC(response){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var divResults=document.getElementById("divResults");var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var ori=rpt_history.Rows[rpt_historySub].ori;var time=rpt_history.Rows[rpt_historySub].time;var dKPH=Math.round(vel*1.60934);var locDesc="";var secs=0;if(rpt_historySub!=0){secs=parseInt((time.getTime()-rpt_lastTime.getTime())/1000);}if(secs>=rpt_precision||rpt_historySub==0||rpt_historySub==rpt_history.Rows.length-1){if(response!=null){locDesc+=response.value+"</td>";}else{locDesc+="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+lat+"','"+lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+lat+"  Lon:"+lon+"</a></span></td>";}rpt_Report.append("<tr><td>"+time+"</td><td>"+locDesc+"<td>"+vel+"mph "+dKPH+"kph</td>"+"<td>"+rpt_history.Rows[rpt_historySub].ori+"</td></tr>");rpt_GraphArray1.push(vel);rpt_GraphArray2.push(rpt_GraphArray1.length);rpt_linesPrinted++;var waitCt=parseInt(rpt_linesPrinted/100)+1;if(rpt_linesPrinted%waitCt==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}rpt_lastTime=time;}if(divResults.scrollHeight>400){divResults.style.top=295-(divResults.scrollHeight-400)+"px";}else{divResults.style.top="304px";}rpt_historySub++;if(rpt_historySub<rpt_history.Rows.length){rpt_Timeout=setTimeout("aC();",0);}else{if(rpt_GraphArray1.length==0){rpt_GraphArray1.push(null);}if(rpt_GraphArray2.length==0){rpt_GraphArray2.push(null);}divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";divResults.style.top="304px";rpt_chartTitle="Speed";Feed.DrwMilGrph(rpt_GraphArray1,rpt_GraphArray2,rpt_chartTitle);var chartDiv=document.getElementById("WebChartSTD");chartDiv.innerHTML="";chartDiv.innerHTML="<iframe id=\"thechart\" src=\"ChartingSTD.aspx\" frameborder=\"0\" scrolling=\"no\" style=\"height: 295px; width:360px; vertical-align:top;\" allowtransparency='true'></iframe>";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function aX(response){rpt_history=response.value;oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SVehNm(sessionQueryKey,aJ);};function aJ(response){rpt_vehNames=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var divResults=document.getElementById("divResults");rpt_Report=new fl();rpt_Report.append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"5\" class=\"reportHeader\">"+"&nbsp;Begin: "+rpt_fromDate+"<br>"+"&nbsp;End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan=\"5\" align='center' class=\"reportTitle\">Aggressive Driving Report</td>"+"</tr>"+"<tr><td colspan='5'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"35\">Vehicle</td>"+"<td class=\"reportColTitle\" width=\"190\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"215\">Location</td>"+"<td class=\"reportColTitle\" width:\"100\">Vel 1</td>"+"<td class=\"reportColTitle\" width:\"100\">Vel 2</td>"+"</tr>");if(rpt_history==null||rpt_history.Rows.length==0){divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_Timeout=setTimeout("aA();",0);};function aA(response){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var divResults=document.getElementById("divResults");var vehicleId=rpt_history.Rows[rpt_historySub].VehicleId;var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var time=rpt_history.Rows[rpt_historySub].time;var KPH=Math.round(vel*1.60934);var lastKPH=Math.round(rpt_lastVel*1.60934);if(rpt_historySub==0){rpt_lastVehicleId=vehicleId;rpt_lastVel=vel;}if(vehicleId!=rpt_lastVehicleId){rpt_lastVehicleId=vehicleId;rpt_lastVel=vel;}if(Math.abs(rpt_lastVel-vel)>rpt_precision){var vehName=vehicleId;for(var i=0;i<rpt_vehNames.Rows.length;i++){if(rpt_vehNames.Rows[i].Serial==vehName){vehName=rpt_vehNames.Rows[i].VehicleName;break;}}rpt_Report.append("<tr><td>"+vehName+"</td>"+"<td>"+time+"</td><td>"+"<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+lat+"','"+lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+lat+"  Lon:"+lon+"</a></span></td>"+"<td>"+rpt_lastVel+"mph "+lastKPH+"kph</td>"+"<td>"+vel+"mph "+KPH+"kph</td></tr>");rpt_linesPrinted++;var waitCt=parseInt(rpt_linesPrinted/100)+1;if(rpt_linesPrinted%waitCt==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}}if(divResults.scrollHeight>700){divResults.style.top=(700-divResults.scrollHeight)+"px";}rpt_historySub++;if(rpt_historySub<rpt_history.Rows.length){rpt_lastVehicleId=vehicleId;rpt_lastVel=vel;rpt_lastTime=time;rpt_Timeout=setTimeout("aA();",0);}else{if(rpt_linesPrinted==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\">&nbsp;&nbsp;No historical information was found for specified interval</td></tr></table>";}else{divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}divResults.style.top="51px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function ba(response){rpt_history=response.value;rpt_GraphArray1=new Array();rpt_GraphArray2=new Array();rpt_chartTitle=null;rpt_GraphSub=0;oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SVehNm(sessionQueryKey,aI);};function aI(response){rpt_vehNames=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var divResults=document.getElementById("divResults");rpt_Report=new fl();rpt_Report.append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td  colspan=\"4\" align='center' class=\"reportTitle\"><b>Excessive Idling Report</b></td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"60\">Vehicle</td>"+"<td class=\"reportColTitle\" width=\"100\">Time</td>"+"<td class=\"reportColTitle\" width=\"420\">Location</td>"+"<td class=\"reportColTitle\" width=\"75\">Idle Time</td>"+"</tr>");if(rpt_history==null||rpt_history.Rows.length==0){divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_Timeout=setTimeout("ah();",0);};function ah(response){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var divResults=document.getElementById("divResults");var vehicleId=rpt_history.Rows[rpt_historySub].VehicleId;var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var ignitionState=rpt_history.Rows[rpt_historySub].IgnitionState;var time=rpt_history.Rows[rpt_historySub].time;var secs=0;var locDesc="";if(response!=null){locDesc=response.value;}var vehName=vehicleId;if(rpt_historySub==0){rpt_lastVehicleId=vehicleId;rpt_idling=false;}if(rpt_idling&&(vel!=0||ignitionState!=1||vehicleId!=rpt_lastVehicleId)){rpt_idling=false;secs=parseInt((time.getTime()-rpt_lastTime.getTime())/1000);if(secs>=rpt_precision){if(locDesc==""){rpt_idling=true;Feed.MpPntRvGeo(rpt_lastLat,rpt_lastLon,ah);return null;}secs=Math.round(secs);var mn=parseInt(secs/60);mm=mn;var se=secs-(mn*60);var hr=parseInt(mn/60);mn-=(hr*60);var elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";hours=rpt_lastTime.getHours()+"";minutes=rpt_lastTime.getMinutes()+"";seconds=rpt_lastTime.getSeconds()+"";while(hours.length<2){hours="&nbsp;&nbsp;"+hours;}while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}for(var i=0;i<rpt_vehNames.Rows.length;i++){if(rpt_vehNames.Rows[i].Serial==vehName){vehName=rpt_vehNames.Rows[i].VehicleName;break;}}rpt_Report.append("<tr><td>"+vehName+"</td>"+"<td>"+hours+":"+minutes+":"+seconds+"</td>"+"<td>"+locDesc+"</td>"+"<td>"+elapseString+"</td></tr>");locDesc="";rpt_linesPrinted++;rpt_GraphArray1[rpt_GraphSub]=vehicleId;rpt_GraphArray2[rpt_GraphSub]=secs;rpt_GraphSub++;var waitCt=parseInt(rpt_linesPrinted/100)+1;if(rpt_linesPrinted%waitCt==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}}}if(vehicleId!=rpt_lastVehicleId){rpt_lastVehicleId=vehicleId;rpt_idling=false;}if(!rpt_idling&&vel==0&&ignitionState==1){rpt_lastTime=time;rpt_lastLat=lat;rpt_lastLon=lon;rpt_idling=true;}if(divResults.scrollHeight>700){divResults.style.top=(700-divResults.scrollHeight)+"px";}rpt_historySub++;if(rpt_historySub<rpt_history.Rows.length){rpt_Timeout=setTimeout("ah();",0);}else{divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";divResults.style.top="51px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function hq(response){rpt_history=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";rpt_Report=new fl();rpt_Report.append("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Device ID: "+rpt_VehicleId+"<br>"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan=\"4\" align='center' class=\"reportTitle\">Switches Report</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"200\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"240\">Address</td>"+"<td class=\"reportColTitle\" width=\"95\">Speed</td>"+"<td class=\"reportColTitle\" width=\"95\">Switches On</td>"+"</tr>");if(rpt_history==null||rpt_history.Rows.length==0){var divResults=document.getElementById("divResults");divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;Feed.MpPntRvGeo(lat,lon,switchesReportLoop);};function switchesReportLoop(response){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var divResults=document.getElementById("divResults");var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var dKPH=Math.round(vel*1.60934);var time=rpt_history.Rows[rpt_historySub].time;var switches=rpt_history.Rows[rpt_historySub].Switches;var locDesc="";if(rpt_historySub==0){locDesc="Initial vehicle position at <br>";rpt_lastSwitches=switches;}if(response!=null){locDesc+=response.value+"</td>";}else{locDesc+="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+lat+"','"+lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+lat+"  Lon:"+lon+"</a></span></td>";}if(switches!=rpt_lastSwitches||rpt_historySub==0){var switchValue="";switch(switches){case 1:switchValue="Sw1";break;case 2:switchValue="Sw2";break;case 3:switchValue="Sw1 Sw2";break;case 4:switchValue="Sw3";break;case 5:switchValue="Sw1 Sw3";break;case 6:switchValue="Sw2 Sw3";break;case 7:switchValue="Sw1 Sw2 Sw3";break;case 8:switchValue="Sw4";break;case 9:switchValue="Sw1 Sw4";break;case 10:switchValue="Sw2 Sw4";break;case 11:switchValue="Sw1 Sw2 Sw4";break;case 12:switchValue="Sw3 Sw4";break;case 13:switchValue="Sw1 Sw3 Sw4";break;case 14:switchValue="Sw2 Sw3 Sw4";break;case 15:switchValue="Sw1 Sw2 Sw3 Sw4";break;}rpt_Report.append("<tr><td>"+time+"</td><td>"+locDesc+"<td>"+vel+"mph "+dKPH+"kph</td>");rpt_Report.append("<td>"+switchValue+"</td></tr>");rpt_linesPrinted++;var waitCt=parseInt(rpt_linesPrinted/100)+1;if(rpt_linesPrinted%waitCt==0){divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";}}if(divResults.scrollHeight>700){divResults.style.top=(700-divResults.scrollHeight)+"px";}rpt_historySub++;if(rpt_historySub<rpt_history.Rows.length){rpt_lastSwitches=switches;rpt_Timeout=setTimeout("switchesReportLoop();",0);}else{divResults.innerHTML=rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";divResults.style.top="51px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function hk(response){rpt_history=response.value;rpt_historySub=0;rpt_linesPrinted=0;rpt_GraphArray1=new Array();rpt_GraphArray2=new Array();rpt_FirstArray=null;rpt_chartTitle=null;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var chartDiv=document.getElementById("WebChartSSR");chartDiv.innerHTML="";chartDiv.innerHTML="<center><p>Loading Report Chart</p></center>";chartDiv.innerHTML+="<center><img alt=\"Report Loading\" id=\"Chartloader\" src=\"images/redline2.gif\" width=\"150\" height=\"8\"/></center>";var divResults=document.getElementById("divResults");if(rpt_history==null||rpt_history.Rows.length==0){divResults.style.top="310px";divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found for specified interval</td></tr>";chartDiv.innerHTML="";window.parent.dq();return null;}rpt_IgnitionMovement=document.getElementById("rptIgnition");if(rpt_IgnitionMovement.checked){rpt_IgnitionMovement=true;rpt_precision=0;}else{rpt_IgnitionMovement=false;}rpt_Report=new fl();rpt_reportHeading="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan='5' class=\"reportHeader\">"+"Device ID: "+rpt_VehicleId+"<br>"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr><td colspan='5'>&nbsp;</td></tr>"+"<tr>"+"<td colspan='5' align='center' class='reportTitle'>Stop/Start Report</td>"+"</tr>"+"<tr><td colspan='5'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"60\">State</td>"+"<td class=\"reportColTitle\" width=\"70\">Elapsed Time</td>"+"<td class=\"reportColTitle\" width=\"400\">Location</td>"+"<td class=\"reportColTitle\" width=\"85\">Begin Time</td>"+"<td class=\"reportColTitle\" width=\"80\">End Time</td>"+"</tr>";divResults.innerHTML=rpt_reportHeading+"<tr><td colspan=\"5\">&nbsp;</td></tr></table>";divResults.style.top="310px";rpt_Timeout=setTimeout("stopStartReportLoop();",0);document.getElementById("divRpt").style.visibility="hidden";};function stopStartReportLoop(response){var divResults=document.getElementById("divResults");var locDesc="";var stat="";var loc="";if(response!=null){locDesc=response.value;}if(rpt_historySub<rpt_history.Rows.length){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var lat=rpt_history.Rows[rpt_historySub].lat;var lon=rpt_history.Rows[rpt_historySub].lon;var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var time=rpt_history.Rows[rpt_historySub].time;var ignition=rpt_history.Rows[rpt_historySub].IgnitionState;var secs=0;if(rpt_historySub==0){if(rpt_IgnitionMovement){if(vel==0){rpt_stopped=true;}}else{if(ignition==0){rpt_stopped=true;}}rpt_lastStartTime=time;rpt_lastStopTime=time;rpt_lastLat=lat;rpt_lastLon=lon;rpt_totRunTime=0;rpt_totStopTime=0;}if((!rpt_IgnitionMovement&&(vel!=0&&rpt_stopped))||(rpt_IgnitionMovement&&(ignition==1&&rpt_stopped))){secs=parseInt((time.getTime()-rpt_lastStopTime.getTime())/1000);if(secs>=rpt_precision){if(locDesc==""){Feed.MpPntRvGeo(rpt_lastLat,rpt_lastLon,stopStartReportLoop);return null;}rpt_totStopTime+=secs;var hr=0;var mn=0;var se=0;var mm=0;if(rpt_lastStartTime!=rpt_lastStopTime){var rsecs=parseInt((rpt_lastStopTime.getTime()-rpt_lastStartTime.getTime())/1000);rpt_totRunTime+=rsecs;mn=parseInt(rsecs/60);mm=mn;se=rsecs-(mn*60);hr=parseInt(mn/60);mn-=(hr*60);var elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";if(rpt_IgnitionMovement){stat="Ignition On";}else{stat="Moving";}hours=rpt_lastStartTime.getHours()+"";minutes=rpt_lastStartTime.getMinutes()+"";seconds=rpt_lastStartTime.getSeconds()+"";while(hours.length<2){hours="&nbsp;&nbsp;"+hours;}while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}hours2=rpt_lastStopTime.getHours()+"";minutes2=rpt_lastStopTime.getMinutes()+"";seconds2=rpt_lastStopTime.getSeconds()+"";while(hours2.length<2){hours2="&nbsp;&nbsp;"+hours2;}while(minutes2.length<2){minutes2="0"+minutes2;}while(seconds2.length<2){seconds2="0"+seconds2;}rpt_Report.append("<tr><td style='color: Green;'>Running</td>"+"<td>"+elapseString+"</td>"+"<td>"+stat+"</td>"+"<td>"+hours+":"+minutes+":"+seconds+"</td>"+"<td>"+hours2+":"+minutes2+":"+seconds2+"</td></tr>");rpt_GraphArray2.push(mm);if(rpt_FirstArray==null){rpt_FirstArray="green";}}mn=parseInt(secs/60);mm=mn;se=secs-(mn*60);hr=parseInt(mn/60);mn-=(hr*60);if(rpt_IgnitionMovement){stat="Ignition Off";}else{stat="Stopped";}elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";hours=rpt_lastStopTime.getHours()+"";minutes=rpt_lastStopTime.getMinutes()+"";seconds=rpt_lastStopTime.getSeconds()+"";while(hours.length<2){hours="&nbsp;&nbsp;"+hours;}while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}hours2=time.getHours()+"";minutes2=time.getMinutes()+"";seconds2=time.getSeconds()+"";while(hours2.length<2){hours2="&nbsp;&nbsp;"+hours2;}while(minutes2.length<2){minutes2="0"+minutes2;}while(seconds2.length<2){seconds2="0"+seconds2;}rpt_Report.append("<tr><td style='color: Red;'>"+stat+"</td>"+"<td>"+elapseString+"</td>"+"<td width='400px'>"+locDesc+"</td>"+"<td>"+hours+":"+minutes+":"+seconds+"</td>"+"<td>"+hours2+":"+minutes2+":"+seconds2+"</td></tr>");rpt_GraphArray1.push(mm);if(rpt_FirstArray==null){rpt_FirstArray="red";}divResults.innerHTML=rpt_reportHeading+rpt_Report.toString()+"<tr><td colspan=\"6\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_stopped=false;rpt_lastStartTime=time;}else{rpt_stopped=false;}}else if((!rpt_IgnitionMovement&&(vel!=0&& !rpt_stopped))||(rpt_IgnitionMovement&&(ignition==1&& !rpt_stopped))){}else if((!rpt_IgnitionMovement&&(vel==0&& !rpt_stopped))||(rpt_IgnitionMovement&&(ignition!=1&& !rpt_stopped))){rpt_lastStopTime=time;rpt_stopped=true;rpt_lastLat=lat;rpt_lastLon=lon;}if(divResults.scrollHeight>400){divResults.style.top=295-(divResults.scrollHeight-400)+"px";}rpt_historySub++;rpt_Timeout=setTimeout("stopStartReportLoop();",0);}else{if(rpt_stopped){if(locDesc==""){Feed.MpPntRvGeo(rpt_lastLat,rpt_lastLon,stopStartReportLoop);return null;}if(rpt_lastStartTime!=rpt_lastStopTime){var rsecs=parseInt((rpt_lastStopTime.getTime()-rpt_lastStartTime.getTime())/1000);rpt_totRunTime+=rsecs;var mn=parseInt(rsecs/60);mm=mn;var se=rsecs-(mn*60);var hr=parseInt(mn/60);mn-=(hr*60);var elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";if(rpt_IgnitionMovement){stat="Ignition On";}else{stat="Moving";}hours=rpt_lastStartTime.getHours();minutes=rpt_lastStartTime.getMinutes()+"";seconds=rpt_lastStartTime.getSeconds()+"";while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}hours2=rpt_lastStopTime.getHours();minutes2=rpt_lastStopTime.getMinutes()+"";seconds2=rpt_lastStopTime.getSeconds()+"";while(minutes2.length<2){minutes2="0"+minutes2;}while(seconds2.length<2){seconds2="0"+seconds2;}rpt_Report.append("<tr><td style='color: Green;'>Running</td>"+"<td>"+elapseString+"</td>"+"<td>"+stat+"</td>");if(hours<10){hours="&nbsp "+hours;}rpt_Report.append("<td>"+hours+":"+minutes+":"+seconds+"</td>");if(hours2<10){hours2="&nbsp "+hours2;}rpt_Report.append("<td>"+hours2+":"+minutes2+":"+seconds2+"</td></tr>");rpt_GraphArray2.push(mm);if(rpt_FirstArray==null){rpt_FirstArray="green";}}secs=parseInt((rpt_history.Rows[rpt_history.Rows.length-1].time.getTime()-rpt_lastStopTime.getTime())/1000);if(secs>0){rpt_totStopTime+=secs;var mn=parseInt(secs/60);var mm=mn;var se=secs-(mn*60);var hr=parseInt(mn/60);mn-=(hr*60);var elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";if(rpt_IgnitionMovement){stat="Ignition Off";}else{stat="Stopped";}hours=rpt_lastStopTime.getHours();minutes=rpt_lastStopTime.getMinutes()+"";seconds=rpt_lastStopTime.getSeconds()+"";while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}hours2=rpt_history.Rows[rpt_history.Rows.length-1].time.getHours();minutes2=rpt_history.Rows[rpt_history.Rows.length-1].time.getMinutes()+"";seconds2=rpt_history.Rows[rpt_history.Rows.length-1].time.getSeconds()+"";while(minutes2.length<2){minutes2="0"+minutes2;}while(seconds2.length<2){seconds2="0"+seconds2;}if(hours<10){hours="&nbsp "+hours;}if(hours2<10){hours2="&nbsp "+hours2;}rpt_Report.append("<tr><td style='color: Red;'>"+stat+"</td>"+"<td>"+elapseString+"</td>"+"<td width='400px'>"+locDesc+"</td>"+"<td>"+hours+":"+minutes+":"+seconds+"</td>"+"<td>"+hours2+":"+minutes2+":"+seconds2+"</td></tr>");rpt_GraphArray1.push(mm);if(rpt_FirstArray==null){rpt_FirstArray="red";}}}else{var rsecs=parseInt((rpt_history.Rows[rpt_history.Rows.length-1].time.getTime()-rpt_lastStartTime.getTime())/1000);rpt_totRunTime+=rsecs;var mn=parseInt(rsecs/60);var mm=mn;var se=rsecs-(mn*60);var hr=parseInt(mn/60);mn-=(hr*60);var elapseString="";if(hr>0){elapseString+=hr+"h:";}if(mn>0||hr>0){elapseString+=mn+"m:";}elapseString+=se+"s";rpt_Report.append("<tr><td style='color: Green;'>Running</td>"+"<td>"+elapseString+"</td>");if(rpt_IgnitionMovement){rpt_Report.append("<td>Ignition On</td>");}else{rpt_Report.append("<td>Moving</td>");}hours=rpt_lastStartTime.getHours();minutes=rpt_lastStartTime.getMinutes()+"";seconds=rpt_lastStartTime.getSeconds()+"";while(minutes.length<2){minutes="0"+minutes;}while(seconds.length<2){seconds="0"+seconds;}hours2=rpt_history.Rows[rpt_history.Rows.length-1].time.getHours();minutes2=rpt_history.Rows[rpt_history.Rows.length-1].time.getMinutes()+"";seconds2=rpt_history.Rows[rpt_history.Rows.length-1].time.getSeconds()+"";while(minutes2.length<2){minutes2="0"+minutes2;}while(seconds2.length<2){seconds2="0"+seconds2;}rpt_Report.append("</td><td>"+hours+":"+minutes+":"+seconds+"</td>"+"<td>"+hours2+":"+minutes2+":"+seconds2+"</td></tr>");rpt_GraphArray2.push(mm);if(rpt_FirstArray==null){rpt_FirstArray="green";}}var mn=parseInt(rpt_totRunTime/60);var mm=mn;var se=rpt_totRunTime-(mn*60);var hr=parseInt(mn/60);mn-=(hr*60);var totRunTime="";if(hr>0){totRunTime+=hr+"h:";}if(mn>0||hr>0){totRunTime+=mn+"m:";}totRunTime+=se+"s";mn=parseInt(rpt_totStopTime/60);mm=mn;se=rpt_totStopTime-(mn*60);hr=parseInt(mn/60);mn-=(hr*60);var totStopTime="";if(hr>0){totStopTime+=hr+"h:";}if(mn>0||hr>0){totStopTime+=mn+"m:";}totStopTime+=se+"s";divResults.innerHTML=rpt_reportHeading+"<tr><td colspan='5'>&nbsp;</td></tr>"+"<tr><td colspan='5'>Total Run Time: "+totRunTime+"</td></tr>"+"<tr><td colspan='5'>Total Stop Time: "+totStopTime+"</td>"+"</tr><tr><td colspan='5'>&nbsp;</td></tr>"+rpt_Report.toString()+"<tr><td colspan='5' class=\"reportHeader\">&nbsp;</td></tr></table>";divResults.style.top="304px";if(rpt_GraphArray1.length==0){rpt_GraphArray1.push(null);}if(rpt_GraphArray2.length==0){rpt_GraphArray2.push(null);}if(rpt_FirstArray=="red"){Feed.DrwSSGrph(rpt_GraphArray1,rpt_GraphArray2,rpt_FirstArray,rpt_chartTitle);}else{Feed.DrwSSGrph(rpt_GraphArray2,rpt_GraphArray1,rpt_FirstArray,rpt_chartTitle);}var chartDiv=document.getElementById("WebChartSSR");chartDiv.innerHTML="";chartDiv.innerHTML="<iframe id=\"thechart\" src=\"ChartingSSR.aspx\" frameborder=\"0\" scrolling=\"no\" style=\"height: 295px; width:360px;\" allowtransparency='true'></iframe>";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();}};function hR(response){rpt_history=response.value;oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SVehNm(sessionQueryKey,hQ);};function hQ(response){rpt_vehNames=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var divResults=document.getElementById("divResults");rpt_Report=new fl();rpt_reportHeading="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan='4' align='center' class='reportTitle'>Speeding Report</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"60\">Vehicle</td>"+"<td class=\"reportColTitle\" width=\"240\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"290\">Address</td>"+"<td class=\"reportColTitle\" width=\"50\">Speed</td>"+"</tr>";if(rpt_history==null||rpt_history.Rows.length==0){divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found that matched your criteria</td></tr>";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";divResults.innerHTML=rpt_reportHeading+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_Timeout=setTimeout("gu();",0);};function gu(response){var tmpdivResults=document.getElementById("divResults");var locDesc="";var stat="";var loc="";if(rpt_historySub>0){if(response!=null){locDesc=response.value;}else{locDesc="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+rpt_history.Rows[rpt_historySub].lat+"','"+rpt_history.Rows[rpt_historySub].lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+rpt_history.Rows[rpt_historySub].lat+"  Lon:"+rpt_history.Rows[rpt_historySub].lon+"</a></span>";}var vehName=rpt_VehicleID;for(var i=0;i<rpt_vehNames.Rows.length;i++){if(rpt_vehNames.Rows[i].Serial==vehName){vehName=rpt_vehNames.Rows[i].VehicleName;break;}}var KPH=Math.round(rpt_lastVel*1.60934);rpt_Report.append("<tr>"+"<td>"+vehName+"</td>"+"<td>"+rpt_lastTime+"</td>"+"<td>"+locDesc+"</td>"+"<td>"+rpt_lastVel+"<mph "+KPH+"kph</td>"+"</tr>");tmpdivResults.innerHTML=rpt_reportHeading+rpt_Report.toString()+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_linesPrinted++;if(tmpdivResults.scrollHeight>700){tmpdivResults.style.top=(700-tmpdivResults.scrollHeight)+"px";}rpt_historySub++;}while(rpt_historySub<rpt_history.Rows.length){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var time=rpt_history.Rows[rpt_historySub].time;if(rpt_history.Rows[rpt_historySub].vel>rpt_precision){rpt_lastTime=rpt_history.Rows[rpt_historySub].time;rpt_lastVel=rpt_history.Rows[rpt_historySub].vel;rpt_VehicleID=rpt_history.Rows[rpt_historySub].VehicleId;rpt_lastLat=rpt_history.Rows[rpt_historySub].lat;rpt_lastLon=rpt_history.Rows[rpt_historySub].lon;if(rpt_historySub==0){rpt_historySub++;Feed.MpPntRvGeo(rpt_history.Rows[rpt_historySub].lat,rpt_history.Rows[rpt_historySub].lon,gu);}else{rpt_Timeout=setTimeout("gu();",0);}return;}rpt_historySub++;}tmpdivResults.style.top="85px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();};function hJ(response){};function cO(response){rpt_history=response.value;oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SVehNm(sessionQueryKey,cN);};function cN(response){rpt_vehNames=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var divResults=document.getElementById("divResults");rpt_Report=new fl();rpt_reportHeading="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan='4' align='center' class='reportTitle'>Zone Activity Report</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"100\">Vehicle</td>"+"<td class='reportColTitle' width='150'>Zone</td>"+"<td class=\"reportColTitle\" width=\"210\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"240\">Address</td>"+"</tr>";if(rpt_history==null||rpt_history.Rows.length==0){divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found that matched your criteria</td></tr>";divResults.style.top="250px";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";divResults.innerHTML=rpt_reportHeading+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";Feed.MpPntRvGeo(rpt_history.Rows[rpt_historySub].lat,rpt_history.Rows[rpt_historySub].lon,cL);};function cL(response){var divResults=document.getElementById("divResults");var locDesc="";var stat="";var loc="";var prevDevice=0;while(rpt_historySub<rpt_history.Rows.length){locDesc="";stat="";loc="";if(prevDevice==rpt_history.Rows[rpt_historySub].VehicleId){if(rpt_historySub==0&&response!=null){locDesc=response.value;response=null;}else{locDesc="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+rpt_history.Rows[rpt_historySub].lat+"','"+rpt_history.Rows[rpt_historySub].lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+rpt_history.Rows[rpt_historySub].lat+"  Lon:"+rpt_history.Rows[rpt_historySub].lon+"</a></span>";}var vehName=rpt_history.Rows[rpt_historySub].VehicleId;for(var i=0;i<rpt_vehNames.Rows.length;i++){if(rpt_vehNames.Rows[i].Serial==vehName){vehName=rpt_vehNames.Rows[i].VehicleName;break;}}var tmpGeoName="";if(rpt_history.Rows[rpt_historySub].geoName=='0'){tmpGeoName="Exit "+rpt_history.Rows[rpt_historySub].prevRowName;}else{tmpGeoName="Enter "+rpt_history.Rows[rpt_historySub].geoName;}rpt_Report.append("<tr>"+"<td>"+vehName+"</td>"+"<td>"+tmpGeoName+"</td>"+"<td>"+rpt_history.Rows[rpt_historySub].time+"</td>"+"<td>"+locDesc+"</td>"+"</tr>");divResults.innerHTML=rpt_reportHeading+rpt_Report.toString()+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_linesPrinted++;if(divResults.scrollHeight>700){divResults.style.top=(700-divResults.scrollHeight)+"px";}}prevDevice=rpt_history.Rows[rpt_historySub].VehicleId;rpt_historySub++;}divResults.style.top="250px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();};function fo(response){rpt_history=response.value;oSESSIONKEY=document.getElementById("SESSIONKEY");sessionQueryKey=oSESSIONKEY.getAttribute("value");Feed.SVehNm(sessionQueryKey,fp);};function fp(response){rpt_vehNames=response.value;rpt_historySub=0;rpt_linesPrinted=0;var tmpDiv=document.getElementById("progressBar");tmpDiv.style.visibility="hidden";tmpDiv.style.display="none";var divResults=document.getElementById("divResults");rpt_Report=new fl();rpt_reportHeading="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"reportTable\" style=\"background-color: Transparent;\">"+"<tr>"+"<td colspan=\"4\" class=\"reportHeader\">"+"Begin: "+rpt_fromDate+"<br>"+"End: "+rpt_toDate+"</td>"+"</tr>"+"<tr>"+"<td colspan='4' align='center' class='reportTitle'>Proximity Report</td>"+"</tr>"+"<tr><td colspan='4'>&nbsp;</td></tr>"+"<tr>"+"<td class=\"reportColTitle\" width=\"60\">Vehicle</td>"+"<td class=\"reportColTitle\" width=\"240\">Date/Time</td>"+"<td class=\"reportColTitle\" width=\"290\">Address</td>"+"<td class=\"reportColTitle\" width=\"290\">Speed</td>"+"</tr>";if(rpt_history==null||rpt_history.Rows.length==0){divResults.innerHTML="<table><tr><td><br>&nbsp;&nbsp;No historical information was found that matched your criteria</td></tr>";divResults.style.top="250px";window.parent.dq();return null;}document.getElementById("divRpt").style.visibility="hidden";divResults.innerHTML=rpt_reportHeading+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_Timeout=setTimeout("proximityReportLoop();",0);};function proximityReportLoop(response){var divResults=document.getElementById("divResults");var locDesc="";var stat="";var loc="";if(rpt_historySub>0){if(response!=null){locDesc=response.value;}else{locDesc="<span id=\"address_"+rpt_historySub+"\"><a href=\"javascript:void(0);\" onclick=\"javascript:showAddress('"+rpt_historySub+"','"+rpt_history.Rows[rpt_historySub].lat+"','"+rpt_history.Rows[rpt_historySub].lon+"', '0');\" title=\"Click Here to view Address\" >Lat:"+rpt_history.Rows[rpt_historySub].lat+"  Lon:"+rpt_history.Rows[rpt_historySub].lon+"</a></span>";}var vehName=rpt_VehicleID;for(var i=0;i<rpt_vehNames.Rows.length;i++){if(rpt_vehNames.Rows[i].Serial==vehName){vehName=rpt_vehNames.Rows[i].VehicleName;break;}}var KPH=Math.round(rpt_lastVel*1.60934);rpt_Report.append("<tr>"+"<td>"+vehName+"</td>"+"<td>"+rpt_lastTime+"</td>"+"<td>"+locDesc+"</td>"+"<td>"+rpt_lastVel+"<mph "+KPH+"kph</td>"+"</tr>");divResults.innerHTML=rpt_reportHeading+rpt_Report.toString()+"<tr><td colspan=\"4\" class=\"reportHeader\">&nbsp;</td></tr></table>";rpt_linesPrinted++;if(divResults.scrollHeight>700){divResults.style.top=(700-divResults.scrollHeight)+"px";}rpt_historySub++;}while(rpt_historySub<rpt_history.Rows.length){oSessionKey=document.getElementById("SESSIONKEY");var sessionID=oSessionKey.getAttribute("value");var vel=parseInt(rpt_history.Rows[rpt_historySub].vel);var time=rpt_history.Rows[rpt_historySub].time;rpt_lastTime=rpt_history.Rows[rpt_historySub].time;rpt_lastVel=rpt_history.Rows[rpt_historySub].vel;rpt_VehicleID=rpt_history.Rows[rpt_historySub].VehicleId;rpt_lastLat=rpt_history.Rows[rpt_historySub].lat;rpt_lastLon=rpt_history.Rows[rpt_historySub].lon;if(rpt_historySub==0){rpt_historySub++;Feed.MpPntRvGeo(rpt_history.Rows[rpt_historySub].lat,rpt_history.Rows[rpt_historySub].lon,gu);}else{rpt_Timeout=setTimeout("proximityReportLoop();",0);}return;rpt_historySub++;}divResults.style.top="250px";document.getElementById("divRpt").style.visibility="visible";document.getElementById("printRpt").style.visibility="visible";window.parent.dq();};function dz(reportType){if(m_bLoggedIn){offlineReportType=reportType;Feed.STmZn(de);}else{AlertMessage("You must be logged in to use this feature.");}};function de(response){if(response.value!=null){var SetIndexTo=0;var timeZones=response.value;ddlTimeZone=document.getElementById("ddlTimeZone");ddlTimeZone.options.length=0;for(var i=0;i<timeZones.Rows.length;i++){ddlTimeZone.options[i]=new Option(timeZones.Rows[i].Name,timeZones.Rows[i].TZKey);if(timeZones.Rows[i].Name=="(GMT-06:00) Central Standard Time (US & Canada)"){SetIndexTo=ddlTimeZone.options.length-1;}}ddlTimeZone.selectedIndex=SetIndexTo;}Feed.SUsrEml(m_CurrentUser,al);};function al(email){aF("divReportSelector");ddlOLReportsName=document.getElementById("txtOfflineReportName");ddldivOLRIdle=document.getElementById("divOLRIdle");divOLRVelocityChange=document.getElementById("divOLRVelocityChange");var divOLRIdle=document.getElementById("divOLRIdle");switch(offlineReportType){case 50:ddlOLReportsName.innerHTML="Agressive Driving Report";divOLRVelocityChange.innerHTML="<p class='whiteType10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Velocity Change : "+"<select name='ddlOLRVelChange' id='ddlOLRVelChange' style='width: 50px; background-color: white; color:#000000; visibility:inherit;' onchange='cleanMap(false);setViewType(false);' onclick='cleanMap(false);setViewType(false);'></select>"+"in mph in 10 second period"+"</p>";ddlOLRVelChangeList=document.getElementById("ddlOLRVelChange");for(var i=0;i<8;i++){var amt=(i*5)+35;ddlOLRVelChangeList.options[i]=new Option(amt,amt);}break;case 51:ddlOLReportsName.innerHTML="Excessive Idling Report";divOLRIdle.innerHTML="<p class='whiteType10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Idle Period : "+"<input type='text' name='idleTime' id='idleTime' value='5' style='width:20px;'/>"+"<select name='ddlOLRIdlePeriod' id='ddlOLRIdlePeriod' style='width: 75px; background-color: white; color:#000000; visibility:inherit;' onchange='cleanMap(false);setViewType(false);' onclick='cleanMap(false);setViewType(false);'></select>"+"</p>";ddlOLRIdlePeriodList=document.getElementById("ddlOLRIdlePeriod");ddlOLRIdlePeriodList.options[0]=new Option("Minutes","1");ddlOLRIdlePeriodList.options[1]=new Option("Seconds","2");ddlOLRIdlePeriodList.options[2]=new Option("Hours","3");break;case 52:ddlOLReportsName.innerHTML="Master Listing Report";break;case 53:ddlOLReportsName.innerHTML="PTO Switches Report";break;case 54:ddlOLReportsName.innerHTML="Speeding Alert Report";break;case 55:ddlOLReportsName.innerHTML="Standard Report";break;case 56:ddlOLReportsName.innerHTML="Vehicle Mileage Report";break;case 57:ddlOLReportsName.innerHTML="Vehicle Operating Report";break;case 58:ddlOLReportsName.innerHTML="Mileage by State Report";break;case 59:ddlOLReportsName.innerHTML="Speeding Report";divOLRIdle.innerHTML="<p class='whiteType10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Speed greater than : "+"<input type='text' name='txtSpeed' id='txtSpeed' value='65' style='width:20px;'/>"+"</p>";break;case 60:ddlOLReportsName.innerHTML="Start/Stop Report";divOLRVelocityChange.innerHTML="<p class='whiteType10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='rptType' id='rptIgnition' value='Ignition' onclick='ssOrReportTypeClicked();'/> Ignition"+"<input type='radio' name='rptType' id='rptMovenemt' value='Movement' onclick='ssOrReportTypeClicked()' checked='checked'/>"+"Movement</td>"+"</p>";divOLRIdle.innerHTML="<p class='whiteType10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Minimum Stop Time :&nbsp;"+"<input type='text' name='precisionValue'id='precisionValue' style='width=20px' value='5'/>"+"&nbsp;"+"<select name='precisionType' id='precisionType' style='width: 75px; background-color: white; color:#000000; visibility:inherit;' onchange='cleanMap(false);setViewType(false);' onclick='cleanMap(false);setViewType(false);'></select>"+"</p>";precisionList=document.getElementById("precisionType");precisionList.options[0]=new Option("Minutes","1");precisionList.options[1]=new Option("Seconds","2");precisionList.options[2]=new Option("Hours","3");break;}ddldivOLRVehicles=document.getElementById("divOLRVehicles");var currentDate=new Date();var month=currentDate.getMonth()+1;var day=currentDate.getDate();var year=currentDate.getFullYear();document.getElementById("txtStartDate").value=month+"/"+day+"/"+year;document.getElementById("txtEndDate").value=month+"/"+day+"/"+year;document.getElementById("startHours").value="00";document.getElementById("startMins").value="00";document.getElementById("startSec").value="00";document.getElementById("endHours").value="23";document.getElementById("endMins").value="59";document.getElementById("endSec").value="59";m_divOLROverlay=null;m_divOLROverlay=document.getElementById("divOfflineReportsOverlay");m_divOLROverlay.style.marginTop=parseInt(0);m_divOLROverlay.style.position="absolute";m_divOLROverlay.style.top="5px";m_divOLROverlay.style.left="-220px";OLReMail=document.getElementById("ddlOLReMail");if(email!=null&&email.value!=null){OLReMail.value=email.value;}var divOLRVelocityChange=document.getElementById("divOLRVelocityChange");divOLRVelocityChange.style.visibility="hidden";ddldivOLRIdle.style.visibility="hidden";ddldivOLRVehicles.style.visibility="visible";var divSpeed=document.getElementById("divSpeed");switch(offlineReportType){case 50:divOLRVelocityChange.style.visibility="visible";break;case 51:divOLRIdle.style.visibility="visible";break;case 52:break;case 53:break;case 54:ddldivOLRVehicles.style.visibility="hidden";break;case 55:break;case 56:break;case 57:break;case 58:break;case 59:ddldivOLRVehicles.style.visibility="hidden";divOLRIdle.style.visibility="visible";break;case 60:divOLRVelocityChange.style.visibility="visible";divOLRIdle.style.visibility="visible";break;}bj("divOfflineReportsOverlay");};function bC(){aF("divOfflineReportsOverlay");};function fd(){var reportNumber=offlineReportType;var startParam=null;var endParam=null;var vehicleId=0;var speedParam=0;var minStopTime=0;var ByIgnition=false;var ddlOLVehicleID=document.getElementById("ddlOLRVehicles").value;if(ddlOLVehicleID!="-1"){vehicleId=ddlOLVehicleID;}var startDate=document.getElementById("txtStartDate").value;var endDate=document.getElementById("txtEndDate").value;if(startDate==null||startDate==''){AlertMessage("Please select start date.");return false;}if(endDate==null||endDate==''){AlertMessage("Please select end date.");return false;}var dtStartHr=document.getElementById("startHours").value;while(dtStartHr.length<2){dtStartHr="0"+dtStartHr;}var dtStartMin=document.getElementById("startMins").value;while(dtStartMin.length<2){dtStartMin="0"+dtStartMin;}var dtStartSec=document.getElementById("startSec").value;while(dtStartSec.length<2){dtStartSec="0"+dtStartSec;}var dtFromDate=new Date(startDate+' '+dtStartHr+':'+dtStartMin+':'+dtStartSec);dtEndHr=document.getElementById("endHours").value;while(dtEndHr.length<2){dtEndHr="0"+dtEndHr;}dtEndMin=document.getElementById("endMins").value;while(dtEndMin.length<2){dtEndMin="0"+dtEndMin;}dtEndSec=document.getElementById("endSec").value;while(dtEndSec.length<2){dtEndSec="0"+dtEndSec;}var dtToDate=new Date(endDate+' '+dtEndHr+':'+dtEndMin+':'+dtEndSec);if(dtFromDate>dtToDate){AlertMessage("Start date must be before the end date.");return false;}ddlTimeZone=document.getElementById("ddlTimeZone");switch(reportNumber){case 50:var velChange=document.getElementById("ddlOLRVelChange").value;parms+=vehicleId+"~"+velChange+"~";break;case 51:var idleTime=document.getElementById("idleTime").value;var idlePeriod=document.getElementById("ddlOLRIdlePeriod").value;switch(idlePeriod){case "1":idlePeriod="M";break;case "2":idlePeriod="S";break;case "3":idlePeriod="H";break;}break;case 52:break;case 53:break;case 54:break;case 55:break;case 56:break;case 57:break;case 58:break;case 59:speedparam=document.getElementById("txtSpeed").value;break;case 60:rpt_IgnitionMovement=document.getElementById("rptIgnition");minStopTime=document.getElementById("precisionValue").value;if(rpt_IgnitionMovement.checked){minStopTime=0;ByIgnition=true;}else var idlePeriod=document.getElementById("precisionType").value;switch(idlePeriod){case "1":minStopTime=minStopTime*60;break;case "2":break;case "3":minStopTime=minStopTime*3600;break;}break}var parms=(dtFromDate.getMonth()+1)+"/"+dtFromDate.getDate()+'/'+dtFromDate.getFullYear()+' '+dtStartHr+':'+dtStartMin+':'+dtStartSec+'~'+(dtToDate.getMonth()+1)+"/"+dtToDate.getDate()+'/'+dtToDate.getFullYear()+' '+dtEndHr+':'+dtEndMin+':'+dtEndSec+'~';OLReMail=document.getElementById("ddlOLReMail").value;if(eW(OLReMail)==false){AlertMessage("It appears that you have entered an invalid e-mail address");document.getElementById("ddlOLReMail").focus();return;}switch(reportNumber){case 50:parms+=vehicleId+"~"+velChange+"~";break;case 51:parms+=idlePeriod+"~"+idleTime+"~";break;case 52:parms+=vehicleId+"~";break;case 53:parms+=vehicleId+"~";break;case 54:break;case 55:parms+=vehicleId+"~";break;case 56:parms+=vehicleId+"~";break;case 57:parms+=vehicleId+"~";break;case 58:parms+=vehicleId+"~";break;case 59:parms+=speedparam+"~";break;case 60:parms+=vehicleId+"~"+ByIgnition+"~"+minStopTime+"~";break;}parms+=ddlTimeZone.value+'~';reportNumber+='';Feed.IRptReq(m_CurrentUser,reportNumber,parms,OLReMail,"E",eo);};function eo(response){if(response.value==true){ActionCompleted("Your report request has been submitted");bC();}else{AlertMessage("Your report request has failed");}};function ac(direction,velocity){if(direction==0&&velocity==0){return "Stopped";}if(direction>348||direction<12){return "North";};if(direction>11&&direction<34){return "NNE";};if(direction>35&&direction<57){return "NE";};if(direction>56&&direction<79){return "ENE";};if(direction>78&&direction<102){return "East";};if(direction>101&&direction<124){return "ESE";};if(direction>123&&direction<147){return "SE";};if(direction>146&&direction<169){return "SSE";};if(direction>168&&direction<192){return "South";};if(direction>191&&direction<214){return "SSW";};if(direction>213&&direction<237){return "SW";};if(direction>236&&direction<259){return "WSW";};if(direction>258&&direction<282){return "West";};if(direction>281&&direction<304){return "WNW";};if(direction>303&&direction<327){return "NW";};if(direction>328&&direction<349){return "NNW";};};function log(message){if(location.hostname=="localhost"){if(!log.window_||log.window_.closed){var win=window.open("",null,"width=400,height=200,"+"scrollbars=yes,resizable=yes,status=no,"+"location=no,menubar=no,toolbar=no");if(!win)return;var doc=win.document;doc.write("<html><head><title>Debug Log</title></head>"+"<body></body></html>");doc.close();log.window_=win;}var logLine=log.window_.document.createElement("div");logLine.appendChild(log.window_.document.createTextNode(message));log.window_.document.body.appendChild(logLine);}};function di(text){var ea=document.createElement("span");ea.setAttribute('font','arial');ea.setAttribute('fontsize','14');ea.innerHTML=text;document.body.appendChild(ea);var len=ea.offsetWidth;document.body.removeChild(ea);return len;};function dT(){aD();var searchFor=document.getElementById("TextSearch").value;if(searchFor!=null&&searchFor!=""){FindResultArray=new Array;map.Find(searchFor,null,null,null,null,20,true,true,true,true,ej);}};function ej(ShapeLayer,findResults,Place,HasMore,veErrorMessage){if(findResults!=null){eJ();FindResultArray=findResults;var resultstring="<font size='1' face='Arial'>";for(var i=0;i<findResults.length;i++){if(ResultInfo[i]!=object){var newLatLon=new VELatLong(45,-97);ResultInfo[i]=new VEShape(VEShapeType.Pushpin,newLatLon);map.AddShape(ResultInfo[i]);ResultInfo[i].Hide();}var lat=FindResultArray[i].LatLong.Latitude;var lon=FindResultArray[i].LatLong.Longitude;var originalPoint=map.LatLongToPixel(new VELatLong(lat,lon));newx=originalPoint.x+20;newy=originalPoint.y+5;pixel=new VEPixel(newx,newy);var newInfoLatLon=map.PixelToLatLong(pixel);var string="<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;"+FindResultArray[i].Name+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;"+FindResultArray[i].Description+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;"+FindResultArray[i].Phone+"<br />";var ckwidth="&nbsp<b>"+FindResultArray[i].Description;var wdth=ckwidth.length;var divInfoVar="<div style='color:white; font-family:arial; font-size:12px; background:URL(images/SearchResultPopUp.png) no-repeat top right Transparent; width:319px; height:109px;'>"+string+"</div>";ResultInfo[i].SetCustomIcon(divInfoVar);ResultInfo[i].SetPoints(newInfoLatLon);ResultInfo[i].Hide();ResultIds[i]=FindResultArray[i].Shape.GetId();FindResultArray[i].Shape.SetCustomIcon("images/redpushpin.gif");resultstring=resultstring+"&nbsp;<FONT COLOR='#00FFFF'>"+FindResultArray[i].Name+"</font><br />&nbsp;"+FindResultArray[i].Description+"<br />&nbsp;"+FindResultArray[i].Phone+"<br /><br/>"}findresults=null;var dsr=document.getElementById("divSR");dsr.innerHTML=resultstring;}};function scrollSearchUp(){ssup=true;sSearchUp();};function scrollSearchUpmup(){ssup=false;};function sSearchUp(){if(ssup==true){var dsr=document.getElementById("divSR");var ty=parseInt(dsr.style.top);ty=ty-2+"px";dsr.style.top=ty;setTimeout("sSearchUp()",(0));}};function scrollSearchDown(){ssdown=true;sSearchDown();};function scrollSearchDownmup(){ssdown=false;};function sSearchDown(){if(ssdown==true){var dsr=document.getElementById("divSR");var ty=parseInt(dsr.style.top);if(ty<0){ty=ty+2+"px";dsr.style.top=ty;setTimeout("sSearchDown()",(0));}else{ssdown=false;}}};function by(){if(vehicleToFollow==cars.Rows[lastClickedBox].s){vehicleToFollow=null;bn();}else{vehicleToFollow=cars.Rows[lastClickedBox].s;bn();}};function cn(){clearTimeout(t_followVehicle);vehicleToFollow=null;};function es(fieldname){var currentColor=fieldname.value;var colors=new Array("#000000","#000033","#000066","#000099","#0000CC","#0000FF","#330000","#330033","#330066","#330099","#3300CC","#3300FF","#660000","#660033","#660066","#660099","#6600CC","#6600FF","#990000","#990033","#990066","#990099","#9900CC","#9900FF","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#003300","#003333","#003366","#003399","#0033CC","#0033FF","#333300","#333333","#333366","#333399","#3333CC","#3333FF","#663300","#663333","#663366","#663399","#6633CC","#6633FF","#993300","#993333","#993366","#993399","#9933CC","#9933FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#006600","#006633","#006666","#006699","#0066CC","#0066FF","#336600","#336633","#336666","#336699","#3366CC","#3366FF","#666600","#666633","#666666","#666699","#6666CC","#6666FF","#996600","#996633","#996666","#996699","#9966CC","#9966FF","#CC6600","#CC6633","#CC6666","#CC6699","#CC66CC","#CC66FF","#FF6600","#FF6633","#FF6666","#FF6699","#FF66CC","#FF66FF","#009900","#009933","#009966","#009999","#0099CC","#0099FF","#339900","#339933","#339966","#339999","#3399CC","#3399FF","#669900","#669933","#669966","#669999","#6699CC","#6699FF","#999900","#999933","#999966","#999999","#9999CC","#9999FF","#CC9900","#CC9933","#CC9966","#CC9999","#CC99CC","#CC99FF","#FF9900","#FF9933","#FF9966","#FF9999","#FF99CC","#FF99FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#66CC00","#66CC33","#66CC66","#66CC99","#66CCCC","#66CCFF","#99CC00","#99CC33","#99CC66","#99CC99","#99CCCC","#99CCFF","#CCCC00","#CCCC33","#CCCC66","#CCCC99","#CCCCCC","#CCCCFF","#FFCC00","#FFCC33","#FFCC66","#FFCC99","#FFCCCC","#FFCCFF","#00FF00","#00FF33","#00FF66","#00FF99","#00FFCC","#00FFFF","#33FF00","#33FF33","#33FF66","#33FF99","#33FFCC","#33FFFF","#66FF00","#66FF33","#66FF66","#66FF99","#66FFCC","#66FFFF","#99FF00","#99FF33","#99FF66","#99FF99","#99FFCC","#99FFFF","#CCFF00","#CCFF33","#CCFF66","#CCFF99","#CCFFCC","#CCFFFF","#FFFF00","#FFFF33","#FFFF66","#FFFF99","#FFFFCC","#FFFFFF");var total=colors.length;var width=18;var cp_contents="";cp_contents+="<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1>";var use_highlight=(document.getElementById||document.all)?true:false;for(var i=0;i<total;i++){if((i%width)==0){cp_contents+="<TR>";}cp_contents+='<TD BGCOLOR="'+colors[i]+'"><FONT SIZE="-3"><A HREF=javaScript:af("'+colors[i]+'","'+fieldname.id+'"); STYLE="text-decoration:none;">&nbsp;&nbsp;&nbsp;</A></FONT></TD>';if(((i+1)>=total)||(((i+1)%width)==0)){cp_contents+="</TR>";}}if(document.getElementById){var width1=Math.floor(width/2);var width2=width=width1;cp_contents+="<TR><TD COLSPAN='"+width1+"' style='background-color:"+currentColor+"' id='colorPickerSelectedColor'>&nbsp;</TD><TD style='background-color:White;' COLSPAN='"+width2+"' ALIGN='CENTER' id='colorPickerSelectedColorValue'>"+currentColor+"</TD></TR>";}cp_contents+="</TABLE>";thisDiv=document.getElementById("divColours");thisDiv.innerHTML=cp_contents;};function af(color,fieldname){var parentTextBox=document.getElementById(fieldname);var colorPickerSelectedColor=document.getElementById("colorPickerSelectedColor");var colorPickerSelectedColorValue=document.getElementById("colorPickerSelectedColorValue");colorPickerSelectedColorValue.innerText=color;colorPickerSelectedColor.style.backgroundColor=color;parentTextBox.value=color.substring(1,7);};function ak(){var vehicleActionPane=document.getElementById("divVehicleAction");var colorPopLeft=0;var colorPopTop=0;m_divROverlay=document.getElementById("divColorPopOverLay");m_divROverlay.style.marginTop=parseInt(0);m_divROverlay.style.marginLeft=parseInt(1);m_divROverlay.style.zIndex=999;colorPopTop=parseInt(vehicleActionPane.style.top);colorPopTop-=148;m_divROverlay.style.top=colorPopTop.toString()+"px";colorPopLeft=parseInt(vehicleActionPane.style.left);colorPopLeft+=160;m_divROverlay.style.left=colorPopLeft.toString()+"px";gM();};function gM(){bj("divColorPopOverLay");};function bR(){aF("divColorPopOverLay");};function gf(){var agt=navigator.userAgent.toLowerCase();if(agt.indexOf("opera")!= -1)return 'opera';if(agt.indexOf("staroffice")!= -1)return 'star office';if(agt.indexOf("webtv")!= -1)return 'webtv';if(agt.indexOf("beonex")!= -1)return 'beonex';if(agt.indexOf("chimera")!= -1)return 'chimera';if(agt.indexOf("netpositive")!= -1)return 'netpositive';if(agt.indexOf("phoenix")!= -1)return 'phoenix';if(agt.indexOf("firefox")!= -1)return 'firefox';if(agt.indexOf("safari")!= -1)return 'safari';if(agt.indexOf("skipstone")!= -1)return 'skipstone';if(agt.indexOf("msie")!= -1)return 'internet explorer';if(agt.indexOf("netscape")!= -1)return 'netscape';if(agt.indexOf("mozilla/5.0")!= -1)return 'mozilla';if(agt.indexOf('\/')!= -1){if(agt.substr(0,agt.indexOf('\/'))!='mozilla'){return navigator.userAgent.substr(0,agt.indexOf('\/'));}else return 'netscape';}else if(agt.indexOf(' ')!= -1)return navigator.userAgent.substr(0,agt.indexOf(' '));else return navigator.userAgent;};function hc(){if(m_bLoggedIn){m_divROverlay=null;var tStartLoc=document.getElementById("rStartLoc");m_divROverlay=document.getElementById("divRoutingPopOverlay");m_divROverlay.style.marginTop=parseInt(0);m_divROverlay.style.position="absolute";m_divROverlay.style.top="5px";m_divROverlay.style.left="-220px";bj("divRoutingPopOverlay");tStartLoc.focus=true;}else{AlertMessage("You must be logged in to use this feature.");}};function bA(){aF("divRoutingPopOverlay");};function dU(){bE();vloader_src=document.getElementById("vRouting");if(vloader_src!=null)vloader_src.src=cached_loader.src;locs=new Array();var routeLoc=document.getElementById("rStartLoc");if(routeLoc.value==null||routeLoc.value==""){AlertMessage("You must enter a starting location.");return;}locs[0]=routeLoc.value;var locSub=1;for(var i=1;i<16;i++){routeLoc=document.getElementById("rStop"+i);if(routeLoc.value!=null&&routeLoc.value!=""){locs[locSub]=routeLoc.value;locSub++;}}routeLoc=document.getElementById("rEndLoc");if(routeLoc.value!=null&&routeLoc.value!=""){locs[locSub]=routeLoc.value;}else{locs[locSub]=locs[0];routeLoc.value=locs[0];}if(locs[0]==locs[locSub]&&locs[2]==null){AlertMessage("If start and end are the same, at least one 'Stop' is required");return;}if(locs.length<4){J(locs);return;}ckNoOptimize=document.getElementById("ckNoOptimize");if(ckNoOptimize.checked==true){J(locs);return;}latlonlocs=new Array();rSub1=0;bw();};function bw(){if(rSub1>=locs.length){for(var i=1;i<locs.length-2;i++){var distance=99999;for(var j=i+1;j<locs.length-1;j++){var tdistance=V(latlonlocs[i].Latitude,latlonlocs[i].Longitude,latlonlocs[j].Latitude,latlonlocs[j].Longitude);if(tdistance<distance){var temp=latlonlocs[i];latlonlocs[i]=latlonlocs[j];latlonlocs[j]=temp;distance=tdistance;}}}J(latlonlocs);return;}map.Find(null,locs[rSub1],null,null,null,null,false,false,null,false,av);};function av(layer,resultsArray,places,hasMore,veErrorMessage){var place=places[0].LatLong;latlonlocs[rSub1]=new VELatLong(place.Latitude,place.Longitude,0,VEAltitudeMode.Default);rSub1++;bw();};function V(lat1,lon1,lat2,lon2){var R=6371;var dLat=C(lat2-lat1);var dLon=C(lon2-lon1);var a=Math.sin(dLat/2)*Math.sin(dLat/2)+Math.cos(C(lat1))*Math.cos(C(lat2))*Math.sin(dLon/2)*Math.sin(dLon/2);var c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));var d=R*c;d=d*0.621371192;return d;};function C(deg){var rad=deg*Math.PI/180;return rad;};function J(locs){bj("divCalculatingRoute");bA();var options=new VERouteOptions;options.RouteCallback=gE;options.RouteOptimize=VERouteOptimize.Default;ckTime=document.getElementById("ckTime");ckDistance=document.getElementById("ckDistance");if(ckTime.checked==true){options.RouteOptimize=VERouteOptimize.MinimizeTime;}if(ckDistance.checked==true){options.RouteOptimize=VERouteOptimize.MinimizeDistance;}options.ShowDisambiguation=false;options.RouteColor=new VEColor(255,0,100,0.6);options.RouteWeight=6;map.GetDirections(locs,options);};function gE(route){turns="<h3>Turn-by-Turn Directions</h3>";turns+="<p class='whiteType10')><b>Distance:</b> "+route.Distance.toFixed(1)+" miles";turns+="<br/><b>Time:</b> "+bq(route.Time)+"</p>";var legs=route.RouteLegs;var leg=null;var turnNum=0;for(var i=0;i<legs.length;i++){leg=legs[i];var legNum=i+1;turns+="<br/><b>Distance for leg "+legNum+":</b> "+leg.Distance.toFixed(1)+" miles"+"<br/><b>Time for leg "+legNum+":</b> "+bq(leg.Time)+"<br/><br/>";var turn=null;var legDistance=null;for(var j=0;j<leg.Itinerary.Items.length;j++){turnNum++;turn=leg.Itinerary.Items[j];turns+="<b>"+turnNum+"</b>\t"+turn.Text;legDistance=turn.Distance;if(legDistance>0){turns+=" ("+legDistance.toFixed(1)+" miles";if(turn.Time!=null){turns+="; "+bq(turn.Time);}turns+=")<br/><br/>";}}turns+="<br/></style>";}aF("divCalculatingRoute");m_divROverlay=document.getElementById("TurnByTurnContent");m_divROverlay.innerHTML+=turns;bj("TurnByTurn");};function cD(){aF("TurnByTurn");};function bq(time){if(time==null){return("");}if(time>60){var seconds=time%60;var minutes=time-seconds;minutes=minutes/60;if(minutes>60){var minLeft=minutes%60;var hours=minutes-minLeft;hours=hours/60;return(hours+" hour(s), "+minLeft+" minute(s), "+seconds+" second(s)");}else{return(minutes+" minutes, "+seconds+" seconds");}}else{return(time+" seconds");}};function bE(){map.DeleteRoute();};function fe(){var ckNoOpt=document.getElementById("ckNoOptimize");if(ckNoOpt.checked==true){var ckDistance=document.getElementById("ckDistance");ckDistance.checked=false;var ckTime=document.getElementById("ckTime");ckTime.checked=false;}};function eZ(){var ckTime=document.getElementById("ckTime");if(ckTime.checked==true){var ckDistance=document.getElementById("ckDistance");ckDistance.checked=false;var ckNoOpt=document.getElementById("ckNoOptimize");ckNoOpt.checked=false;}};function ff(){var ckDistance=document.getElementById("ckDistance");if(ckDistance.checked==true){var ckTime=document.getElementById("ckTime");ckTime.checked=false;var ckNoOpt=document.getElementById("ckNoOptimize");ckNoOpt.checked=false;}};function eu(e){if(e.elementID!=null){if(m_bViewHistory){historyInfoBox.Hide();return;}for(var i=0;i<PinIds.length;i++){if(e.elementID.substring(0,PinIds[i].length)==PinIds[i]){clickedOnSerial=cars.Rows[i].s;infoBoxes[i].hide;lastClickedBox=i;dV(i);break;}}}};function et(e){if(!ControlPanelLockout){if(e.elementID!=null){dragShape=map.GetShapeByID(e.elementID);dragShapeTitle=dragShape.GetTitle();if(dragShapeTitle==NewAddressMarker||dragShapeTitle==DestinationMarker){var pixel=map.LatLongToPixel(new VELatLong(dragShape.Latitude,dragShape.Longitude));xoffset=e.mapX-pixel.x;yoffset=e.mapY-pixel.y;}else if(m_AddressList!=null){for(var i=0;i<m_AddressList.Rows.length;i++){if(m_AddressList.Rows[i].name==dragShapeTitle){var pixel=map.LatLongToPixel(new VELatLong(dragShape.Latitude,dragShape.Longitude));xoffset=e.mapX-pixel.x;yoffset=e.mapY-pixel.y;break;}}}else{for(var i=0;i<cars.Rows.length;i++){if(dragShapeTitle==cars.Rows[i].s){dragShape=null;break;}}}return true;}}};function eB(e){if(dragShape!=null){var x=e.mapX;var y=e.mapY;pixel=new VEPixel(x,y);if(dragShapeTitle=="fenceUL"){var LL=map.PixelToLatLong(pixel);pixel=new VEPixel(e.mapX,e.mapY+15);LL=map.PixelToLatLong(pixel);m_fenceLatUL=LL.Latitude;m_fenceLonUL=LL.Longitude;P();}else if(dragShapeTitle=="fenceLR"){var LL=map.PixelToLatLong(pixel);pixel=new VEPixel(e.mapX,e.mapY+15);LL=map.PixelToLatLong(pixel);m_fenceLatLR=LL.Latitude;m_fenceLonLR=LL.Longitude;P();}else if(dragShapeTitle==NewAddressMarker){pixel=new VEPixel(x-xoffset,y-yoffset);var LL=map.PixelToLatLong(pixel);dragShape.SetPoints(LL);pixel=new VEPixel(x,y);var LL=map.PixelToLatLong(pixel);address_lat=document.getElementById("addressLAT");address_lon=document.getElementById("addressLON");address_lat.value=LL.Latitude;address_lon.value=LL.Longitude;}else if(dragShapeTitle==DestinationMarker){pixel=new VEPixel(x-xoffset,y-yoffset);var LL=map.PixelToLatLong(pixel);dragShape.SetPoints(LL);pixel=new VEPixel(x,y);var LL=map.PixelToLatLong(pixel);}else if(m_AddressList!=null){for(var i=0;i<m_AddressList.Rows.length;i++){if(m_AddressList.Rows[i].name==dragShapeTitle){for(var j=0;j<MarkerNames.Rows.length;j++){if(MarkerNames.Rows[j].image==m_AddressList.Rows[i].image){pixel=new VEPixel(x-MarkerNames.Rows[j].X_center,y-MarkerNames.Rows[j].Y_center);var LL=map.PixelToLatLong(pixel);dragShape.SetPoints(LL);pixel=new VEPixel(x,y);var LL=map.PixelToLatLong(pixel);address_lat=document.getElementById("addressLAT");address_lon=document.getElementById("addressLON");address_lat.value=LL.Latitude;address_lon.value=LL.Longitude;break;}}}}}else if(dragShapeTitle!=""){var LL=map.PixelToLatLong(pixel);dragShape.SetPoints(LL);}}};function eH(e){if(PlayingVaporTrail!=true){if(e.elementID!=null){if(m_bViewHistory){historyInfoBox.Show();}else{for(var i=0;i<PinIds.length;i++){if(e.elementID.substring(0,PinIds[i].length)==PinIds[i]){infoBoxes[i].Show();}else{infoBoxes[i].Hide();}}for(var i=0;i<FindResultArray.length;i++){if(e.elementID.substring(0,ResultIds[i].length)==ResultIds[i]){ResultInfo[i].Show();}else{ResultInfo[i].Hide();}}var theShape=map.GetShapeByID(e.elementID);var theShapeTitle=theShape.GetTitle();for(var i=0;i<m_AddressList.Rows.length;i++){if(theShapeTitle==m_AddressList.Rows[i].name){addrInfoBox[i].Hide();var originalPoint=map.LatLongToPixel(new VELatLong(m_AddressList.Rows[i].lat*1,m_AddressList.Rows[i].lon*1));newx=originalPoint.x+50;newy=originalPoint.y-5;pixel=new VEPixel(newx,newy);var newLatLon=map.PixelToLatLong(pixel);addrInfoBox[i].SetPoints(newLatLon);addrInfoBox[i].Show();addrInfoBoxTimer=setTimeout("bY()",5000);}else{addrInfoBox[i].Hide();}}}return true;}}};function eG(e){};function eI(e){if(dragShape!=null){if(dragShapeTitle!="fenceUL"&&dragShapeTitle!="fenceLR"){var name=dragShapeTitle;var lat=dragShape.Latitude+"";var lon=dragShape.Longitude+"";if(dragShapeTitle!=NewAddressMarker){Feed.UAddr(m_CurrentUser,name,lat,lon,gn);}}if(dragShapeTitle==DestinationMarker){var lat=dragShape.Latitude+"";var lon=dragShape.Longitude+"";var originalPoint=map.LatLongToPixel(new VELatLong(lat,lon));var newLatLon=map.PixelToLatLong(new VEPixel(originalPoint.x+25,originalPoint.y+25));lat=newLatLon.Latitude;lon=newLatLon.Longitude;Feed.MpPntRvGeo(lat,lon,aj);rLat=lat;rLon=lon;}}dragShape=null;dragShapetiele=null;};function ci(result){MarkerNames=new Array();if(result!=null){MarkerNames=result.value;}gn();};function addressSelected(){if(!m_demoUser||demo2_user){addressListSelection=document.getElementById("ddlAddressList");if(addressListSelection!=null){if(addressListSelection.options.selectedIndex>=0){addressListValue=addressListSelection.options[addressListSelection.options.selectedIndex].value;Feed.SAcctAdr(addressListValue,ao);}}else AlertMessage("No address list could be found.");}};function ao(retAddress){if(retAddress!=null){if(retAddress.value!=null){dt=retAddress.value;if(dt!=null&&typeof(dt)=="object"){if(dt.Rows.length>0){aname=document.getElementById("addressName");lat=document.getElementById("addressLAT");lon=document.getElementById("addressLON");address_text=document.getElementById("txtAddressFind");AddrMarkerImage=document.getElementById("AddrMarkerImage");AddrMarkerImage.src="Images/AddressMarkers/"+dt.Rows[0].image;aname.value=dt.Rows[0].name;lat.value=dt.Rows[0].lat;lon.value=dt.Rows[0].lon;address_text.value=dt.Rows[0].address;var center=new VELatLong(dt.Rows[0].lat,dt.Rows[0].lon);map.SetCenter(center);gq(1);}}}}};function removeAddressMarkers(){if(NewAddressMarkerPresent){NewAddressPin.Hide();map.DeleteShape(NewAddressPin);NewAddressMarkerPresent=false;}for(i=0;i<MapAddresspins.length;i++){if(MapAddresspins[i]!=null){MapAddresspins[i].Hide();addrInfoBox[i].Hide();}}MapAddresspins=new Array();addrInfoBox=new Array();};function bY(){clearTimeout(addrInfoBoxTimer);for(i=0;i<addrInfoBox.length;i++){addrInfoBox[i].Hide();}};function gn(){Feed.SAddr(m_CurrentUser,gF);};function gF(data){removeAddressMarkers();if(data!=null){if(data.value!=null){m_AddressList=data.value;var ddlAddressList=document.getElementById("ddlAddressList");ddlAddressList.options.length=0;for(i=0;i<m_AddressList.Rows.length;i++){var image="Standard.png";var x_offset= -15;var y_offset= -15;ddlAddressList.options[i]=new Option(m_AddressList.Rows[i].name,m_AddressList.Rows[i].id);if(m_AddressList.Rows[i].image!=null&&m_AddressList.Rows[i].image!=""){image=m_AddressList.Rows[i].image.toString();}for(var j=0;j<MarkerNames.Rows.length;j++){if(MarkerNames.Rows[j].image==image){x_offset=MarkerNames.Rows[j].X_center;y_offset=MarkerNames.Rows[j].Y_center;break;}}var imgloc="images/AddressMarkers/"+image;var originalPoint=map.LatLongToPixel(new VELatLong(m_AddressList.Rows[i].lat*1,m_AddressList.Rows[i].lon*1));newx=originalPoint.x+x_offset;newy=originalPoint.y+y_offset;pixel=new VEPixel(newx,newy);var newLatLon=map.PixelToLatLong(pixel);MapAddresspins[i]=new VEShape(VEShapeType.Pushpin,newLatLon);map.AddShape(MapAddresspins[i]);MapAddresspins[i].SetTitle(m_AddressList.Rows[i].name);MapAddresspins[i].SetCustomIcon(imgloc);MapAddresspins[i].ShowIcon();newx=originalPoint.x+50;newy=originalPoint.y-5;pixel=new VEPixel(newx,newy);var newInfoLatLon=map.PixelToLatLong(pixel);addrInfoBox[i]=new VEShape(VEShapeType.Pushpin,newInfoLatLon);addrInfoBox[i].Hide();map.AddShape(addrInfoBox[i]);var string="<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;"+m_AddressList.Rows[i].name+"<br />"+"&nbsp;&nbsp;&nbsp;&nbsp;"+m_AddressList.Rows[i].address+"<br />";var theaddress=m_AddressList.Rows[i].address;var addrname=m_AddressList.Rows[i].name;var addressid=m_AddressList.Rows[i].id;var arrivalMin=m_AddressList.Rows[i].nextarrival;if(arrivalMin=="999"){arrivalMin="";}else{if(arrivalMin=="1"){string+="Next bus in "+arrivalMin+" minute"}else{string+="Next bus in "+arrivalMin+" minutes"}}var divInfoVar="<div style='color:white; font-family:arial; font-size:12px; background:URL(images/AddressMarkerPopUp.png) no-repeat top right Transparent; width:319px; height:109px;'>"+string+"</div>";addrInfoBox[i].SetCustomIcon(divInfoVar);addrInfoBox[i].ShowIcon();addrInfoIds[i]=MapAddresspins[i].GetId();}}}gO();};function ii(){var point=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(m_gMap.fromDivPixelToLatLng(new GPoint(0,0),true),m_gMap.getZoom());var offset=m_gMap.getCurrentMapType().getProjection().fromLatLngToPixel(this.getPoint(),m_gMap.getZoom());var anchor=this.getIcon().iconAnchor;var width=this.getIcon().iconSize.width;var pos=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(offset.x-point.x-anchor.x+width+INFOPANE_OFFSET_X,offset.y-point.y-anchor.y+INFOPANE_OFFSET_Y));pos.apply(this.infoPane);this.infoPane.style.display="block";};function dn(){this.infoPane.style.display="none";};function aV(){if(m_demoUser||demo2_user){AlertMessage("Sorry,this feature has been disabled in demonstration mode.");return;}address_text=document.getElementById("txtAddressFind");address_name=document.getElementById("addressName");address_lat=document.getElementById("addressLAT");address_lon=document.getElementById("addressLON");if(address_name.value==""||address_name==null||address_name.value=="New Address Marker"){AlertMessage("Name is required");return;}if(address_lat.value==""||address_lat==null||address_lon.value==""||address_lon==null||address_lat.value*1==0||address_lon.value*1==0){AlertMessage("LAT:LON is required");return;}if(address_text.value==""||address_text==null||address_text.value=="1234 Street Name City,State"){AlertMessage("Address is required");return;}if(!dB(address_lat.value)|| !dB(address_lat.value)){AlertMessage("LAT:LON is invalid");return;}address_image=document.getElementById("AddrMarkerImage");var images=address_image.src.split("/");var image="Standard.png";for(var i=images.length;i> -1;i--){if(images[i]!=""&&images[i]!=null){image=images[i];break;}}Feed.IAddr(m_CurrentUser,address_name.value,address_lat.value,address_lon.value,address_text.value,image,gn)};function fj(){if(m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}addressList=document.getElementById("ddlAddressList");if(addressList.options.selectedIndex>=0){selectedValue=addressList.options[addressList.options.selectedIndex].value;Feed.DAddr(selectedValue,m_CurrentUser,gn);}};function gq(id){if(id== -1){alertPanel=document.getElementById("addressAdd");alertPanel.style.visibility="hidden";alertPanel.style.display="none";alertPanel=document.getElementById("addressRemove");alertPanel.style.visibility="hidden";alertPanel.style.display="none";m_SelectPoint=false;}if(id==1){alertPanel=document.getElementById("addressAdd");alertPanel.style.visibility="visible";alertPanel.style.display="inline";alertPanel=document.getElementById("addressRemove");alertPanel.style.visibility="hidden";alertPanel.style.display="none";m_SelectPoint=true;}if(id==2){oalertPanel=document.getElementById("addressAdd");oalertPanel.style.visibility="hidden";oalertPanel.style.display="none";alertPanel=document.getElementById("addressRemove");alertPanel.style.visibility="visible";alertPanel.style.display="inline";var List=document.getElementById("ddlAddressList");if(List.selectedIndex!= -1){var table=document.getElementById("addressSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("noAddressSelected");table.style.display="none";table.style.visibility="hidden";}else{var table=document.getElementById("noAddressSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("addressSelected");table.style.display="none";table.style.visibility="hidden";}m_SelectPoint=false;}if(id==3){if(NewAddressMarkerPresent!=true){var center=map.GetCenter();alertPanel=document.getElementById("addressAdd");alertPanel.style.visibility="visible";alertPanel.style.display="inline";alertPanel=document.getElementById("addressRemove");alertPanel.style.visibility="hidden";alertPanel.style.display="none";address_text=document.getElementById("txtAddressFind");address_name=document.getElementById("addressName");address_lat=document.getElementById("addressLAT");address_lon=document.getElementById("addressLON");address_name.value=NewAddressMarker;address_lat.value=center.Latitude;address_lon.value=center.Longitude;address_text.value="1234 Street Name City,State";AddrMarkerImage=document.getElementById("AddrMarkerImage");AddrMarkerImage.src="Images/AddressMarkers/Standard.png";var pixel=map.LatLongToPixel(center);pixel.x=pixel.x-16;pixel.y=pixel.y-16;var LL=map.PixelToLatLong(pixel);var imgloc="images/NewTarget.gif";NewAddressPin=new VEShape(VEShapeType.Pushpin,LL);NewAddressPin.SetTitle(NewAddressMarker);NewAddressPin.SetCustomIcon(imgloc);map.AddShape(NewAddressPin);NewAddressMarkerPresent=true;}}};function hB(){Feed.SAdrMrk(cW);};function cW(result){if(result!=null){MarkerNames=result.value;var divInfo="<table style='vertical-align:top;'><tr valign='top' align='center'>";for(var i=0;i<MarkerNames.Rows.length;i++){if(MarkerNames.Rows[i].image!=null&&MarkerNames.Rows[i].image!=""){divInfo+="<td valign='top' width='70px' height='60px' style='cursor:pointer;'><img alt='' valign='top' onclick='useAddressMarkerIcon("+i+");' src='images/AddressMarkers/"+MarkerNames.Rows[i].image+"' /></td>";var j=(i+1)%8;if(j==0){divInfo+="</tr><tr valign='top' align='center'>";}}}divInfo+="</tr></table>";divInfo+="<div class='whiteType10' style'text-align:center; width:400px;'><br />&nbsp;&nbsp;&nbsp;More address marker icons coming soon!</div>";var divIconSelector=document.getElementById("divAddressMarkerOverlay");divIconSelector.innerHTML=divInfo;m_divIOverlay=null;m_divIOverlay=document.getElementById("divAddressMarkerSelectorOverlay");bj("divAddressMarkerSelectorOverlay");m_alertdiv=document.getElementById("divAddressesOverlay");m_alertdiv.style.visibility="hidden";m_alertdiv.style.display="none";}};function bZ(){aF("divAddressMarkerSelectorOverlay");m_actiondiv=document.getElementById("divAddressesOverlay");m_actiondiv.style.visibility="visible";m_actiondiv.style.display="block";};function useAddressMarkerIcon(id){if(ControlPanelLockout==true||m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}var AddrMarkerToUse=MarkerNames.Rows[id].image;var AddressMarkerImage=document.getElementById("AddrMarkerImage");AddressMarkerImage.src="images/AddressMarkers/"+AddrMarkerToUse;bZ();};function P(){if(m_drawingFence==true){map.DeleteAllPolygons();var points=new Array(new VELatLong(m_fenceLatUL,m_fenceLonUL),new VELatLong(m_fenceLatUL,m_fenceLonLR),new VELatLong(m_fenceLatLR,m_fenceLonLR),new VELatLong(m_fenceLatLR,m_fenceLonUL),new VELatLong(m_fenceLatUL,m_fenceLonUL));var PId=1;poly=new VEPolygon(PId,points);poly.SetOutlineWidth(1);poly.SetOutlineColor(new VEColor(0,0,0,1.0));poly.SetFillColor(new VEColor(255,128,128,0.5));map.AddPolygon(poly);if(fenceUL!=null){map.DeleteShape(fenceUL);fenceUL=null;}if(fenceLR!=null){map.DeleteShape(fenceLR);fenceLR=null;}var originalPoint=map.LatLongToPixel(new VELatLong(m_fenceLatUL,m_fenceLonUL));var newNameLatLon=map.PixelToLatLong(new VEPixel(originalPoint.x+8,originalPoint.y-8));fenceUL=new VEShape(VEShapeType.Pushpin,newNameLatLon);fenceUL.SetCustomIcon("images/redpushpin.gif");fenceUL.SetDescription("Drag me around the map");fenceUL.SetTitle("fenceUL");map.AddShape(fenceUL);fenceUL.SetZIndex(1100,1100);fenceUL.Show();originalPoint=map.LatLongToPixel(new VELatLong(m_fenceLatLR,m_fenceLonLR));newNameLatLon=map.PixelToLatLong(new VEPixel(originalPoint.x+8,originalPoint.y-8));fenceLR=new VEShape(VEShapeType.Pushpin,newNameLatLon);fenceLR.SetCustomIcon("images/redpushpin.gif");fenceLR.SetDescription("Drag me around the map too");fenceLR.SetTitle("fenceLR");map.AddShape(fenceLR);fenceLR.SetZIndex(1100,1100);fenceLR.Show();}};function aS(){var latCenter=(m_fenceLatUL*1+m_fenceLatLR*1)/2;var lonCenter=(m_fenceLonUL*1+m_fenceLonLR*1)/2;var center=new VELatLong(latCenter,lonCenter);map.SetCenter(center);points=new Array;points[0]=new VELatLong(m_fenceLatUL,m_fenceLonUL);points[1]=new VELatLong(m_fenceLatLR,m_fenceLonLR);map.SetMapView(points);};function alertSelected(){if(AlertEditorOpen){if(!m_demoUser||demo2_user){alertListSelection=document.getElementById("ddlAlertList");if(alertListSelection!=null){if(alertListSelection.options.selectedIndex>=0){alertListValue=alertListSelection.options[alertListSelection.options.selectedIndex].value;Feed.SSngAlrt(alertListValue,bd);}}else{AlertMessage("null alert list");}}}};function bd(retAlert){if(!AlertEditorOpen){return;}if(retAlert!=null){if(retAlert.value!=null){dt=retAlert.value;if(dt!=null&&typeof(dt)=="object"){if(dt.Rows.length>0){if(dt.Rows[0].type=="G"){gQ();vehicleSelection=document.getElementById("ddlVehicleZoneAlert");zoneName=document.getElementById("zoneName");startHour=document.getElementById("ZSTRTH");startMin=document.getElementById("ZSTRTM");endHour=document.getElementById("ZENDH");endMin=document.getElementById("ZENDM");zEnter=document.getElementById("ZENTER");zExit=document.getElementById("ZEXIT");smscheck=document.getElementById("SMSCHECKGF");emailcheck=document.getElementById("EMAILCHECKGF");smstarget=document.getElementById("SMSTARGETGF");SMSProvider=document.getElementById("SMSPROVIDERGF");emailtarget=document.getElementById("EMAILTARGETGF");zoneName.value=dt.Rows[0].name;for(i=0;i<vehicleSelection.options.length;i++){if(vehicleSelection.options[i].value==dt.Rows[0].vehicle_id){vehicleSelection.selectedIndex=i;break;}}if(dt.Rows[0].Lo_Hour!=null){startHour.value=dt.Rows[0].Lo_Hour;}while(startHour.value.length<2){startHour.value="0"+startHour.value;}if(dt.Rows[0].Lo_Minute!=null){startMin.value=dt.Rows[0].Lo_Minute;}while(startMin.value.length<2){startMin.value="0"+startMin.value;}if(dt.Rows[0].Hi_Hour!=null){endHour.value=dt.Rows[0].Hi_Hour;}while(endHour.value.length<2){endHour.value="0"+endHour.value;}if(dt.Rows[0].Hi_Minute!=null){endMin.value=dt.Rows[0].Hi_Minute;}while(endMin.value.length<2){endMin.value="0"+endMin.value;}if(endHour.value=="00"&&endMin.value=="00"){endHour.value="23";endMin.value="59";}if(dt.Rows[0].Enter_Zone==null||dt.Rows[0].Enter_Zone==true){zEnter.checked=true;}else{zEnter.checked=false;}if(dt.Rows[0].Exit_Zone==null||dt.Rows[0].Exit_Zone==true){zExit.checked=true;}else{zExit.checked=false;}if(dt.Rows[0].SMSEnabled=="1"){smscheck.checked=true;}else{smscheck.checked=false;}if(dt.Rows[0].EMAILEnabled=="1"){emailcheck.checked=true;}else{emailcheck.checked=false;}var sms=dt.Rows[0].sms;smsval=sms.split("@");smstarget.value=smsval[0];SMSProvider.value=smsval[1];emailtarget.value=dt.Rows[0].email;var latlng=dt.Rows[0].bbl;ltln=latlng.split(",");m_fenceLatUL=ltln[0];m_fenceLonUL=ltln[1];m_fenceLatLR=ltln[2];m_fenceLonLR=ltln[3];m_drawingFence=true;P();aS();}else if(dt.Rows[0].type=="S"){gj(2);zoneName=document.getElementById("zoneSpeedName");vehicleSelection=document.getElementById("ddlVehicleSpeedAlert");speed=document.getElementById("speedThreshold");smscheck=document.getElementById("SMSCHECKSZ");emailcheck=document.getElementById("EMAILCHECKSZ");SMSProvider=document.getElementById("SMSPROVIDERSZ");smstarget=document.getElementById("SMSTARGETSZ");emailtarget=document.getElementById("EMAILTARGETSZ");for(i=0;i<vehicleSelection.options.length;i++){if(vehicleSelection.options[i].value==dt.Rows[0].vehicle_id){vehicleSelection.selectedIndex=i;break;}}speed.value=""+dt.Rows[0].speed_threshold;zoneName.value=dt.Rows[0].name;if(dt.Rows[0].SMSEnabled=="1"){smscheck.checked=true;}else{smscheck.checked=false;}if(dt.Rows[0].EMAILEnabled=="1"){emailcheck.checked=true;}else{emailcheck.checked=false;}smstarget.value=dt.Rows[0].sms.substring(0,dt.Rows[0].sms.indexOf("@"));SMSProvider.value=dt.Rows[0].sms.substring(dt.Rows[0].sms.indexOf("@")+1);emailtarget.value=dt.Rows[0].email;}else if(dt.Rows[0].type=="P"){gj(4);panicName=document.getElementById("PANICNAME");smscheck=document.getElementById("SMSCHECKSP");emailcheck=document.getElementById("EMAILCHECKSP");smstarget=document.getElementById("SMSTARGETSP");SMSProvider=document.getElementById("SMSPROVIDERSP");emailtarget=document.getElementById("EMAILTARGETSP");panicName.value=dt.Rows[0].name;if(dt.Rows[0].SMSEnabled=="1"){smscheck.checked=true;}else{smscheck.checked=false;}if(dt.Rows[0].EMAILEnabled=="1"){emailcheck.checked=true;}else{emailcheck.checked=false;}smstarget.value=dt.Rows[0].sms.substring(0,dt.Rows[0].sms.indexOf("@"));SMSProvider.value=dt.Rows[0].sms.substring(dt.Rows[0].sms.indexOf("@")+1);emailtarget.value=dt.Rows[0].email;}else if(dt.Rows[0].type=="I"){gj(5);ignName=document.getElementById("ignName");SMSCarrier=document.getElementById("SMSPROVIDERIGN");SMSCarrier.value="mobile.mycingular.com";vehicleSelection=document.getElementById("ddlVehicleIgnAlert");startHour=document.getElementById("ISTRTH");startMin=document.getElementById("ISTRTM");endHour=document.getElementById("IENDH");endMin=document.getElementById("IENDM");IgnOn=document.getElementById("IGNON");IgnOff=document.getElementById("IGNOFF");smscheck=document.getElementById("SMSCHECKIGN");emailcheck=document.getElementById("EMAILCHECKIGN");smstarget=document.getElementById("SMSTARGETIGN");SMSProvider=document.getElementById("SMSPROVIDERIGN");emailtarget=document.getElementById("EMAILTARGETIGN");ignName.value=dt.Rows[0].name;for(i=0;i<vehicleSelection.options.length;i++){if(vehicleSelection.options[i].value==dt.Rows[0].vehicle_id){vehicleSelection.selectedIndex=i;break;}}if(dt.Rows[0].Lo_Hour!=null){startHour.value=dt.Rows[0].Lo_Hour;}while(startHour.value.length<2){startHour.value="0"+startHour.value;}if(dt.Rows[0].Lo_Minute!=null){startMin.value=dt.Rows[0].Lo_Minute;}while(startMin.value.length<2){startMin.value="0"+startMin.value;}if(dt.Rows[0].Hi_Hour!=null){endHour.value=dt.Rows[0].Hi_Hour;}while(endHour.value.length<2){endHour.value="0"+endHour.value;}if(dt.Rows[0].Hi_Minute!=null){endMin.value=dt.Rows[0].Hi_Minute;}while(endMin.value.length<2){endMin.value="0"+endMin.value;}if(endHour.value=="00"&&endMin.value=="00"){endHour.value="23";endMin.value="59";}if(dt.Rows[0].Ign_On==null||dt.Rows[0].Ign_On==true){IgnOn.checked=true;}else{IgnOn.checked=false;}if(dt.Rows[0].Ign_Off==null||dt.Rows[0].Ign_Off==true){IgnOff.checked=true;}else{IgnOff.checked=false;}if(dt.Rows[0].SMSEnabled=="1"){smscheck.checked=true;}else{smscheck.checked=false;}if(dt.Rows[0].EMAILEnabled=="1"){emailcheck.checked=true;}else{emailcheck.checked=false;}var sms=dt.Rows[0].sms;smsval=sms.split("@");smstarget.value=smsval[0];SMSProvider.value=smsval[1];emailtarget.value=dt.Rows[0].email;}}}}}};function ad(type){if(m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}var smsEnabled="0";var emailEnabled="0";gfaz_smslist="";gfaz_SMSPhone="";gfaz_SMSCarrier="";gfaz_emaillist="";gfaz_bbl="";gfaz_loHour=0;gfaz_loMin=0;gfaz_hiHour=23;gfaz_hiMin=59;gfaz_enter=true;gfaz_IgnOn=true;gfaz_IgnOff=true;gfaz_exit=true;az_type='';saz_speed= -1;az_name="";saz_vehicleid="";if(type==0){az_type='S';sthresh=document.getElementById("speedThreshold");saz_speed=parseInt(sthresh.value,10);var saz_vehicleddl=document.getElementById("ddlVehicleSpeedAlert");saz_vehicleid=saz_vehicleddl.options[saz_vehicleddl.options.selectedIndex].value;gfaz_name=document.getElementById("zoneSpeedName");gfaz_sms=document.getElementById("SMSCHECKSZ");gfaz_email=document.getElementById("EMAILCHECKSZ");az_name=gfaz_name.value;if(gfaz_sms.checked){smsEnabled="1";}else{smsEnabled="0";}smscheck=document.getElementById("SMSTARGETSZ");smsprovider=document.getElementById("SMSPROVIDERSZ");if(smsprovider.options.selectedIndex!= -1){smsprovideremail=smsprovider.options[smsprovider.options.selectedIndex].value;}else{smsprovideremail="";}smscheck.value=stripID(smscheck.value);gfaz_smslist=smscheck.value+"@"+smsprovideremail;gfaz_SMSPhone=smscheck.value;gfaz_SMSCarrier=smsprovideremail;if(gfaz_email.checked){emailEnabled="1";}else{emailEnabled="0";}emailcheck=document.getElementById("EMAILTARGETSZ");gfaz_emaillist=emailcheck.value;}else if(type==1){az_type='G';var saz_vehicleddl=document.getElementById("ddlVehicleZoneAlert");saz_vehicleid=saz_vehicleddl.options[saz_vehicleddl.options.selectedIndex].value;gfaz_name=document.getElementById("zoneName");gfaz_sms=document.getElementById("SMSCHECKGF");gfaz_email=document.getElementById("EMAILCHECKGF");gfaz_loHour=document.getElementById("ZSTRTH");gfaz_loMin=document.getElementById("ZSTRTM");gfaz_hiHour=document.getElementById("ZENDH");gfaz_hiMin=document.getElementById("ZENDM");gfaz_enter=document.getElementById("ZENTER");gfaz_exit=document.getElementById("ZEXIT");az_name=gfaz_name.value;if(gfaz_sms.checked){smsEnabled="1";}else{smsEnabled="0";}smscheck=document.getElementById("SMSTARGETGF");smsprovider=document.getElementById("SMSPROVIDERGF");if(smsprovider.options.selectedIndex!= -1){smsprovideremail=smsprovider.options[smsprovider.options.selectedIndex].value;}else{smsprovideremail="";}smscheck.value=stripID(smscheck.value);gfaz_smslist=smscheck.value+"@"+smsprovideremail;gfaz_SMSPhone=smscheck.value;gfaz_SMSCarrier=smsprovideremail;if(gfaz_email.checked){emailEnabled="1";}else{emailEnabled="0";}emailcheck=document.getElementById("EMAILTARGETGF");gfaz_emaillist=emailcheck.value;if(m_fenceLatUL==null||m_fenceLonUL==null||m_fenceLatLR==null||m_fenceLonLR==null){AlertMessage("Zone was not selected.  Please select zone on the map.");return;}gfaz_bbl=m_fenceLatUL+","+m_fenceLonUL+","+m_fenceLatLR+","+m_fenceLonLR;if(dB(gfaz_loHour.value)&&dB(gfaz_loMin.value)&&dB(gfaz_hiHour.value)&&dB(gfaz_hiMin.value)){}else{AlertMessage("Start and end times must be numeric.");return;}if(gfaz_loHour.value>23||gfaz_loMin.value>59||gfaz_hiHour.value>23||gfaz_hiMin.value>59){AlertMessage("Start and end times must be between 00:00 and 23:59.");return;}if((gfaz_hiHour.value<gfaz_loHour.value)||(gfaz_loHour.value==gfaz_hiHour.value&&gfaz_hiMin.value<gfaz_loMin.value)){AlertMessage("Start time must be less than End time.  If the alert needs to span over midnight please create two alerts.");return;}}else if(type==3){az_type='P';saz_speed=parseInt(0);saz_vehicleid="-1";gfaz_sms=document.getElementById("SMSCHECKSP");gfaz_email=document.getElementById("EMAILCHECKSP");az_name_temp=document.getElementById("PANICNAME");az_name=az_name_temp.value;if(gfaz_sms.checked){smsEnabled="1";}else{smsEnabled="0";}smscheck=document.getElementById("SMSTARGETSP");smsprovider=document.getElementById("SMSPROVIDERSP");if(smsprovider.options.selectedIndex!= -1){smsprovideremail=smsprovider.options[smsprovider.options.selectedIndex].value;}else{smsprovideremail="";}smscheck.value=stripID(smscheck.value);gfaz_smslist=smscheck.value+"@"+smsprovideremail;gfaz_SMSPhone=smscheck.value;gfaz_SMSCarrier=smsprovideremail;if(gfaz_email.checked){emailEnabled="1";}else{emailEnabled="0";}emailcheck=document.getElementById("EMAILTARGETSP");gfaz_emaillist=emailcheck.value;}else if(type==4){saz_speed=parseInt(0);az_type='I';var saz_vehicleddl=document.getElementById("ddlVehicleIgnAlert");saz_vehicleid=saz_vehicleddl.options[saz_vehicleddl.options.selectedIndex].value;gfaz_name=document.getElementById("ignName");gfaz_sms=document.getElementById("SMSCHECKIGN");gfaz_email=document.getElementById("EMAILCHECKIGN");gfaz_loHour=document.getElementById("ISTRTH");gfaz_loMin=document.getElementById("ISTRTM");gfaz_hiHour=document.getElementById("IENDH");gfaz_hiMin=document.getElementById("IENDM");gfaz_IgnOn=document.getElementById("IGNON");gfaz_IgnOff=document.getElementById("IGNOFF");az_name=gfaz_name.value;if(gfaz_sms.checked){smsEnabled="1";}else{smsEnabled="0";}smscheck=document.getElementById("SMSTARGETIGN");smsprovider=document.getElementById("SMSPROVIDERIGN");if(smsprovider.options.selectedIndex!= -1){smsprovideremail=smsprovider.options[smsprovider.options.selectedIndex].value;}else{smsprovideremail="";}smscheck.value=stripID(smscheck.value);gfaz_smslist=smscheck.value+"@"+smsprovideremail;gfaz_SMSPhone=smscheck.value;gfaz_SMSCarrier=smsprovideremail;if(gfaz_email.checked){emailEnabled="1";}else{emailEnabled="0";}emailcheck=document.getElementById("EMAILTARGETIGN");gfaz_emaillist=emailcheck.value;if(dB(gfaz_loHour.value)&&dB(gfaz_loMin.value)&&dB(gfaz_hiHour.value)&&dB(gfaz_hiMin.value)){}else{AlertMessage("Start and end times must be numeric.");return;}if(gfaz_loHour.value>23||gfaz_loMin.value>59||gfaz_hiHour.value>23||gfaz_hiMin.value>59){AlertMessage("Start and end times must be between 00:00 and 23:59.");return;}if((gfaz_hiHour.value<gfaz_loHour.value)||(gfaz_loHour.value==gfaz_hiHour.value&&gfaz_hiMin.value<gfaz_loMin.value)){AlertMessage("Start time must be less than End time.  If the alert needs to span over midnight please create two alerts.");return;}}if(az_name==""||az_name==null){AlertMessage("You must supply a name for the alert.");return;}count=0;pos=gfaz_emaillist.indexOf("@");while(pos!= -1){count++;pos=gfaz_emaillist.indexOf("@",pos+1);}if(count>1){AlertMessage("Sorry, only one e-mail address per alert.");return;}if(gfaz_emaillist==""&&gfaz_SMSPhone==""){AlertMessage("You must supply an 'SMS TO' and/or 'EMAIL TO'.");return}if(gfaz_sms.checked&&gfaz_SMSPhone==""){AlertMessage("You must supply an 'SMS TO.");return;}if(gfaz_sms.checked&&gfaz_SMSCarrier==""){AlertMessage("You must supply an 'SMS carrier (After the '@').");return;}if(gfaz_email.checked&&gfaz_emaillist==""){AlertMessage("You must supply an 'Email TO.");return;}if(!gfaz_sms.checked&&gfaz_SMSPhone!=""){AlertMessage("Warning -- saving alert but no sms message will be sent.");}if(!gfaz_email.checked&&gfaz_emaillist!=""){AlertMessage("Warning -- saving alert but no email message will be sent.");}Feed.IAlrt(gfaz_bbl,smsEnabled,emailEnabled,"",gfaz_emaillist,gfaz_smslist,gfaz_SMSPhone,gfaz_SMSCarrier,az_type,m_CurrentUser,saz_speed,az_name,saz_vehicleid,gfaz_loHour.value,gfaz_loMin.value,gfaz_hiHour.value,gfaz_hiMin.value,gfaz_enter.checked,gfaz_exit.checked,gfaz_IgnOn.checked,gfaz_IgnOff.checked,ep);};function fi(){if(m_demoUser||demo2_user){AlertMessage("Sorry, this feature has been disabled in demonstration mode.");return;}alertList=document.getElementById("ddlAlertList");if(alertList.options.selectedIndex>=0){selectedValue=alertList.options[alertList.options.selectedIndex].value;}else{selectedValue=null;}if(m_drawingFence==true){clearFence()}if(selectedValue!=null){Feed.DAlrt(selectedValue,m_CurrentUser,ep);}};function gj(id){bS();if(id==1){gQ();var originalPoint=map.LatLongToPixel(map.GetCenter());var newx=originalPoint.x-100;var newy=originalPoint.y-100;pixel=new VEPixel(newx,newy);var newLatLon=map.PixelToLatLong(pixel);m_fenceLatUL=newLatLon.Latitude;m_fenceLonUL=newLatLon.Longitude;newx=newx+200;newy=newy+200;pixel=new VEPixel(newx,newy);newLatLon=map.PixelToLatLong(pixel);m_fenceLatLR=newLatLon.Latitude;m_fenceLonLR=newLatLon.Longitude;m_drawingFence=true;P();SMSCarrier=document.getElementById("SMSPROVIDERGF");SMSCarrier.value="mobile.mycingular.com";}if(id==2){alertPanel=document.getElementById("alertAddSpeed");alertPanel.style.visibility="visible";alertPanel.style.display="inline";SMSCarrier=document.getElementById("SMSPROVIDERSZ");SMSCarrier.value="mobile.mycingular.com";}if(id==3){alertPanel=document.getElementById("alertRemove");alertPanel.style.visibility="visible";alertPanel.style.display="inline";var List=document.getElementById("ddlAlertList");if(List.selectedIndex!= -1){var table=document.getElementById("alertSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("noAlertSelected");table.style.display="none";table.style.visibility="hidden";}else{var table=document.getElementById("noAlertSelected");table.style.display="inline";table.style.visibility="visible";table=document.getElementById("alertSelected");table.style.display="none";table.style.visibility="hidden";}}if(id==4){alertPanel=document.getElementById("alertEditPanic");alertPanel.style.visibility="visible";alertPanel.style.display="inline";SMSCarrier=document.getElementById("SMSPROVIDERSP");SMSCarrier.value="mobile.mycingular.com";}if(id==5){alertPanel=document.getElementById("alertEditIgnition");alertPanel.style.visibility="visible";alertPanel.style.display="inline";SMSCarrier=document.getElementById("SMSPROVIDERIGN");SMSCarrier.value="mobile.mycingular.com";zoneName=document.getElementById("ignName");startHour=document.getElementById("ISTRTH");startMin=document.getElementById("ISTRTM");endHour=document.getElementById("IENDH");endMin=document.getElementById("IENDM");IgnOn=document.getElementById("IGNON");IgnOff=document.getElementById("IGNOFF");smscheck=document.getElementById("SMSCHECKIGN");emailcheck=document.getElementById("EMAILCHECKIGN");smstarget=document.getElementById("SMSTARGETIGN");emailtarget=document.getElementById("EMAILTARGETIGN");zoneName.value="";startHour.value="00";startMin.value="00";endHour.value="23";endMin.value="59";IgnOn.checked=true;IgnOff.checked=true;smscheck.checked=false;emailcheck.checked=false;smstarget.value="";emailtarget.value="";}};function bS(){alertPanel=document.getElementById("alertAddZone");alertPanel.style.visibility="hidden";alertPanel.style.display="none";alertPanel=document.getElementById("alertAddSpeed");alertPanel.style.visibility="hidden";alertPanel.style.display="none";alertPanel=document.getElementById("alertRemove");alertPanel.style.visibility="hidden";alertPanel.style.display="none";alertPanel=document.getElementById("alertEditPanic");alertPanel.style.visibility="hidden";alertPanel.style.display="none";alertPanel=document.getElementById("alertEditIgnition");alertPanel.style.visibility="hidden";alertPanel.style.display="none";map.DeleteAllPolygons();if(fenceUL!=null){map.DeleteShape(fenceUL);fenceUL=null;}if(fenceLR!=null){map.DeleteShape(fenceLR);fenceLR=null;}m_drawingFence=false;if(m_drawingFence!=null){clearFence()}};function gQ(){bS();alertPanel=document.getElementById("alertAddZone");alertPanel.style.visibility="visible";alertPanel.style.display="inline";zoneName=document.getElementById("zoneName");startHour=document.getElementById("ZSTRTH");startMin=document.getElementById("ZSTRTM");endHour=document.getElementById("ZENDH");endMin=document.getElementById("ZENDM");zEnter=document.getElementById("ZENTER");zExit=document.getElementById("ZEXIT");smscheck=document.getElementById("SMSCHECKGF");emailcheck=document.getElementById("EMAILCHECKGF");smstarget=document.getElementById("SMSTARGETGF");emailtarget=document.getElementById("EMAILTARGETGF");zoneName.value="";startHour.value="00";startMin.value="00";endHour.value="23";endMin.value="59";zEnter.checked=true;zExit.checked=true;smscheck.checked=false;emailcheck.checked=false;smstarget.value="";emailtarget.value="";};function ig(id){speedAlert=document.getElementById("speedAlert");gfAlert=document.getElementById("gfAlert");if(id==1){speedAlert.checked=false;gfAlert.checked=true;}if(id==2){speedAlert.checked=true;gfAlert.checked=false;}};function ep(){alertPanel=document.getElementById("alertRemove");alertPanel.style.visibility="hidden";alertPanel.style.display="none";Feed.SAlrt(m_CurrentUser,fk);};function fk(data){if(data.value!=null){m_AlertList=data.value;m_ddlAlerts.options.length=0;for(var i=0;i<m_AlertList.Rows.length;i++){m_ddlAlerts.options[i]=new Option(m_AlertList.Rows[i].name,m_AlertList.Rows[i].id);}}};function bj(divname){var elemental=document.getElementById(divname);elemental.style.display="block";elemental.style.visibility="visible";if(divname!="divMessageWithX"&&divname!="divBlankMsgWithX"&&divname!="divVehicleAction"&&divname!="divColorPopOverLay"&&divname!="divActionCompleted"&&divname!="divCalculatingRoute"&&divname!="divDemoNotification"){var CWPosition=bF(divname);if(CWPosition!=null&&CWPosition!=""){var winplace=CWPosition.split(':');elemental.style.top=winplace[0];elemental.style.left=winplace[1];}else{if(divname!="divMessageWithX"&&divname!="divVehicleAction"&&divname!="divColorPopOverLay"&&divname!="divActionCompleted"&&divname!="divCalculatingRoute"&&divname!="divDemoNotification"){elemental.style.top="10px";elemental.style.left="300px";}}};new Effect.Appear(divname,{queue:'end',from:0,to:1,duration:0.30});elemental=null;CWPosition=null;winplace=null;};function aF(divname){var elemental=document.getElementById(divname);if(divname!="divMessageWithX"&&divname!="divVehicleAction"&&divname!="divColorPopOverLay"&&divname!="divActionCompleted"&&divname!="divCalculatingRoute"&&divname!="divDemoNotification"){gv(divname,elemental.style.top+':'+elemental.style.left);}new Effect.Fade(divname,{queue:'end',from:1,to:0,duration:0.30});elemental=null;};function fb(){var pa=document.getElementById('ControlPlate');var pb=document.getElementById('MiniPlate');pb.style.top=pa.style.top;pb.style.left=pa.style.left;new Effect.BlindUp('ControlPlate',{duration:0.25});new Effect.BlindDown('MiniPlate',{queue:'end',duration:0.37});};function fw(){var pb=document.getElementById('ControlPlate');var pa=document.getElementById('MiniPlate');pb.style.top=pa.style.top;pb.style.left=pa.style.left;new Effect.BlindUp('MiniPlate',{duration:0.25});new Effect.BlindDown('ControlPlate',{queue:'end',duration:0.37});};function fQ(){if(m_bLoggedIn){m_alertdiv=null;m_alertdiv=document.getElementById("divReportSelector");m_alertdiv.style.position="absolute";bj("divReportSelector");}else{AlertMessage("You must be logged in to use this feature.");}};function cA(){aF("divReportSelector");};function fR(){if(m_bLoggedIn){m_alertdiv=null;m_alertdiv=document.getElementById("divAlertOverlay");m_alertdiv.style.position="absolute";document.getElementById("alertAddZone").style.display="inline";bj("divAlertOverlay");ep();AlertEditorOpen=true;}else{AlertMessage("You must be logged in to use this feature.");}};function db(){AlertEditorOpen=false;aF("divAlertOverlay");bS();gj(-1);MapFencesVisible=false;};function dQ(result){if(result==null){Feed.SIcnFld(dQ);}else{iNames=new Array();iXCenter=new Array();iYCenter=new Array();IconFolders=result.value;for(var i=0;i<IconFolders.Rows.length;i++){iNames[i]=IconFolders.Rows[i].iconFolder;iXCenter[i]=IconFolders.Rows[i].XCenter;iYCenter[i]=IconFolders.Rows[i].YCenter;}}};function eW(str){var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;var ldot=str.indexOf(dot);if(str.indexOf(at)== -1){return false}if(str.indexOf(at)== -1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false}if(str.indexOf(dot)== -1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false}if(str.indexOf(at,(lat+1))!= -1){return false}if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false}if(str.indexOf(dot,(lat+2))== -1){return false}if(str.indexOf(" ")!= -1){return false}return true};function gO(){Feed.SUsrRt(m_CurrentUser,hM)};function hM(result){layer02=new VEShapeLayer();map.AddShapeLayer(layer02);if(result.value!=null){var route=new Array();route=result.value;if(route.Rows.length>1){for(var i=1;i<route.Rows.length;i++){var points=new Array(new VELatLong(route.Rows[i-1].ur_Lat,route.Rows[i-1].ur_Lon),new VELatLong(route.Rows[i].ur_Lat,route.Rows[i].ur_Lon));var vaptrail=new VEShape(VEShapeType.Polyline,points);vaptrail.SetLineColor(new VEColor(255,0,100,0.6));vaptrail.SetLineWidth(4);vaptrail.HideIcon();layer02.AddShape(vaptrail);}}}};function fl(){this.strings=new Array("");};fl.prototype.append=function(value){if(value){this.strings.push(value);}};fl.prototype.clear=function(){this.strings.length=1;};fl.prototype.toString=function(){return this.strings.join("");};function showSanta(){bm();if(santaDirection==0){santaLoc=0;santaDirection=1;santaYLoc=(Math.floor(Math.random()*(windowHeight-80)))+40;}var divSantaName=document.getElementById("divSantaName");var divSanta=document.getElementById("divSanta");var santa=document.getElementById("santa");santaLoc+=(santaDirection*8);if(santaDirection==1){if(santaLoc>(windowWidth-130)){santaYLoc=(Math.floor(Math.random()*(windowHeight-80)))+40;santaDirection= -1;santaLoc=windowWidth-135;santa.src="images/santaW.png";divSanta.style.visibility="hidden";divSanta.style.display="none";divSantaName.style.visibility="hidden";divSantaName.style.display="none";santaTimer=setTimeout("showSanta()",180000);return null;}}else{if(santaLoc<10){santaDirection=1;santaYLoc=(Math.floor(Math.random()*(windowHeight-80)))+40;santaLoc=0;santa.src="images/santaE.png";divSanta.style.visibility="hidden";divSanta.style.display="none";divSantaName.style.visibility="hidden";divSantaName.style.display="none";santaTimer=setTimeout("showSanta()",180000);return null;}}divSanta.style.visibility="visible";divSanta.style.display="block";divSanta.style.left=santaLoc+"px";divSanta.style.top=(santaYLoc+20)+"px";divSantaName.style.visibility="visible";divSantaName.style.display="block";divSantaName.style.left=(santaLoc+40)+"px";divSantaName.style.top=santaYLoc+"px";santaTimer=setTimeout("showSanta()",400);};function dB(sText){var ValidChars="0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber==true;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)== -1){IsNumber=false;}}return IsNumber;};function hL(){aF("divReportSelector");clearTimeout(m_loadTimeout);clearInterval(m_loadInterval);m_divROverlay=null;m_divROverlay=document.getElementById("divVaporTrailOverlay");m_divROverlay.style.marginTop=parseInt(0);m_divROverlay.style.position="absolute";m_divROverlay.style.top="280px";m_divROverlay.style.left="-220px";var btnPlayVaporTrail=document.getElementById("btnPlayVaporTrail");btnPlayVaporTrail.outerHTML="<IMG id='btnPlayVaporTrail' alt='' onclick='gp();' onmouseout=\"this.src='images/RptRequest0.gif'\" onmouseover=\"this.src='images/RptRequest1.gif'\" src='images/RptRequest0.gif'>";m_StatusLine=document.getElementById("txtVaporTrailStatus");m_StatusLine.innerHTML="";bj("divVaporTrailOverlay");};function cx(){VaporTrailStop=true;PlayingVaporTrail=false;if(map.GetShapeLayerCount()>1){map.DeleteAllShapeLayers();}m_historicalData=null;aF("divVaporTrailOverlay");m_firstRetrieve=true;m_bOptimizeZoom=true;var sessionID=document.getElementById("SESSIONKEY").getAttribute("value");m_loadTimeout=setTimeout("dv('"+sessionID+"');",4000);};function gp(){var btnPlayVaporTrail=document.getElementById("btnPlayVaporTrail");if(PlayingVaporTrail==true){if(VaporTrailStop==true){VaporTrailStop=false;btnPlayVaporTrail.outerHTML="<IMG id='btnPlayVaporTrail' alt='' onclick='gp();' onmouseout=\"this.src='images/Pause0.gif'\" onmouseover=\"this.src='images/Pause1.gif'\" src='images/Pause0.gif'>";setTimeout("az()",250);}else{VaporTrailStop=true;clearTimeout(VaporTrailTimeout);btnPlayVaporTrail.outerHTML="<IMG id='btnPlayVaporTrail' alt='' onclick='gp();' onmouseout=\"this.src='images/Resume0.gif'\" onmouseover=\"this.src='images/Resume1.gif'\" src='images/Resume0.gif'>";}}else{var startDate=document.getElementById("txtVTStartDate").value;if(startDate==null||startDate==''){AlertMessage("Please select begin date.");return false;}var dtStartHr=document.getElementById("VTstartHours").value;var dtStartMin=document.getElementById("VTstartMins").value;var dtStartSec=document.getElementById("VTstartSec").value;var dtFromDate=new Date(startDate+' '+dtStartHr+':'+dtStartMin+':'+dtStartSec);var endDate=document.getElementById("txtVTEndDate").value;if(endDate==null||endDate==''){AlertMessage("Please select end date.");return false;}var dtEndHr=document.getElementById("VTendHours").value;var dtEndMin=document.getElementById("VTendMins").value;var dtEndSec=document.getElementById("VTendSec").value;var dtStartDate=new Date(startDate);var dtEndDate=new Date(endDate);Pto1=0;Pto2=0;Pto3=0;Pto4=0;ckPto=document.getElementById("ckVTPto1");if(ckPto.getAttribute("checked")==true){Pto1=1;}ckPto=document.getElementById("ckVTPto2");if(ckPto.getAttribute("checked")==true){Pto2=1;}ckPto=document.getElementById("ckVTPto3");if(ckPto.getAttribute("checked")==true){Pto3=1;}ckPto=document.getElementById("ckVTPto4");if(ckPto.getAttribute("checked")==true){Pto4=1;}ag();PlayingVaporTrail=true;VaporTrailStop=false;m_historicalData=null;Feed.SHstPlay(m_VTVehiclesList.value,dtStartDate.getFullYear()+"/"+(dtStartDate.getMonth()+1)+"/"+dtStartDate.getDate(),dtStartHr+":"+dtStartMin+":"+dtStartSec,dtEndDate.getFullYear()+"/"+(dtEndDate.getMonth()+1)+"/"+dtEndDate.getDate(),dtEndHr+":"+dtEndMin+":"+dtEndSec,aQ);dL("Loading data for vapor trail");}};function aQ(result){bB();m_historicalData=result.value;if(m_historicalData.Rows.length==0){AlertMessage("No history present for selected criteria.");PlayingVaporTrail=false;return;}var btnPlayVaporTrail=document.getElementById("btnPlayVaporTrail");btnPlayVaporTrail.outerHTML="<IMG id='btnPlayVaporTrail' alt='' onclick='gp();' onmouseout=\"this.src='images/Pause0.gif'\" onmouseover=\"this.src='images/Pause1.gif'\" src='images/Pause0.gif'>";VaporTrailPoints=new Array();historicalIndex= -1;layer01=new VEShapeLayer();map.AddShapeLayer(layer01);VaporTrailStop=false;ax();};function ax(){clearTimeout(VaporTrailTimeout);if(VaporTrailStop==false){historicalIndex++;if(historicalIndex<m_historicalData.Rows.length){VaporTrailTimeout=setTimeout("az()",0);}else{var btnPlayVaporTrail=document.getElementById("btnPlayVaporTrail");btnPlayVaporTrail.outerHTML="<IMG id='btnPlayVaporTrail' alt='' onclick='gp();' onmouseout=\"this.src='images/RptRequest0.gif'\" onmouseover=\"this.src='images/RptRequest1.gif'\" src='images/RptRequest0.gif'>";m_StatusLine=document.getElementById("txtVaporTrailStatus");m_StatusLine.innerHTML="";}}};function az(){if(VaporTrailStop==false){var lat=m_historicalData.Rows[historicalIndex].lat;var lon=m_historicalData.Rows[historicalIndex].lon;VaporTrailPoints[historicalIndex]=new VELatLong(lat*1,lon*1);if(historicalIndex>0&&historicalIndex<m_historicalData.Rows.length){var doTheDraw=false;var LS=m_historicalData.Rows[historicalIndex-1].Switches;var SW=m_historicalData.Rows[historicalIndex].Switches;if(Pto1!=1&&Pto2!=1&&Pto3!=1&&Pto4!=1){doTheDraw=true;}else if(Pto1==1&&(LS==1||LS==3||LS==5||LS==7||LS==9||LS==11||LS==13||LS==15)&&(SW==1||SW==3||SW==5||SW==7||SW==9||SW==11||SW==13||SW==15)){doTheDraw=true;}else if(Pto2==1&&(LS==2||LS==3||LS==6||LS==7||LS==10||LS==11||LS==14||LS==15)&&(SW==2||SW==3||SW==6||SW==7||SW==10||SW==11||SW==14||SW==15)){doTheDraw=true;}else if(Pto3==1&&(LS==4||LS==5||LS==6||LS==7||LS==12||LS==13||LS==14||LS==15)&&(SW==4||SW==3||SW==6||SW==7||SW==12||SW==13||SW==14||SW==15)){doTheDraw=true;}else if(Pto4==1&&(LS==8||LS==9||LS==10||LS==11||LS==12||LS==13||LS==14||LS==15)&&(SW==8||SW==9||SW==10||SW==11||SW==12||SW==13||SW==14||SW==15)){doTheDraw=true;}if(doTheDraw==true){m_StatusLine=document.getElementById("txtVaporTrailStatus");var tempTime=m_historicalData.Rows[historicalIndex].timestamp;m_StatusLine.innerHTML=m_historicalData.Rows[historicalIndex].timestamp;var points=new Array(new VELatLong(m_historicalData.Rows[historicalIndex-1].lat,m_historicalData.Rows[historicalIndex-1].lon),new VELatLong(m_historicalData.Rows[historicalIndex].lat,m_historicalData.Rows[historicalIndex].lon));var vaptrail=new VEShape(VEShapeType.Polyline,points);vaptrail.SetLineColor(new VEColor(255,0,100,0.6));vaptrail.SetLineWidth(4);vaptrail.HideIcon();layer01.AddShape(vaptrail);map.SetMapView(VaporTrailPoints);}}VaporTrailTimeout=setTimeout("ax()",0);}else clearTimeout(VaporTrailTimeout);};function gh(str,chars){return fH(fs(str,chars),chars);};function fH(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"");};function fs(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"");};function hW(d){var showGeoFences=document.getElementById("ckShowGeoFences");if(showGeoFences.checked==false){map.DeleteAllPolygons();m_showGeoFences=true;}else{m_showGeoFences=true;MapFencesVisible=false;}};function updateMapFences(){if(m_showGeoFences){Feed.SGeoFnc(m_CurrentUser,hm);}};function hm(data){map.DeleteAllPolygons();if(data!=null){if(data.value!=null){var dt=data.value;var PId=0;for(i=0;i<dt.Rows.length;i++){var latlng=dt.Rows[i].bbl;ltln=latlng.split(",");m_fenceLatUL=ltln[0];m_fenceLonUL=ltln[1];m_fenceLatLR=ltln[2];m_fenceLonLR=ltln[3];var points=new Array(new VELatLong(m_fenceLatUL,m_fenceLonUL),new VELatLong(m_fenceLatUL,m_fenceLonLR),new VELatLong(m_fenceLatLR,m_fenceLonLR),new VELatLong(m_fenceLatLR,m_fenceLonUL),new VELatLong(m_fenceLatUL,m_fenceLonUL));PId++;poly=new VEPolygon(PId,points);poly.SetOutlineWidth(1);poly.SetOutlineColor(new VEColor(0,0,0,1.0));poly.SetFillColor(new VEColor(255,128,128,0.5));map.AddPolygon(poly);}}}MapFencesVisible=true;};function gv(c_name,value){var exdate=new Date();exdate.setDate(exdate.getDate()+9999);document.cookie=c_name+"="+escape(value)+";expires="+exdate.toGMTString();};function bF(c_name){if(document.cookie.length>0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!= -1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end== -1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}return "";};function dS(c_name,value){var exdate=new Date();exdate.setDate(U());document.cookie=c_name+"="+escape(value)+";expires="+exdate.toGMTString();};function gh(str){return str.replace(/^\s\s*/,'').replace(/\s\s*$/,'');};function dA(id){str=document.getElementById(id).innerHTML;newwin=window.open('','printwin','left=100,top=100,width=400,height=400');newwin.document.write('<HTML>\n<HEAD>\n');newwin.document.write('<TITLE>Print Page</TITLE>\n');newwin.document.write('<script>\n');newwin.document.write('function chkstate(){\n');newwin.document.write('if(document.readyState=="complete"){\n');newwin.document.write('window.close()\n');newwin.document.write('}\n');newwin.document.write('else{\n');newwin.document.write('setTimeout("chkstate()",2000)\n');newwin.document.write('}\n');newwin.document.write('}\n');newwin.document.write('function print_win(){\n');newwin.document.write('window.print();\n');newwin.document.write('chkstate();\n');newwin.document.write('}\n');newwin.document.write('<\/script>\n');newwin.document.write('</HEAD>\n');newwin.document.write('<BODY onload="print_win()">\n');newwin.document.write(str);newwin.document.write('</BODY>\n');newwin.document.write('</HTML>\n');newwin.document.close();};function printSpecial(){if(document.getElementById!=null){var html='<HTML>\n<HEAD>\n';if(document.getElementsByTagName!=null){var headTags=document.getElementsByTagName("head");if(headTags.length>0)html+=headTags[0].innerHTML;}html+='\n</HE'+'AD>\n<BODY>\n';var printReadyElem=document.getElementById("printReady");if(printReadyElem!=null){html+=printReadyElem.innerHTML;}else{alert("Could not find the printReady section in the HTML");return;}html+='\n</BO'+'DY>\n</HT'+'ML>';var printWin=window.open("","printSpecial");printWin.document.open();printWin.document.write(html);printWin.document.close();if(gAutoPrint)printWin.print();}else{alert("Sorry, the print ready feature is only available in modern browsers.");}}