/**
* (c) 2008 mOblu, inc.
* All rights are reserved. Copying or other reproduction of this program is prohibited.
*/
var gLittlePopup=null;var newWin=function(_1){gLittlePopup=window.open(_1,"TheLittlePopoupWindow","dependent=0,resizable=1,status=0,menubar=0,toolbar=0,scrollbars=1,location=0,directories=0,width=450,height=400");try{gLittlePopup.resizeTo(460,430);gLittlePopup.focus();}catch(e){}};__wmmod.prototype.m_sMaskTpl="<div class=\"dialogwindow\" style=\"width:50px;height:48px;\"><img style=\"margin:5px;display:block;\"src=\"/wmdata/media/shared/spinner.gif\" /></div>";__wmmod_dlg.prototype.m_sLoadingTpl="<div class=\"dialogwindow\" style=\"width:50px;height:48px;\"><img style=\"margin:5px;display:block;\"src=\"/wmdata/media/shared/spinner.gif\" /></div>";webblerprogressdialog.prototype.fetchdialog=function(){return __wmmod_dlg.prototype.m_sLoadingTpl;};dialogbase.BKGIMAGE=(window.location.protocol+"//"+window.location.host+"/wmdata/media/shared/dlgmask.gif");function str_replace(_2,_3,_4){var f=_2,r=_3,s=_4;var ra=r instanceof Array,sa=s instanceof Array,f=[].concat(f),r=[].concat(r),i=(s=[].concat(s)).length;while(j=0,i--){if(s[i]){while(s[i]=s[i].split(f[j]).join(ra?r[j]||"":r[0]),++j in f){}}}return sa?s:s[0];};function htmlentities(_b){var _c={},_d=0,_e=[],i=0;var _10=0;_c["34"]="quot";_c["38"]="amp";_c["60"]="lt";_c["62"]="gt";_c["160"]="nbsp";_c["161"]="iexcl";_c["162"]="cent";_c["163"]="pound";_c["164"]="curren";_c["165"]="yen";_c["166"]="brvbar";_c["167"]="sect";_c["168"]="uml";_c["169"]="copy";_c["170"]="ordf";_c["171"]="laquo";_c["172"]="not";_c["173"]="shy";_c["174"]="reg";_c["175"]="macr";_c["176"]="deg";_c["177"]="plusmn";_c["178"]="sup2";_c["179"]="sup3";_c["180"]="acute";_c["181"]="micro";_c["182"]="para";_c["183"]="middot";_c["184"]="cedil";_c["185"]="sup1";_c["186"]="ordm";_c["187"]="raquo";_c["188"]="frac14";_c["189"]="frac12";_c["190"]="frac34";_c["191"]="iquest";_c["192"]="Agrave";_c["193"]="Aacute";_c["194"]="Acirc";_c["195"]="Atilde";_c["196"]="Auml";_c["197"]="Aring";_c["198"]="AElig";_c["199"]="Ccedil";_c["200"]="Egrave";_c["201"]="Eacute";_c["202"]="Ecirc";_c["203"]="Euml";_c["204"]="Igrave";_c["205"]="Iacute";_c["206"]="Icirc";_c["207"]="Iuml";_c["208"]="ETH";_c["209"]="Ntilde";_c["210"]="Ograve";_c["211"]="Oacute";_c["212"]="Ocirc";_c["213"]="Otilde";_c["214"]="Ouml";_c["215"]="times";_c["216"]="Oslash";_c["217"]="Ugrave";_c["218"]="Uacute";_c["219"]="Ucirc";_c["220"]="Uuml";_c["221"]="Yacute";_c["222"]="THORN";_c["223"]="szlig";_c["224"]="agrave";_c["225"]="aacute";_c["226"]="acirc";_c["227"]="atilde";_c["228"]="auml";_c["229"]="aring";_c["230"]="aelig";_c["231"]="ccedil";_c["232"]="egrave";_c["233"]="eacute";_c["234"]="ecirc";_c["235"]="euml";_c["236"]="igrave";_c["237"]="iacute";_c["238"]="icirc";_c["239"]="iuml";_c["240"]="eth";_c["241"]="ntilde";_c["242"]="ograve";_c["243"]="oacute";_c["244"]="ocirc";_c["245"]="otilde";_c["246"]="ouml";_c["247"]="divide";_c["248"]="oslash";_c["249"]="ugrave";_c["250"]="uacute";_c["251"]="ucirc";_c["252"]="uuml";_c["253"]="yacute";_c["254"]="thorn";_c["255"]="yuml";_b+="";_10=_b.length;for(i=0;i<_10;++i){_d=_b.charCodeAt(i);if(_d in _c){_e[i]="&"+_c[_d]+";";}else{_e[i]=_b.charAt(i);}}return _e.join("");};var EnumTripModes={Airplane:3,Automobile:2,Bus:28822,Cycle:28819,Motorcycle:28820,Scooter:28823,Train:28821,Walk:28818,exists:function(id){for(var i in this){if(typeof this[i]=="number"&&id==this[i]){return true;}}return false;}};var EnumTripConsts={MAX_STEPS:30,SEL_SELECT_TRIP:-1,SEL_CREATE_TRIP:-2};var EnumTripWaypointTypes={LAND:0,AIR:1};var EnumTripCategories=["ROUTINE","COMMUTE","BUSINESS","HOLIDAY"];var CarbonEquivalency=[[1,8.78,"gallons of gasoline."],[2,2.319,"litres of gasoline."],[0,24,"propane cylinders used for home barbeques."],[0,4620,"passenger cars not driven for one year."],[0,5590,"passenger cars and light trucks not driven for one year."],[0,430,"barrels of oil."],[0,74600,"tanker trucks filled with gasoline."],[0,7790,"households electricity use for one year."],[0,39,"tree seedlings grown for 10 years."],[1,1200,"acres of pine or fir forests storing carbon for one year."],[2,2965.26,"hectares of pine or fir forests storing carbon for one year."],[1,122000,"acres of forest preserved from deforestation."],[2,296526,"hectares of forest preserved from deforestation."],[1,2970,"tons of waste recycled instead of landfilled."],[2,3274,"metric tonnes of waste recycled instead of landfilled."]];var TripConversions={"isMetric":true};TripConversions.getWeightAbbr=function(){return this.isMetric?"kg":"lbs";};TripConversions.getDistanceAbbr=function(){return this.isMetric?"km":"miles";};TripConversions.getMileageAbbr=function(){return this.isMetric?"kpl":"mpg";};TripConversions.getVolumeAbbr=function(){return this.isMetric?"L":"gal";};TripConversions.getWeight=function(kg){return this.isMetric?kg:kg*2.20462262;};TripConversions.getDistance=function(kms){return this.isMetric?kms:kms*0.621371192;};TripConversions.getMileage=function(kpl){return this.isMetric?kpl:kpl*2.35214584;};TripConversions.setIsMetric=function(b){this.isMetric=b;};TripConversions.getIsMetric=function(b){return this.isMetric;};function triStateButtonInit(btn,pfx,sfx){if(sfx==undefined){sfx=".png";}app.disallowselect(btn);var fn=(sfx==".png")?app.setPNG:function(img,src){img.src=src;};btn.onmouseover=function(){fn(this,pfx+"1"+sfx);};btn.onmouseout=function(){fn(this,pfx+"0"+sfx);};btn.onmousedown=function(){fn(this,pfx+"2"+sfx);};btn.onmouseup=function(){fn(this,pfx+"1"+sfx);};};function triStateNativeButtonInit(btn){if(btn){btn.className="mobutton";btn.onmouseover=function(){this.className="mobutton mobutton-over";};btn.onmouseout=function(){this.className="mobutton";};btn.onmousedown=function(){this.className="mobutton mobutton-down";};btn.onmouseup=function(){this.className="mobutton mobutton-over";};}};function mOblu(){if(!__moblu.__instance){__moblu.__instance=new __moblu();}return __moblu.__instance;};function __moblu(){return this;};__moblu.prototype.toggleToolbox=function(box){var _20=box.className;if(_20.match(/toolbox-closed/)){_20=_20.replace(/toolbox-closed/,"").trim();}else{_20=_20+" toolbox-closed";}box.className=_20;};__moblu.prototype.setSelOpts=function(sel,_22,val,_24){sel.options.length=_22.length;for(var i=0;i<_22.length;i++){sel.options[i].value=_22[i][0];sel.options[i].text=_22[i][1];if(_24){for(var j=2;j<_22[i].length;j++){if(_24.length>j-2){sel.options[i].setAttribute(_24[j-2],_22[i][j]);}}}}sel.value=val;};__moblu.prototype.getUserTZOffset=function(_27){var _28=Date.toString();var _29=app.xmlrpc.Call(BF_WS_URL,BF_KEY,"Com_GoBasis_Schedule_Services.GetUserTimezoneOffset",_28);if(app.xmlrpc.fault(_29,true)){_29=0;}return _29;};__moblu.prototype.animate_integer_style_property=function(el,_2b,_2c,_2d,_2e,fps,_30,_31,_32,_33,_34){if(!_34){if(!el.__integer_style_animation_timers){el.__integer_style_animation_timers={};}clearTimeout(el.__integer_style_animation_timers[_2b]);_34=new Date().getTime();this.set_integer_style_property(el,_2b,_2c,_30,_31);}else{var _35=_34+_2e;var _36=new Date().getTime()-_34;if(_36<_2e){var vt=((_2d-_2c)*(_36/_2e))+_2c;this.set_integer_style_property(el,_2b,vt,_30,_31);}else{this.set_integer_style_property(el,_2b,_2d,_30,_31);if(_32){_32.fire();}return;}}if(_33){_33.fire();}var fn=function(){mOblu().animate_integer_style_property(el,_2b,_2c,_2d,_2e,fps,_30,_31,_32,_33,_34);};el.__integer_style_animation_timers[_2b]=setTimeout(fn,1000/fps);};__moblu.prototype.set_integer_style_property=function(el,_3a,val,_3c,_3d){switch(_3a){case "alpha":app.setAlpha(el,Math.floor(val));break;default:el.style[_3a]=_3c+parseInt(val)+_3d;}};__moblu.prototype.showFault=function(err,cb){if(app.xmlrpc.fault(err,false)){this.showMessage("Error",err.faultString,cb);return true;}return false;};__moblu.prototype.showMessage=function(_40,_41,cb,_43,_44){webbler().renderDialog("{7ba81ea8-ff1e-102a-aeff-b9c19dcb2557}",{"title":_40,"message":_41,"flags":_43===undefined?DLG_OK_ONLY|DLG_DEFAULT1:_43,"labels":_44},cb,true);};__moblu.prototype.renderFill=function(_45,oCB){if(!app.isObject(_45)){_45={};if(app.isFunction(window["VM"])){_45.idVehicle=VM().midV;}}app.inherit(_45,{bIsDialog:true});webbler().renderDialog("{745d3f89-e874-102b-803e-a3b5a20c5586}",_45,new Functor(this,function(_47){Functor.fire(oCB);}),true);};__moblu.prototype.renderEvent=function(_48,oCB){if(!app.isObject(_48)){_48={};if(app.isFunction(window["VM"])){_48.idVehicle=VM().midV;}}app.inherit(_48,{bIsDialog:true});webbler().renderDialog("{44b3e02e-33e0-102c-ad40-51990a67e445}",_48,new Functor(this,function(_4a){Functor.fire(oCB);}),true);};__moblu.prototype.renderImport=function(_4b,oCB){if(!app.isObject(_4b)){_4b={};if(app.isFunction(window["VM"])){_4b.idVehicle=VM().midV;}}app.inherit(_4b,{bIsDialog:true});webbler().renderDialog("{c79448c9-1460-102d-b721-68b75fb77730}",_4b,new Functor(this,function(_4d){Functor.fire(oCB);}),true);};__moblu.prototype.followVehicle=function(_4e,oCB){return app.xmlrpc.Call(BF_WS_URL,BF_KEY,_4e+".wsFollow",[],EMPTY_UUID,true,function(_50){if(!app.xmlrpc.fault(_50,false)){dojo.publish("vehicle/follow",_50);}Functor.fire(oCB,[_50]);});};__moblu.prototype.unfollowVehicle=function(_51,oCB){return app.xmlrpc.Call(BF_WS_URL,BF_KEY,_51+".wsUnfollow",[],EMPTY_UUID,true,function(_53){if(!app.xmlrpc.fault(_53,false)){dojo.publish("vehicle/unfollow",_53);}Functor.fire(oCB,[_53]);});};__moblu.prototype.toggleFollowVehicle=function(_54,_55,_56){if(_55=="1"){mOblu().followVehicle(_54,function(_57){if(!mOblu().showFault(_57)){_56.innerHTML="Stop Following";_56.setAttribute("bFollow","0");}});}else{mOblu().unfollowVehicle(_54,function(_58){if(!mOblu().showFault(_58)){_56.innerHTML="Follow";_56.setAttribute("bFollow","1");}});}};(function(){if(window["dojo"]){dojo.subscribe("vehicle/follow",null,function(_59,_5a,_5b){var _5c=window.location.pathname.split("/");var _5d=_5c[1];var _5e=_5c[2];if(_5d.toLowerCase()!="profiles"||_5e==BF_USERNAME){var e=$("following_count");if(e){e.innerHTML=parseInt(e.innerHTML)+1;}}});dojo.subscribe("vehicle/unfollow",null,function(_60,_61,_62){var _63=window.location.pathname.split("/");var _64=_63[1];var _65=_63[2];if(_64.toLowerCase()!="profiles"||_65==BF_USERNAME){var e=$("following_count");if(e){e.innerHTML=parseInt(e.innerHTML)-1;}}});dojo.subscribe("inbox/opened",null,function(){var e=$("actions-new-messages-link");e.style.fontWeight="normal";e=$("actions-new-messages-count");e.innerHTML="";});}}());var TripModeSelControl=function(_68,_69,_6a,_6b,_6c,_6d,_6e,_6f,oCB){this.init(idEl,oCB);};TripModeSelControl.prototype={hide:function(a){a=[].concat(a);for(var i=0;i<a.length;i++){a.style.display="none";}},show:function(){a=[].concat(a);for(var i=0;i<a.length;i++){a.style.display="";}},init:function(_74,_75,_76,oCB){this.eLoad=$(idLoad);this.eMode=$(_74);this.eMake=$(idMake);this.eModel=$(idModel);this.eLandA=$(_75);this.eLandB=$(_76);this.eAirA=$(_75);this.eAirB=$(_76);this.oCB=oCB;this.eMode.onchange=dojo.hitch(this,this.onMode);this.eMake.onchange=dojo.hitch(this,this.onMake);this.eModel.onchange=dojo.hitch(this,this.onModel);this.eMode.setAttribute("_value",this.eMode.value);this.show(this.eMode);this.hide([this.eLoad,this.eMake,this.eModel,this.eLandA,this.eLandB,this.eAirA,this.eAirB]);},destroy:function(){this.eMode.onchange=this.eMake.onchange=this.eModel.onchange=null;this.oCB=this.eLoad=this.eMode=this.eMake=this.eModel=this.eLandA=this.eLandB=this.eAirA=this.eAirB=null;},loadCarSel:function(_78,_79,_7a){this.eYear.disabled=this.eMake.disabled=this.eModel.disabled=true;return app.xmlrpc.Call(BF_WS_URL,BF_KEY,"Com_mOblu_Trip_Services."+_78,[_79],EMPTY_UUID,true,_7a,"json","xmlrpc");},onMode:function(){var _7b=this.eMode.value;if(_7b>0){this.eMode.setAttribute("_value",_7b);this.hide([this.eAirA,this.eAirB,this.eLandA,this.eLandB]);if(EnumTripModes.exists(_7b)){if(_7b==EnumTripModes.Airplane){this.show([this.eAirA,this.eAirB]);}else{this.show([this.eLandA,this.eLandB]);}}else{this.hide(this.eMode);this.show(this.eLoad);this.loadCarSel("GetCarMakeList",_7b,new Functor(this,function(_7c){this.hide(this.eLoad);if(app.xmlrpc.fault(_7c,true)){mOblu().setSelOpts(this.eMake,[],"");this.show(this.eMode);}else{_7c.splice(1,1);mOblu().setSelOpts(this.eMake,_7c,_7c[0][0]);this.eMake.setAttribute("_value",_7c[0][0]);this.show(this.eMake);}}));}}else{this.eMode.value=this.eMode.getAttribute("_value");}switch(this.eMode.value){case "":case "0":case "-1":case "-2":break;default:Functor.fire(this.oCB,[0]);this.eYear.setAttribute("_value",this.eYear.value);mOblu().setSelOpts(this.eMake,this.maLoadingOpts,"");mOblu().setSelOpts(this.eModel,[],"");this.loadCarSel("GetCarMakeList",this.eYear.value,new Functor(this,function(_7d){if(app.xmlrpc.fault(_7d,true)){mOblu().setSelOpts(this.eMake,[],"");this.eYear.disabled=false;}else{_7d.splice(1,1);mOblu().setSelOpts(this.eMake,_7d,_7d[0][0]);this.eMake.setAttribute("_value",_7d[0][0]);this.eYear.disabled=this.eMake.disabled=false;}}));break;}},onMake:function(){switch(this.eMake.value){case "":case "0":case "-1":case "-2":this.eMake.value=this.eMake.getAttribute("_value");break;default:Functor.fire(this.oCB,[0]);this.eMake.setAttribute("_value",this.eMake.value);mOblu().setSelOpts(this.eModel,this.maLoadingOpts,"");this.loadCarSel("GetCarModelList",this.eMake.value,new Functor(this,function(_7e){if(app.xmlrpc.fault(_7e,true)){mOblu().setSelOpts(this.eModel,[],"");this.eYear.disabled=this.eMake.disabled=false;}else{_7e.splice(1,1);mOblu().setSelOpts(this.eModel,_7e,_7e[0][0]);this.eModel.setAttribute("_value",_7e[0][0]);this.eYear.disabled=this.eMake.disabled=this.eModel.disabled=false;}}));break;}},onModel:function(){switch(this.eModel.value){case "":case "0":case "-1":case "-2":this.eModel.value=this.eModel.getAttribute("_value");break;default:this.eModel.setAttribute("_value",this.eModel.value);Functor.fire(this.oCB,[this.eModel.value]);break;}}};var StockAirportControl=function(_7f,oCB){this.init(_7f,oCB);};StockAirportControl.prototype={search:function(_81,_82,_83){return app.xmlrpc.Call(BF_WS_URL,BF_KEY,"Com_mOblu_Trip_Services.SearchAirports",[_81,_82],EMPTY_UUID,true,_83,"json","xmlrpc");},init:function(_84,oCB){var _86=250;app.addEvent(_84,"keydown",dojo.hitch(this,function(){Functor.fire(oCB,[0]);_84.setAttribute("idAirport",0);clearTimeout(this.__searchTimeout);var _87=_84.getAttribute("sLastValue");if(_87==null){_87="";}if(_87!=_84.value){_84.setAttribute("sLastValue",_84.value);this.__searchTimeout=setTimeout(dojo.hitch(this,function(){this.doFlightSearch(_84,1,oCB);}),_86);}}));},searchResults:function(_88){var p=this.m_search_panel;if(!p){p=this.m_search_panel=app.createElement("div",$("maincontainer")||$("mainbody"),false);p.className="airport-search-panel";p.hide();p.setPosition("absolute");}if(_88){var _8a=dojo.coords(_88);var _8b=dojo.coords($("maincontainer")||$("mainbody"));p.show();p.moveTo(_8a.x-_8b.x-1,_8a.y-_8b.y+17);}return p;},doFlightSearch:function(_8c,_8d,oCB){if(this.__searchPacket){this.__searchPacket.Abort();}Functor.fire(oCB,[0]);_8c.setAttribute("idAirport",0);var _8f=this.searchResults(_8c);_8f.innerHTML="Searching...";_8f.onclick=function(){};var _90=function(E){app.removeEvent(window,"click",_90);_8f.hide();};this.__searchPacket=this.search(_8c.value,_8d,dojo.hitch(this,function(_92){this.__searchPacket=null;if(_92!=undefined){if(app.xmlrpc.fault(_92,false)){_8f.innerHTML="";var _93=document.createElement("div");_93.innerText=_92.faultString;_93.className="error-block";var _94=document.createElement("a");_94.href="javascript:void(0)";_94.onclick=function(){_8f.hide();};_94.className="airport-search-link";_94.innerHTML="Close";_8f.appendChild(_93);_8f.appendChild(_94);}else{if(_92.aAirports.length==0){_8f.innerHTML="No matches found";}else{_8f.innerHTML="";var _95=_92.aAirports;for(var i=0;i<_95.length;i++){var _97=document.createElement("div");var _98=document.createElement("a");_97.className="airport-search-entry";_98.innerHTML=_95[i].sHtml;_98.setAttribute("sAirport",_95[i].sAirport);_98.setAttribute("idAirport",_95[i].idAirport);_98.setAttribute("gps",_95[i].fLat+","+_95[i].fLng);_98.href="javascript:void(0)";_98.onclick=function(){_8f.hide();_8c.value=this.getAttribute("sAirport");_8c.setAttribute("idAirport",this.getAttribute("idAirport"));_8c.setAttribute("gps",this.getAttribute("gps"));Functor.fire(oCB,[this.getAttribute("idAirport"),this.getAttribute("gps")]);};_97.appendChild(_98);_8f.appendChild(_97);}if(_92.bMoreResults){var _94=document.createElement("a");_94.href="javascript:void(0)";_94.onclick=dojo.hitch(this,function(){this.doFlightSearch(_8c,_8d+1,oCB);});_94.className="airport-search-link";_94.innerHTML="More Results";_8f.appendChild(_94);}}}}}),true);}};var StockCarSelControl=function(_99,_9a,_9b,oCB,_9d){this.init(_99,_9a,_9b,oCB,_9d);};StockCarSelControl.prototype={maLoadingOpts:[["","Loading..."]],init:function(_9e,_9f,_a0,oCB,_a2){this.eYear=$(_9e);this.eMake=$(_9f);this.eModel=$(_a0);this.oCB=oCB;this.bOneLine=_a2;this.eYear.onchange=dojo.hitch(this,this.onYear);this.eMake.onchange=dojo.hitch(this,this.onMake);this.eModel.onchange=dojo.hitch(this,this.onModel);},destroy:function(){this.eYear.onchange=this.eMake.onchange=this.eModel.onchange=null;this.oCB=this.eYear=this.eMake=this.eModel=null;},loadCarSel:function(_a3,_a4,_a5){this.eYear.disabled=this.eMake.disabled=this.eModel.disabled=true;return app.xmlrpc.Call(BF_WS_URL,BF_KEY,"Com_mOblu_Trip_Services."+_a3,[_a4],EMPTY_UUID,true,_a5,"json","xmlrpc");},onYear:function(){switch(this.eYear.value){case "":case "0":case "-1":case "-2":this.eYear.value=this.eYear.getAttribute("_value");break;default:this.eYear.setAttribute("_value",this.eYear.value);if(EnumTripModes.exists(this.eYear.value)||app.isuuid(this.eYear.value)){Functor.fire(this.oCB,[this.eYear.value]);}else{Functor.fire(this.oCB,[0]);if(this.bOneLine){this.eYear.style.display="none";this.eMake.style.display="";}mOblu().setSelOpts(this.eMake,this.maLoadingOpts,"");mOblu().setSelOpts(this.eModel,[],"");this.loadCarSel("GetCarMakeList",this.eYear.value,new Functor(this,function(_a6){if(app.xmlrpc.fault(_a6,true)){mOblu().setSelOpts(this.eMake,[],"");this.eYear.disabled=false;if(this.bOneLine){this.eYear.style.display="";this.eMake.style.display="none";}}else{if(!this.bOneLine){_a6.splice(1,1);}mOblu().setSelOpts(this.eMake,_a6,_a6[0][0]);this.eMake.setAttribute("_value",_a6[0][0]);this.eYear.disabled=this.eMake.disabled=false;}}));}break;}},onMake:function(){switch(this.eMake.value){case "":case "0":case "-1":case "-2":this.eMake.value=this.eMake.getAttribute("_value");if(this.bOneLine){Functor.fire(this.oCB,[0]);this.eYear.style.display="";this.eMake.style.display="none";this.eYear.value="";this.eYear.setAttribute("_value","");}break;default:Functor.fire(this.oCB,[0]);if(this.bOneLine){this.eMake.style.display="none";this.eModel.style.display="";}this.eMake.setAttribute("_value",this.eMake.value);mOblu().setSelOpts(this.eModel,this.maLoadingOpts,"");this.loadCarSel("GetCarModelList",this.eMake.value,new Functor(this,function(_a7){if(app.xmlrpc.fault(_a7,true)){mOblu().setSelOpts(this.eModel,[],"");this.eYear.disabled=this.eMake.disabled=false;if(this.bOneLine){this.eMake.style.display="";this.eModel.style.display="none";}}else{if(!this.bOneLine){_a7.splice(1,1);}mOblu().setSelOpts(this.eModel,_a7,_a7[0][0]);this.eModel.setAttribute("_value",_a7[0][0]);this.eYear.disabled=this.eMake.disabled=this.eModel.disabled=false;}}));break;}},onModel:function(){switch(this.eModel.value){case "":case "0":case "-1":case "-2":if(this.bOneLine){Functor.fire(this.oCB,[0]);this.eMake.style.display="";this.eModel.style.display="none";this.eMake.value="";this.eMake.setAttribute("_value","");}else{this.eModel.value=this.eModel.getAttribute("_value");}break;default:this.eModel.setAttribute("_value",this.eModel.value);Functor.fire(this.oCB,[this.eModel.value]);break;}}};Date.prototype.toUTC=function(){return (""+this.getUTCFullYear()+app.padString((this.getUTCMonth()+1),2,0)+app.padString(this.getUTCDate(),2,0)+"T"+app.padString(this.getUTCHours(),2,0)+app.padString(this.getUTCMinutes(),2,0)+app.padString(this.getUTCSeconds(),2,0)+"UTC");};Date.fromUTCStamp=function(ts){var _a9=ts*1000;var _aa=(new Date()).getTimezoneOffset()*60*1000;return new Date(_a9-_aa);};Date.prototype.getUTCTimeInSeconds=function(){var _ab=Math.round(this.getTime()/1000);var _ac=this.getTimezoneOffset()*60;return _ab+_ac;};Date.fromUTCString=function(ts){var y=str.substr(0,4);var m=str.substr(4,2)-1;var d=str.substr(6,2);var h=str.substr(9,2);var n=str.substr(11,2);var s=str.substr(13,2);return new Date(Date.UTC(y,m,d,h,n,s));};function FillWidget(){};function createFillWidget(_b4,_b5){app.inherit(_b4,FillWidget.prototype);_b4.init(_b5);};(function(){var F=FillWidget.prototype;F.meC=false;F.msT="{745d3f89-e874-102b-803e-a3b5a20c5586}";F.msCC="FillWidgetContainer";F.msC="FillWidget";F.msF="FillWidgetForm";F.msWsDelErr="wsDeleteError";F.msWsDelEntry="wsDeleteFill";F.msWsSaveEntry="wsSaveFill";F.msEvtComplete="vehicle/fill";F.msDlgErr="FillWidgetDlgError";F.msDlgDel="FillWidgetDlgDelete";F.init=function(_b7){this.mbInited=true;this.meC=$(this.msC);this.onLoad();};F.onLoad=function(){this.meF=$(this.msF);if(this.meF){this.meF.fVolume.onchange=this.meF.fPricePerUnit.onchange=function(){var _b8=this.form.fVolume.value*this.form.fPricePerUnit.value;this.form.fTotalCost.value=isNaN(_b8)?"??":_b8.toFixed(2);};}};F.isInited=function(){return this.mbInited;};F.reload=function(){this.mbAskMissedFill=false;this.dismissMessage();this.render({"idVehicle":this.meF.idVehicle.value});};F.onVehicleSelected=function(_b9){this.render({"idVehicle":_b9});};F.onCancelClick=function(){this.fire();};F.onAddVehicleClick=function(){window.location="/cars";};F.onWarningIgnored=function(_ba){this.meF.bIsMissed.value=_ba?1:0;this.onSubmitClick(true);};F.onDeleteClick=function(_bb){if(_bb){if(!this.m_oPkt){if(app.isuuid(this.meF.idError.value)){this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelErr](this.meF.idError.value);}else{this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelEntry](this.meF.idVehicle.value,this.meF.idFill.value,this.meF.bInsertMissed.value==1);}}}else{webbler().startMask(this.meC);webbler().setMask(this.meC,this.createMessage(this.msDlgDel));}};F.cbDelete=function(_bc){this.m_oPkt=null;if(_bc!==undefined){var _bd=app.xmlrpc.fault(_bc,false);if(_bd){webbler().setMask(this.meC,this.createMessage(this.msDlgErr,_bc.faultString));}else{dojo.publish(this.msEvtComplete,[this.meF.idVehicle.value]);this.fire();}}};F.onRecordClick=function(_be){this.mbAskMissedFill=false;this.onSubmitClick(_be);};F.onCompleteEvent=function(){dojo.publish(this.msEvtComplete,[this.meF.idVehicle.value]);this.fire();};F.onSubmitClick=function(_bf){if(!this.m_oPkt){webbler().startMask(this.meC);var _c0=this.meF;var _c1=[_c0.getElementsByTagName("input"),_c0.getElementsByTagName("select"),_c0.getElementsByTagName("textarea")];var _c2=[];var i,j;for(i=0;i<_c1.length;i++){for(j=0;j<_c1[i].length;j++){_c2.push(_c1[i][j]);}}var _c5={};for(var i=0;i<_c2.length;i++){if(_c2[i].type!="checkbox"||_c2[i]["checked"]){_c5[_c2[i].name]=_c2[i].value;}}this.m_oPkt=this.svc(new Functor(this,this.cbSubmit))[this.msWsSaveEntry](_c5,_bf==true);}};F.cbSubmit=function(_c6){this.m_oPkt=null;if(_c6!==undefined){var _c7=app.xmlrpc.fault(_c6,false);if(_c7){webbler().setMask(this.meC,this.createMessage("FillWidgetDlgError",_c6.faultString));}else{if(!_c6.bIsOk){var _c8=_c6.aWarnings;var _c9="<ul>";for(var i=0;i<_c6.aWarnings.length;i++){_c9+=("<li>"+htmlentities(_c6.aWarnings[i])+"</li>");}_c9+="</ul>";if(_c6.bAskMissedFill){webbler().setMask(this.meC,this.createMessage("FillWidgetDlgWarningMissed",_c9));}else{webbler().setMask(this.meC,this.createMessage("FillWidgetDlgWarning",_c9));}}else{webbler().setMask(this.meC,this.createMessage("FillWidgetDlgComplete"));}}}};F.createMessage=function(_cb,_cc){var _cb=$(_cb).innerHTML;if(app.isString(_cc)){_cb=str_replace("$sMessage",_cc,_cb);}return "<div class=\"relative dialogwindow\" style=\"text-align:left;width:185px;\">"+_cb+"</div>";};F.dismissMessage=function(){webbler().endMask(this.meC);};F.svc=function(oCB,_ce){return webbler().svc("MyVehicleWS",oCB,_ce,gaMyVehicleIFace);};F.render=function(_cf,oCB){if(this.m_oPkt){this.m_oPkt.Abort();this.m_oPkt=null;}webbler().startMask(this.meC);this.m_oPkt=webbler().render(this.msT,_cf,this.meC,false,true,new Functor(this,this.cbRender,[oCB]));};F.cbRender=function(oCB,_d2){webbler().endMask(this.meC);this.m_oPkt=null;if(_d2!==undefined){var _d3=mOblu().showFault(_d2,oCB);if(!_d3){this.onLoad();Functor.fire(oCB,[_d2["vars"]]);}}};}());function EventWidget(){};function createEventWidget(_d4,_d5){app.inherit(_d4,EventWidget.prototype);_d4.init(_d5);};(function(){var F=EventWidget.prototype;F.superclass=FillWidget.prototype;app.inherit(F,F.superclass);F.msT="{44b3e02e-33e0-102c-ad40-51990a67e445}";F.msCC="EventWidgetContainer";F.msC="EventWidget";F.msF="EventWidgetForm";F.msWsDelErr="wsDeleteEventError";F.msWsDelEntry="wsDeleteEvent";F.msWsSaveEntry="wsSaveEvent";F.msEvtComplete="vehicle/event";F.msDlgErr="EventWidgetDlgError";F.msDlgDel="EventWidgetDlgDelete";F.init=function(_d7){this.superclass.init.call(this,_d7);};F.onLoad=function(){this.meF=$(this.msF);if(this.meF){}};F.onDeleteClick=function(_d8){if(_d8){if(!this.m_oPkt){if(app.isuuid(this.meF.idError.value)){this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelErr](this.meF.idError.value);}else{this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelEntry](this.meF.idVehicle.value,this.meF.idEvent.value);}}}else{webbler().startMask(this.meC);webbler().setMask(this.meC,this.createMessage(this.msDlgDel));}};F.onSubmitClick=function(){if(this.meF.sEventData.value.trim().length>0||this.meF.sCannedEvent.value.length>0){this.superclass.onSubmitClick.call(this);}};F.cbSubmit=function(_d9){this.m_oPkt=null;if(_d9!==undefined){var _da=app.xmlrpc.fault(_d9,false);if(_da){webbler().setMask(this.meC,this.createMessage(this.msDlgErr,_d9.faultString));}else{webbler().setMask(this.meC,this.createMessage("EventWidgetDlgComplete"));}}};}());function ImportWidget(){};function createImportWidget(_db,_dc){app.inherit(_db,ImportWidget.prototype);_db.init(_dc);};(function(){var F=ImportWidget.prototype;F.superclass=FillWidget.prototype;app.inherit(F,F.superclass);F.msT="{c79448c9-1460-102d-b721-68b75fb77730}";F.msCC="ImportWidgetContainer";F.msC="ImportWidget";F.msF="ImportWidgetForm";F.msWsDelErr="wsDeleteEventError";F.msWsDelEntry="wsDeleteEvent";F.msWsSaveEntry="wsSaveEvent";F.msEvtComplete="vehicle/event";F.msDlgErr="EventWidgetDlgError";F.msDlgDel="EventWidgetDlgDelete";F.init=function(_de){this.superclass.init.call(this,_de);};F.onLoad=function(){this.meF=$(this.msF);if(this.meF){}};F.onDeleteClick=function(_df){if(_df){if(!this.m_oPkt){if(app.isuuid(this.meF.idError.value)){this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelErr](this.meF.idError.value);}else{this.m_oPkt=this.svc(new Functor(this,this.cbDelete))[this.msWsDelEntry](this.meF.idVehicle.value,this.meF.idEvent.value);}}}else{webbler().startMask(this.meC);webbler().setMask(this.meC,this.createMessage(this.msDlgDel));}};F.onSubmitClick=function(){if(this.meF.sEventData.value.trim().length>0||this.meF.sCannedEvent.value.length>0){this.superclass.onSubmitClick.call(this);}};F.cbSubmit=function(_e0){this.m_oPkt=null;if(_e0!==undefined){var _e1=app.xmlrpc.fault(_e0,false);if(_e1){webbler().setMask(this.meC,this.createMessage(this.msDlgErr,_e0.faultString));}else{webbler().setMask(this.meC,this.createMessage("EventWidgetDlgComplete"));}}};F.createUploadIframe=function(id,uri){var _e4="theUploadFrame"+id;if(window.ActiveXObject){var io=document.createElement("<iframe id=\""+_e4+"\" name=\""+_e4+"\" />");if(typeof uri=="boolean"){io.src="javascript:false";}else{if(typeof uri=="string"){io.src=uri;}}}else{var io=document.createElement("iframe");io.id=_e4;io.name=_e4;}io.style.position="absolute";io.style.top="-1000px";io.style.left="-1000px";document.body.appendChild(io);return io;};F.createUploadForm=function(id,_e7){var _e8="theUploadForm"+id;var _e9="theUploadFile"+id;var _ea=$("<form  action=\"\" method=\"POST\" name=\""+_e8+"\" id=\""+_e8+"\" enctype=\"multipart/form-data\"></form>");var _eb=_e7;var _ec=_eb.cloneNode();$(_eb).setAttribute("id",_e9);$(_eb).before(_ec);$(_eb).appendTo(_ea);$(_ea).css("position","absolute");$(_ea).css("top","-1200px");$(_ea).css("left","-1200px");$(_ea).appendTo("body");return _ea;};}());