function StringBuilder(){var a=this;a.buffer=[]}StringBuilder.prototype.Append=function(a){var b=this;b.buffer.push(a)};StringBuilder.prototype.AppendFormat=function(d){var a=this;if(arguments.length>1){var b=arguments.length-2;for(var c=0;c<=b;c++){d=d.replace(new RegExp("\\{"+c+"\\}","gi"),arguments[c+1])}}a.Append(d)};StringBuilder.prototype.ToString=function(){var a=this;return a.Join("")};StringBuilder.prototype.Join=function(a){var b=this;return b.buffer.join(a)};var PointOfInterestType={PointOfInterest:1,NoGoZone:2,GeoFence:3,DriverHome:4,CustomerLocation:5};var PickerType={User:1,Unit:2,Driver:3,UnitGroup:4,UserGroup:5,PointOfInterest:6,InputOutput:7,GeoFence:8,NoGoZone:9,Route:10,Customer:11,DriverAllocated:12};function User(){var a=this;a.Properties=null;a.loadEvents=[]}User.prototype.Load=function(){var b=this;var a=$j.ajax({type:"GET",url:"/User/Fetch/",dataType:"json",success:function(c){b.Properties=c;b.HasLoaded(b,c)},data:{noCache:getNoCacheVal()},async:false})};User.prototype.LoadByCompany=function(a,c){var d=this;var b=$j.ajax({type:"GET",url:"/User/FetchByCompany/",dataType:"json",success:function(e){d.Properties=e;d.HasLoaded(d,e)},data:{companyguid:a,sessionid:c},async:false,cache:false})};User.prototype.HasLoaded=function(a,d){var c=a;for(var b=0;b<c.loadEvents.length;b++){c.loadEvents[b](a,d)}};User.prototype.OnLoad=function(a){var b=this;b.loadEvents.push(a)};User.prototype.GetPreference=function(c){var a=this;if(a.Properties.Preferences!==null){for(var b=0;b<a.Properties.Preferences.length;b++){if(a.Properties.Preferences[b].PreferenceId==c){return a.Properties.Preferences[b]}}}};User.prototype.HasPreference=function(d,a){var c=this;var b=c.GetPreference(d);return(b!==undefined&&b!==null&&b.OptionId==a)};User.prototype.DatePreference=function(){var a=this;return a.GetPreference(24).Value};User.prototype.DateTimePreference=function(){var b=this;var a=b.DatePreference();if(a.indexOf("HH")==-1){a+=" HH:mm:ss"}return a};User.prototype.CalendarSafeDatePreference=function(){var b=this;var a=b.DatePreference();if(a.indexOf("MMM")==-1){a=a.replace("MM","mm").replace("yyyy","yy")}else{a=a.replace("MMM","M").replace("yyyy","yy")}return a};User.prototype.UseMap24=function(){var a=this;return(a.Properties.MapTypeId==1)};function getNoCacheVal(){return new Date().getTime()}jQuery.unbindall=function(){jQuery("*").unbind()};function SiteUnload(){if(typeof(GUnload)==="function"&&gUser!=null&&gUser.Properties.MapTypeId===2){GUnload()}jQuery.unbindall()}var INTERFACES={};var UTIL={};INTERFACES.IMapController={Load:function(){},PopulateUnits:function(){},PopulatePoi:function(){},PopulatePois:function(){},PopulateTrip:function(){},PopulateTrips:function(){},ShowUnitPopup:function(a){},RemoveBubblePopup:function(){},RightClick:function(){},FromPixelPointToLatLng:function(){},UpdateZoomLevel:function(){},LoadLocation:function(){}};UTIL.checkInterface=function(a,b){for(var c in b){if((typeof a[c]!=typeof b[c])){alert("object failed to implement interface member "+c);return false}}return true};String.format=function(c){if(arguments.length<=1){return c}var a=arguments.length-2;for(var b=0;b<=a;b++){c=c.replace(new RegExp("\\{"+b+"\\}","gi"),arguments[b+1])}return c};String.IsNullOrEmpty=function(a){return(a===undefined||a==null||a.length==0)};$j.fn.outerHTML=function(a){return(a)?this.before(a).remove():$j("<p>").append(this.eq(0).clone()).html()};$j.fn.clearSelect=function(){return this.each(function(){if(this.tagName=="SELECT"){this.options.length=0}})};$j.fn.fillSelect=function(a){return this.clearSelect().each(function(){if(this.tagName=="SELECT"){var b=$j(this);$j.each(a,function(){b.append($j("<option />").val(this.Value).text(this.Text))})}})};function Main(){var a=this;a.leftOpen=true;a.dialogLoaded=false;a.widthOffset=3;a.heightOffset=0;a.slideEventCallbacks=[];a.guid="";a.mapInDialog=($j("#mapDialog").length>0);a.init();a.SetContentDimension()}Main.prototype.init=function(){var b=this;gUser=new User();gUser.Load();if(!gUser.UseMap24()){$j("#slider").click(function(){b.Slide();return false});$j("#unslide").click(function(){b.Slide();return false})}else{b.SlideDisable()}var a=$j("#mail");if(a.length>0){b.checkLatestMessage();b.messaging=new Messaging();a.click(function(){b.messaging.Open();return false});$j(document).everyTime("60s",function(){b.checkLatestMessage()})}b.startClock()};Main.prototype.SetContentDimension=function(){var d=this;var b=$j("#map");var c=$j("#leftblock");var e=$j("#rightblock");var h=$j("#header");var g=$j("#slider");var a=$j(window).height()-h.height()-d.heightOffset;if(b&&!d.mapInDialog){b.height(a)}e.height(a);c.height(a);g.height(a);var f=$j(window).width()-g.width();if(d.leftOpen){f=f-c.width()}e.width(f-d.widthOffset);if(b&&!d.mapInDialog){b.width(e.width())}e.show()};Main.prototype.checkLatestMessage=function(){var a=this;var b=0;var e=function(g){b=g[0].MsgCount;var f=g[0].HiPriCount;$j("#gblMsgCount").text(b);if(b>0){$j("#mail").removeClass("open");$j("#mail").addClass("closed")}else{$j("#mail").removeClass("closed");$j("#mail").addClass("open")}var h=b+" "+langPack.UnreadMessages;$j("#mail").attr({title:h});if(f>0){a.messaging.Open()}};var d=function(g){try{var f=jQuery.parseJSON(g.responseText);if(f.RedirectToLogOn){document.location.href="/Account/Logon?session=expired"}}catch(h){console.log("exception thrown")}};var c=new MessagingData();c.MessageCount(e,d)};Main.prototype.SlideDisable=function(){$j("#slider").toggleClass("disabled")};Main.prototype.Slide=function(){var a=this;a.leftOpen=!a.leftOpen;var b=$j("#leftblock");b.dialog("destroy");var c={};b.toggle("slide",c,500);if(!a.mapInDialog){if(!a.leftOpen){$j("#map").width($j(window).width())}else{$j("#map").width($j(window).width()-b.width())}}$j("#slider").toggleClass("right");a.SetContentDimension();for(var d=0;d<a.slideEventCallbacks.length;d++){a.slideEventCallbacks[d]()}};Main.prototype.startClock=function(){var b=this;var a="d M Y h:i a";if(gUser.DatePreference().indexOf("dd/MM/yyyy")>-1){a="d/m/Y h:i a"}else{if(gUser.DatePreference().indexOf("MM/dd/yyyy")>-1){a="m/D/Y h:i a"}}$j("#clock").epiclock({gmt:true,format:a,offset:{hours:gUser.Properties.TimezoneOffset}}).clocks(EC_RUN)};Main.prototype.OnSlide=function(a){var b=this;b.slideEventCallbacks.push(a)};var resizeTimer=null;var main=null;var gUser=null;function onResize(){if(main!=null){main.SetContentDimension()}}$j(window).bind("resize",function(){if(resizeTimer){clearTimeout(resizeTimer)}resizeTimer=setTimeout(onResize,100)});function Util(){var a=this}Util.prototype.RandomizeUrl=function(b){var a=new Date();if(b.indexOf("?")>0){return b+"&rnd="+a.getTime()}else{return b+"/?rnd="+a.getTime()}};Util.prototype.UrlDecode=function(c){var d={},b=c.toString(),a="",f="";var e=function(g,i,h){var j=[];j=h.split(g);return j.join(i)};d["'"]="%27";d["("]="%28";d[")"]="%29";d["*"]="%2A";d["~"]="%7E";d["!"]="%21";d["%20"]="+";d["\u00DC"]="%DC";d["\u00FC"]="%FC";d["\u00C4"]="%D4";d["\u00E4"]="%E4";d["\u00D6"]="%D6";d["\u00F6"]="%F6";d["\u00DF"]="%DF";d["\u20AC"]="%80";d["\u0081"]="%81";d["\u201A"]="%82";d["\u0192"]="%83";d["\u201E"]="%84";d["\u2026"]="%85";d["\u2020"]="%86";d["\u2021"]="%87";d["\u02C6"]="%88";d["\u2030"]="%89";d["\u0160"]="%8A";d["\u2039"]="%8B";d["\u0152"]="%8C";d["\u008D"]="%8D";d["\u017D"]="%8E";d["\u008F"]="%8F";d["\u0090"]="%90";d["\u2018"]="%91";d["\u2019"]="%92";d["\u201C"]="%93";d["\u201D"]="%94";d["\u2022"]="%95";d["\u2013"]="%96";d["\u2014"]="%97";d["\u02DC"]="%98";d["\u2122"]="%99";d["\u0161"]="%9A";d["\u203A"]="%9B";d["\u0153"]="%9C";d["\u009D"]="%9D";d["\u017E"]="%9E";d["\u0178"]="%9F";for(a in d){f=d[a];b=e(f,a,b)}b=decodeURIComponent(b);return b};Util.prototype.MONTH_NAMES=function(){return new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")};Util.prototype.DAY_NAMES=function(){return new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat")};Util.prototype._isInteger=function(b){var c="1234567890";if(b.length==0){return false}for(var a=0;a<b.length;a++){if(c.indexOf(b.charAt(a))==-1){return false}}return true};Util.prototype._getInt=function(c,b,f,d){for(var a=d;a>=f;a--){var e=c.substring(b,b+a);if(e.length<f){return null}if(util._isInteger(e)){return e}}return null};Util.prototype.getDateFromFormat=function(l,u){l=l+"";u=u+"";var t=0;var p=0;var s="";var h="";var w="";var b,d;var o=new Date();var e=o.getYear();var a=o.getMonth()+1;var A=1;var v=o.getHours();var f=o.getMinutes();var m=o.getSeconds();var k="";var z=util.MONTH_NAMES();var j=util.DAY_NAMES();while(p<u.length){s=u.charAt(p);h="";while((u.charAt(p)==s)&&(p<u.length)){h+=u.charAt(p++)}if(h=="yyyy"||h=="yy"||h=="y"){if(h=="yyyy"){b=4;d=4}if(h=="yy"){b=2;d=2}if(h=="y"){b=2;d=4}e=util._getInt(l,t,b,d);if(e==null){return 0}t+=e.length;if(e.length==2){if(e>70){e=1900+(e-0)}else{e=2000+(e-0)}}}else{if(h=="MMM"||h=="NNN"){a=0;for(var q=0;q<z.length;q++){var n=z[q];if(l.substring(t,t+n.length).toLowerCase()==n.toLowerCase()){if(h=="MMM"||(h=="NNN"&&q>11)){a=q+1;if(a>12){a-=12}t+=n.length;break}}}if((a<1)||(a>12)){return 0}}else{if(h=="EE"||h=="E"){for(var q=0;q<j.length;q++){var g=j[q];if(l.substring(t,t+g.length).toLowerCase()==g.toLowerCase()){t+=g.length;break}}}else{if(h=="MM"||h=="M"){a=util._getInt(l,t,h.length,2);if(a==null||(a<1)||(a>12)){return 0}t+=a.length}else{if(h=="dd"||h=="d"){A=util._getInt(l,t,h.length,2);if(A==null||(A<1)||(A>31)){return 0}t+=A.length}else{if(h=="hh"||h=="h"){v=util._getInt(l,t,h.length,2);if(v==null||(v<1)||(v>12)){return 0}t+=v.length}else{if(h=="HH"||h=="H"){v=util._getInt(l,t,h.length,2);if(v==null||(v<0)||(v>23)){return 0}t+=v.length}else{if(h=="KK"||h=="K"){v=util._getInt(l,t,h.length,2);if(v==null||(v<0)||(v>11)){return 0}t+=v.length}else{if(h=="kk"||h=="k"){v=util._getInt(l,t,h.length,2);if(v==null||(v<1)||(v>24)){return 0}t+=v.length;v--}else{if(h=="mm"||h=="m"){f=util._getInt(l,t,h.length,2);if(f==null||(f<0)||(f>59)){return 0}t+=f.length}else{if(h=="ss"||h=="s"){m=util._getInt(l,t,h.length,2);if(m==null||(m<0)||(m>59)){return 0}t+=m.length}else{if(h=="a"){if(l.substring(t,t+2).toLowerCase()=="am"){k="AM"}else{if(l.substring(t,t+2).toLowerCase()=="pm"){k="PM"}else{return 0}}t+=2}else{if(l.substring(t,t+h.length)!=h){return 0}else{t+=h.length}}}}}}}}}}}}}}if(t!=l.length){return 0}if(a==2){if(((e%4==0)&&(e%100!=0))||(e%400==0)){if(A>29){return 0}}else{if(A>28){return 0}}}if((a==4)||(a==6)||(a==9)||(a==11)){if(A>30){return 0}}if(v<12&&k=="PM"){v=v-0+12}else{if(v>11&&k=="AM"){v-=12}}var r=new Date(e,a-1,A,v,f,m);return r.getTime()};Util.prototype.GetValue=function(b,a){if(b===undefined||b===null){return a}return b};Util.prototype.DiscardElement=function(b){var a=document.getElementById("IELeakGarbageBin");if(!a){a=document.createElement("DIV");a.id="IELeakGarbageBin";a.style.display="none";document.body.appendChild(a)}try{a.appendChild(b)}catch(c){}a.innerHTML="";try{if(b.removeNode){b.removeNode(false)}}catch(c){}};Util.prototype.formatAddress=function(a,b){var c=[];if(!String.IsNullOrEmpty(a.Road)){c.push(a.Road)}if(!String.IsNullOrEmpty(a.Town)){c.push(a.Town)}if(!String.IsNullOrEmpty(a.District)){c.push(a.District)}if(!String.IsNullOrEmpty(a.Province)){c.push(a.Province)}if(!String.IsNullOrEmpty(a.PostCode)){c.push(a.PostCode)}if(!String.IsNullOrEmpty(a.Country)){c.push(a.Country)}else{if(!String.IsNullOrEmpty(a.CountryISO)){c.push(a.CountryISO)}}return c.join(b)};Util.prototype.GetQueryStringValue=function(f,c){f=f.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var d="[\\?&]"+f+"=([^&#]*)";var b=new RegExp(d);var a=(c)?c:window.location.href;var e=b.exec(a);if(e==null){return""}else{return e[1]}};Util.prototype.getUnitDiametre=function(b,a){if(b.HasPreference(2,49)){return Math.round(a)}else{return Math.round(a*1.0936133)}};Util.prototype.Trim=function(a){return this.LTrim(this.RTrim(a))};Util.prototype.LTrim=function(a){if(a==null){return null}for(var b=0;a.charAt(b)==" ";b++){}return a.substring(b,a.length)};Util.prototype.RTrim=function(a){if(a==null){return null}for(var b=a.length-1;a.charAt(b)==" ";b--){}return a.substring(0,b+1)};$j(window).load(function(){util=new Util()});function Table(){var a=this;a.leftOpen=true;a.dialogLoaded=false;a.widthOffset=1;a.heightOffset=7;a.guid="";a.clickbound=true}Table.prototype.WireEvents=function(){var a=this;a.SetEvents();a.InitialiseTableSorts();a.BindFilter()};Table.prototype.ReWireEvents=function(){var a=this;a.SetEvents();a.RefreshTableSorts()};Table.prototype.SetEvents=function(){var a=this;var c=$j(".listing");for(var b=0;b<c.length;b++){var d=$j(c[b]);a.SetAltRows(d);var e=d.find("tr");if(d.attr("enableRowHighlight")==undefined||d.attr("enableRowHighlight")=="true"){e.hover(function(){$j(this).addClass("highlight");$j(this).removeClass("normal")},function(){$j(this).removeClass("highlight")})}if(d.attr("enableRowClick")==undefined||d.attr("enableRowClick")=="true"){e.find("td:not('.notclickable')").click(function(){a.RowClick(this);return false})}}};Table.prototype.InitialiseTableSorts=function(){var c=$j(".listing");for(var b=0;b<c.length;b++){var d=$j(c[b]);if(d.attr("enableSort")==undefined||d.attr("enableSort")=="true"){d.tablesorter()}}var e=$j(".listing2");for(var b=0;b<e.length;b++){var a=$j(e[b]);if(a.attr("enableSort")==undefined||a.attr("enableSort")=="true"){a.tablesorter()}}};Table.prototype.RefreshTableSorts=function(){var c=$j(".listing");for(var b=0;b<c.length;b++){var d=$j(c[b]);if(d.attr("enableSort")==undefined||d.attr("enableSort")=="true"){d.trigger("update")}}var e=$j(".listing2");for(var b=0;b<e.length;b++){var a=$j(e[b]);if(a.attr("enableSort")==undefined||a.attr("enableSort")=="true"){a.trigger("update")}}};Table.prototype.SetAltRows=function(a){a.find("tr").removeClass("altrow");a.find("tr:visible::even").addClass("altrow")};Table.prototype.BindFilter=function(){var b=this;var a=$j("#filter");Timer="";Timeout=350;a.keyup(function(){clearTimeout(Timer);Timer=setTimeout($j.proxy(b.DoFilter,this),Timeout)})};Table.prototype.DoFilter=function(b){var a=this;clearTimeout(Timer);if($j.metadata&&($j(this).metadata()&&$j(this).metadata().columns)){var c=$j(this).metadata().columns}$j.uiTableFilter($j(this).parents().find("table:first"),this.value,c);Table.prototype.SetAltRows($j(this).parents().find("table:first"))};Table.prototype.UnBindClick=function(){var a=this;a.clickbound=false};Table.prototype.BindClick=function(){var a=this;a.clickbound=true};Table.prototype.RowClick=function(h){var g=this;var a=$j(h).parent();var d=a.attr("id");if(d!=""&&g.clickbound){var c=a.attr("url");var i=a.attr("jsObjectType");var f=a.attr("parentObj");var b=a.attr("historyCallback");if(f&&b){b=$j.proxy(window[f][b],window[f])}contentController.LoadUrl(c,i,null,b)}};Table.prototype.TableLoad_CallBack=function(){var a=this;table.WireEvents()};Table.prototype.Highlight=function(a){if(util){var b=util.GetQueryStringValue("id",a);if(!String.IsNullOrEmpty(b)){var c=$j("#"+b);if(c.length){c.addClass("highlight").switchClass("highlight","normal",5000)}}}};$j(window).load(function(){table=new Table()});function ToolTip(){var a=this}ToolTip.prototype.WireEvents=function(){var a=this;a.SetEvents()};ToolTip.prototype.SetEvents=function(){var a=this;var d=$j("img.helptipimg");for(var b=0;b<d.length;b++){var c=$j(d[b]);c.tooltip({position:"center right",offset:[0,10]})}};$j(window).load(function(){tooltip=new ToolTip()});var pickerGroupMgr=null;function GenericPicker(a,e){var c=this;c.pickerName=a;c.defaults={PickerType:0};c.properties=$j.extend(true,{},c.defaults,e);c.overpicker=false;c.SetText(null);c.visible=false;c.isGrouped=false;c.itemClickedEvents=[];c.onCloseEvents=[];c.enabledItems=[];var d=$j("#"+c.pickerName+"_SingleSelect").val();c.isSingleSelect=(d==="True"||d==="true");$j(document).click(function(){if(c.overpicker==false){c.Hide()}});$j("#rightblock").scroll(function(){c.Hide()});var b=$j("#"+c.pickerName+"_Group");if(b.length>0){c.groupName=b.val();c.AddToGroup(c.groupName);c.isGrouped=true}c.loadData()}GenericPicker.prototype.ItemClick=function(f){var d=this;var c=f.checked;var g=$j("#"+f.id);var a=$j("#"+d.pickerName+"_input");var b=$j("[GenericPickerName="+d.pickerName+"]");if(f.value==-1){b.each(function(){if($j(this).attr("id")!=f.id){this.checked=(this.name==d.pickerName+"_ItemId");this.disabled=c}})}if(d.isSingleSelect){b.each(function(){if($j(this).attr("id")!=f.id){this.checked=false}})}if(f.name==d.pickerName+"_GroupId"){b.each(function(){if($j(this).attr("id")!=f.id&&$j(this).attr("GroupId")==g.attr("GroupId")){this.checked=true;this.disabled=c}})}d.deselectGroupedPickers();d.SetText(b);d.ItemClicked(f,d);if(d.isSingleSelect){d.ToggleShowHide()}};GenericPicker.prototype.SetText=function(b){var a=this;var c=$j("#"+a.pickerName+"_input");if(b==null){var b=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]")}var d="";b.each(function(){if(this.checked&&!this.disabled){if(d==""){d=$j(this).attr("txt")}else{d=d+","+$j(this).attr("txt")}}});d=d.substring(0,30);if(d.length>=30){d=d+"..."}if(d.length==0){d="Please Select"}c.attr("value",d)};GenericPicker.prototype.GetSelectedItemIds=function(d){var a=this;var b=[];if(c==null){var c=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]")}c.each(function(){if(this.checked&&!this.disabled){var e=$j(this);b.push(e.attr("value"))}});return b};GenericPicker.prototype.SetSelectedItems=function(d){var a=this;var c=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]");var b=[];if(d instanceof Array){b=d}else{b=d.split(",")}c.each(function(){this.checked=false});a.selectItems(b,true);a.SetText()};GenericPicker.prototype.SetEnabledItems=function(b){var d=this;d.enabledItems=b.split(",");var e=$j("div.genericpicker");var c=e.find("[GenericPickerName="+d.pickerName+"]");c.each(function(){$j(this).attr("disabled","disabled")});for(var f=0;f<d.enabledItems.length;f++){var a=c.find("[value="+d.enabledItems[f]+"]");a.removeAttr("disabled")}};GenericPicker.prototype.GetText=function(){var b=this;var a=$j("#"+b.pickerName+"_input");return a.val()};GenericPicker.prototype.GetSelectedPoi=function(){var a=this;var c={};if(b==null){var b=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]")}var d="";b.each(function(){if(this.checked&&!this.disabled){var e=$j(this);if(e.data("Id")){c=e.data()}else{c.Latitude=$j(this).attr("latitude");c.Longitude=$j(this).attr("longitude");c.Diametre=$j(this).attr("diametre");c.UserDiametre=$j(this).attr("userdiametre")}c.Text=$j(this).attr("txt");return c}});return c};GenericPicker.prototype.GetClientDataValueSerialised=function(a,d){var e=this;var c="";if(b==null){var b=$j("div.genericpicker").find("[GenericPickerName="+e.pickerName+"]")}var f="";b.each(function(){if(this.checked&&!this.disabled){var g=$j(this);if(g.data(a)){c+="&"+d+"="+g.data(a)}}});return c};GenericPicker.prototype.SelectedValue=function(){var a=this;if(b==null){var b=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]")}var c="";b.each(function(){if(this.checked&&!this.disabled){if(c.length>0){c+=","}c+=$j(this).attr("value")}});return c};GenericPicker.prototype.ToggleShowHide=function(){var a=this;if($j("#"+a.pickerName).hasClass("show")){a.Hide()}else{a.Show()}};GenericPicker.prototype.Show=function(){var a=this;if(!a.visible){var b=$j("#"+a.pickerName);b.removeClass("hide");b.addClass("show");var d=$j("#"+a.pickerName+"_input");var c=d.position();b.css("top",c.top);b.css("left",c.left);$j("#"+a.pickerName).iframeshim()}a.visible=true};GenericPicker.prototype.Hide=function(){var a=this;if(a.visible){$j("#"+a.pickerName).removeClass("show");$j("#"+a.pickerName).addClass("hide");$j(".bgiframe").remove();a.IsSelected();a.Close(a)}a.visible=false};GenericPicker.prototype.IsSelected=function(){var a=this;var c=$j("div.genericpicker").find("[GenericPickerName="+a.pickerName+"]");var b=false;c.each(function(){if(this.checked){b=true}});if(b){$j("#"+a.pickerName+"_IsSelected").attr("value","selected")}else{$j("#"+a.pickerName+"_IsSelected").attr("value","")}return b};GenericPicker.prototype.ClearAll=function(){var b=this;var a=$j("div.genericpicker").find("[GenericPickerName="+b.pickerName+"]");if(b.enabledItems.length==0){a.each(function(){this.checked=false;this.disabled=false})}else{b.selectItems(b.enabledItems,false)}b.SetText(a)};GenericPicker.prototype.ClearGroup=function(c){var f=this;var b=$j("div.genericpicker").find("[GenericPickerName="+f.pickerName+"]");var d=b.find("[groupid="+c+"]");var e=$j("#"+f.pickerName+"_1");if(f.enabledItems.length==0){d.each(function(){if(!e.attr("checked")){this.checked=false;this.disabled=false}})}else{for(var g=0;g<f.enabledItems.length;g++){var a=b.find("[value="+f.enabledItems[g]+"]");a.removeAttr("checked");a.removeAttr("disabled")}}f.SetText(d)};GenericPicker.prototype.AddToGroup=function(a){var b=this;if(pickerGroupMgr==null){pickerGroupMgr={}}if(pickerGroupMgr[a]==null){pickerGroupMgr[a]=[]}pickerGroupMgr[a].push(b)};GenericPicker.prototype.deselectGroupedPickers=function(){var a=this;if(a.isGrouped&&pickerGroupMgr!=null){for(var b=0;b<pickerGroupMgr[a.groupName].length;b++){var c=pickerGroupMgr[a.groupName][b];if(c.pickerName!==a.pickerName){c.ClearAll();$j("#"+c.pickerName+"_IsSelected").attr("value","")}}}};GenericPicker.prototype.ItemClicked=function(d,a){var c=a;for(var b=0;b<c.itemClickedEvents.length;b++){c.itemClickedEvents[b](d,c)}};GenericPicker.prototype.OnItemClicked=function(a){var b=this;b.itemClickedEvents.push(a)};GenericPicker.prototype.Close=function(c){var a=c;for(var b=0;b<a.onCloseEvents.length;b++){a.onCloseEvents[b](a)}};GenericPicker.prototype.OnClose=function(a){var b=this;b.onCloseEvents.push(a)};GenericPicker.prototype.Enable=function(){var a=this;a.enabled(true)};GenericPicker.prototype.Disable=function(){var a=this;a.enabled(false)};GenericPicker.prototype.Refresh=function(){var a=this;var b=new LoadProgress(a.pickerName+"_Progress",a.pickerName+"_input");b.Enabled(true);b.AddItem("Refresh");var d=function(h){var f=new StringBuilder();for(var e=0;e<h.length;e++){var g=h[e];f.Append("<div>");f.AppendFormat('<input type="checkbox" id="{0}_{1}" value="{2}" name="{0}_ItemId" onclick="javascript:{0}Picker.ItemClick(this);" GenericPickerName="{0}" txt="{3}" latitude="{4}" longitude="{5}" diametre="{6}" userdiametre="{7}" />',a.pickerName,e,g.PointOfInterestId,g.Name,g.Latitude,g.Longitude,g.Diametre,g.UserDiametre);f.AppendFormat('<span class="item">{0}</span>',g.Name);f.Append("</div>")}$j("#"+a.pickerName).html(f.ToString());b.RemoveItem("Refresh")};if(a.properties.PickerType===PickerType.PointOfInterest){var c=new PointOfInterestData();c.List(PointOfInterestType.PointOfInterest,d)}else{if(a.properties.PickerType===PickerType.NoGoZone){var c=new PointOfInterestData();c.List(PointOfInterestType.NoGoZone,d)}else{if(a.properties.PickerType===PickerType.GeoFence){var c=new PointOfInterestData();c.List(PointOfInterestType.GeoFence,d)}}}};GenericPicker.prototype.enabled=function(b){var a=this;var c=$j("#"+a.pickerName+"_input");if(b){c.removeAttr("disabled")}else{c.attr("disabled","disabled")}};GenericPicker.prototype.selectItems=function(a,b){var c=this;var e=$j("div.genericpicker");for(var f=0;f<a.length;f++){var d=e.find("[GenericPickerName="+c.pickerName+"][value="+a[f]+"]");d.attr("checked",b)}};GenericPicker.prototype.loadData=function(){var a=this;var b=window[a.pickerName+"ClientData"];if(b){var d=$j("#"+a.pickerName).find("input[type=checkbox][value!=-1]");for(var e=0,c=b.length;e<c;e++){$j.data(d[e],b[e])}}};function HistoryController(){var a=this;a.key="3dTracking.History";a.init()}HistoryController.prototype.GetPrevious=function(){var b=this;var a=b.get();if(b.HasHistory()){a.pop();return a.pop()}else{return null}};HistoryController.prototype.Add=function(c){var a=this;var b=a.get();if(!b){b=[]}else{if(!c.ObjectType){b=[]}}b.push(c);a.set(b)};HistoryController.prototype.AddToPrevious=function(d){var a=this;if(a.HasHistory()){var c=a.get();var b=c[c.length-2];c[c.length-2]=$j.extend(true,{},b,d);a.set(c)}};HistoryController.prototype.GetHistory=function(){var a=this;return a.get()};HistoryController.prototype.HasHistory=function(){var b=this;var a=b.get();return(a&&a.length>1)};HistoryController.prototype.init=function(){var b=this;var a=b.get();if(a){$j.jStorage.deleteKey(b.key)}};HistoryController.prototype.get=function(){var a=this;return $j.jStorage.get(a.key)};HistoryController.prototype.set=function(a){var b=this;return $j.jStorage.set(b.key,a)};function DateTimeSelect(c,b){var d=c.replace("Date","");var a=this;a.util=new Util();a.dateFormat=b;a.dateElement=$j("#"+c);a.hourElement=a.getElement(d,"hour");a.minuteElement=a.getElement(d,"minute")}DateTimeSelect.prototype.ToString=function(){var b=this;var a="";if(b.dateElement.length>0&&!String.IsNullOrEmpty(b.dateElement.val())){a+=b.dateElement.val()}if(b.hourElement.length>0&&!String.IsNullOrEmpty(b.hourElement.val())&&b.minuteElement.length>0&&!String.IsNullOrEmpty(b.minuteElement.val())){a+=String.format(" {0}:{1}:00",b.hourElement.val(),b.minuteElement.val())}else{a+=" 00:00:00"}return a};DateTimeSelect.prototype.Compare=function(b){var a=this;var d=util.getDateFromFormat(a.ToString(),a.dateFormat);var c=util.getDateFromFormat(b.ToString(),a.dateFormat);if(d<c){return -1}else{if(d>c){return 1}else{return 0}}};DateTimeSelect.prototype.IsSet=function(){var a=this;return !String.IsNullOrEmpty(a.dateElement.val())};DateTimeSelect.prototype.getElement=function(a,b){return $j("#"+a+b)};function AjaxDataSource(){var a=this}AjaxDataSource.prototype.Get=function(a,b,d,c){$j.ajax({url:a,type:"GET",data:b,dataType:"json",success:d,error:c,cache:false})};AjaxDataSource.prototype.GetHtml=function(a,b,c){$j.ajax({url:a,type:"GET",data:b,dataType:"html",success:c,cache:false})};AjaxDataSource.prototype.GetText=function(a,b,c){$j.ajax({url:a,type:"GET",data:b,dataType:"text",success:c,cache:false})};AjaxDataSource.prototype.Post=function(a,b,c){$j.ajax({url:a,type:"POST",data:b,dataType:"json",success:c,cache:false})};function UnAuthAjaxDataSource(a){var b=this;b.credentials=a}UnAuthAjaxDataSource.prototype=new AjaxDataSource();UnAuthAjaxDataSource.prototype.Get=function(a,b,d){var c=this;b=c.attachCredentials(b);AjaxDataSource.prototype.Get.call(c,a,b,d)};UnAuthAjaxDataSource.prototype.GetHtml=function(a,b,d){var c=this;b=c.attachCredentials(b);AjaxDataSource.prototype.GetHtml.call(c,a,b,d)};UnAuthAjaxDataSource.prototype.GetText=function(a,b,d){var c=this;b=c.attachCredentials(b);AjaxDataSource.prototype.GetText.call(c,a,b,d)};UnAuthAjaxDataSource.prototype.Post=function(a,b,d){var c=this;b=c.attachCredentials(b);AjaxDataSource.prototype.Post.call(c,a,b,d)};UnAuthAjaxDataSource.prototype.attachCredentials=function(a){var b=this;return $j.extend(true,{},a,b.credentials)};function AccountData(){var a=this;a.DataSource=new AjaxDataSource()}AccountData.prototype.SignOut=function(a){var b=this;b.DataSource.Get("/Account/SignOut",{},a)};function AdminData(){var a=this;a.DataSource=new AjaxDataSource()}AdminData.prototype.TripTypeSetStatus=function(d,b,c){var a=this;a.DataSource.Post("/admin/TripTypeSetStatus",{tripTypeId:d,statusId:b},c)};AdminData.prototype.TripExtraCostTypeSetStatus=function(a,b,d){var c=this;c.DataSource.Post("/admin/TripExtraCostTypeSetStatus",{tripextracostTypeId:a,statusId:b},d)};function CustomerData(){var a=this;a.DataSource=new AjaxDataSource()}CustomerData.prototype.Location=function(c,b){var a=this;a.DataSource.Get("/Customer/Location/"+c,null,b)};CustomerData.prototype.LocationSetStatus=function(d,b,c){var a=this;a.DataSource.Post("/Customer/LocationSetStatus",{locationId:d,statusId:b},c)};CustomerData.prototype.LocationSave=function(d,b,c){var a=this;a.DataSource.Post("/Customer/LocationSave/"+d,b,c)};function LiveData(){var a=this;a.DataSource=new AjaxDataSource()}LiveData.prototype.GetUnits=function(b,c){var a=this;a.DataSource.GetHtml("/Live/Units",b,c)};LiveData.prototype.GetTrips=function(b,c){var a=this;a.DataSource.GetHtml("/Live/Trips",{unitId:b},c)};LiveData.prototype.GetTaskStops=function(b,c){var a=this;a.DataSource.GetHtml("/Live/TaskStops",{unitId:b},c)};function LocationData(){var a=this;a.DataSource=new AjaxDataSource()}LocationData.prototype.Find=function(b,c){var a=this;a.DataSource.Get("/Location/Find",b,c)};LocationData.prototype.FindAddress=function(b,c){var a=this;a.DataSource.Get("/Location/FindAddress",b,c)};function MapTwentyFourData(b){var a=this;if(b){a.DataSource=b}else{a.DataSource=new AjaxDataSource()}}MapTwentyFourData.prototype.Initiate=function(a){var b=this;b.DataSource.GetText("/MapTwentyFour/Initiate",a)};MapTwentyFourData.prototype.ShowTrip=function(c,b){var a=this;a.DataSource.GetText("/MapTwentyFour/ShowTrip/"+c,b)};function OrderData(){var a=this;a.DataSource=new AjaxDataSource()}OrderData.prototype.GetCustomerOrderDetails=function(b,c){var a=this;a.DataSource.Get("/Customer/ListAllOrderDetails",b,c)};OrderData.prototype.GetTasks=function(b,c){var a=this;a.DataSource.Get("/Task/List/",b,c)};OrderData.prototype.GetTaskStops=function(b,c){var a=this;a.DataSource.Get("/TaskStop/List/",b,c)};OrderData.prototype.GetTaskStop=function(b,c){var a=this;a.DataSource.Get("/TaskStop/Get/"+b,{},c)};function PointOfInterestData(){var a=this;a.DataSource=new AjaxDataSource()}PointOfInterestData.prototype.Get=function(a,c,d){var b=this;b.DataSource.Get("/PointOfInterest/Fetch/"+a,{typeId:c},d)};PointOfInterestData.prototype.List=function(b,c){var a=this;a.DataSource.Get("/PointOfInterest/List/"+b,{typeId:b},c)};PointOfInterestData.prototype.MultiList=function(a,c){var b=this;var d=a.split(",").join("&typeId=");b.DataSource.Get("/PointOfInterest/MultiList/?typeId="+d,{},c)};PointOfInterestData.prototype.Save=function(b,c){var a=this;a.DataSource.Post("/PointOfInterest/Save/",b,c)};function UnitData(b){var a=this;if(b){a.DataSource=b}else{a.DataSource=new AjaxDataSource()}}UnitData.prototype.GetGroups=function(a){var b=this;b.DataSource.Get("/Unit/Groups",{},a)};UnitData.prototype.GetLatestPoint=function(b,c,d){var a=this;a.DataSource.Get("/Unit/LatestPoint/"+b,{latestPointOnly:c},d)};UnitData.prototype.GetTrip=function(b,c){var a=this;a.DataSource.Get("/Unit/Trip/"+b,{},c)};UnitData.prototype.List=function(b,a,d){var c=this;var e=(b!==null&&b!="-1"&&b!=-1)?"/Unit/List/"+b:"/Unit/List";c.DataSource.Get(e,{saveunitgroup:a},d)};UnitData.prototype.SendPeripheralMessage=function(b,c){var a=this;a.DataSource.Post("/Unit/SendPeripheralMessage",b,c)};function CompanyData(){var a=this;a.DataSource=new AjaxDataSource()}CompanyData.prototype.IpRange=function(b,c){var a=this;a.DataSource.Get("/Distributor/IPRange/"+b,null,c)};function MessagingData(){var a=this;a.DataSource=new AjaxDataSource()}MessagingData.prototype.MessageCount=function(c,b){var a=this;a.DataSource.Get("/Live/MessageCount",{},c,b)};