/* generated Sun Feb 12 19:04:34 EST 2012 */

R9.extend("fd.cars",{Form:function(a){R9.fd.Form.call(this,a)}});R9.fd.cars.Form.prototype=R9.fd.Form.prototype.beget();R9.extend("fd.cars.Form.prototype",{bindDoublePicker:function(){R9.dp.doublePicker({altField:"#pickup_date_domlabel",defaultDate:jq.r9datepicker.parseDate(this.pickupDate),onSelect:function(){compare2chk()},selector:"#pickup_date"},{altField:"#dropoff_date_domlabel",defaultDate:jq.r9datepicker.parseDate(this.dropoffDate),onSelect:function(){compare2chk()},selector:"#dropoff_date"})},bindEvents:function(){R9.fd.Form.prototype.bindEvents.call(this);this.bindDoublePicker();this.bindDropOffLocation();this.bindLocation();this.bindOneWay();this.bindSmartbox()},bindDropOffLocation:function(){jq(this.e.newdropofflocation).change(jq.proxy(this.changeDropOffLocation,this))},bindLocation:function(){jq(this.e.newlocation).change(jq.proxy(this.changeLocation,this))},bindOneWay:function(){var a=this;jq("#onewayno").click(function(){a.toggleOneWay(false)});jq("#onewayyes").click(function(){a.toggleOneWay(true)})},bindSmartbox:function(){jq.each([["#pickup_location input","#citycode1"],["#dropoff_location input","#citycode2"]],function(a,b){jq(b[0]).smartbox({callback:function(c){jq(b[1]).val(c?c.id:"");if(c){compare2chk()}},callbackWithNull:true,minWidth:440,searchType:"car"})})},changeDropOffLocation:function(){var c=this.e,a=c.newdropofflocation.selectedIndex,b=c.newdropofflocation.options[a].value;c.location2.value=b;c.citycode2.value="";jq(c).submit()},changeLocation:function(){var c=this.e,a=c.newlocation.selectedIndex,b=c.newlocation.options[a].value;c.location.value=b;c.citycode1.value="";jq(c).submit()},isValid:function(){var b=this.getData(),a=null;if(!b.location){a="Please pick a pick-up location."}else{if(b.oneway==="y"&&!b.location2){a="Please pick a drop-off location."}else{if(!b.pickup_date){a="Please enter a pick-up date."}else{if(!b.dropoff_date){a="Please enter a drop-off date."}}}}return(this.error=a)===null},loadHistory:function(a,d,b){var j=this,f=j.e;j.setSourceForHistory(b);j.isSubmitted=false;if(d>=0){if(b){skipCompare=true}if(j.history.length>d){var h=j.history[d];if(j.okToLoadLocationAndDates){if(h.cac){f.location.value=h.cac;f.citycode1.value=h.cac+"/"+h.ccid}else{f.location.value=j.formatLocation(h.ccity,h.cstate,h.cstate,h.ccntryname);f.citycode1.value=h.ccid}var g=j.getTodayDate(),k=new Date(Date.parse(h.cin)),c=new Date(Date.parse(h.cout));if(k!=null&&k.getTime()>=g.getTime()){jq("#pickup_date").datepicker("setDate",k);jq("#pickup_date_domlabel").text(jq.datepicker.formatDate("D, d M yy",k));jq("#dropoff_date").datepicker("setDate",c);jq("#dropoff_date_domlabel").text(jq.datepicker.formatDate("D, d M yy",c))}else{if(b){alert("The dates for this car rental search have expired, please enter new dates.")}jq("#pickup_date,#dropoff_date").datepicker("setDate",null);jq("#dropoff_date,#dropoff_date_domlabel").text("dd/mm/yy");b=false}}else{j.okToLoadLocationAndDates=true}jq(f.pickup_hour).val(h.st1);jq(f.dropoff_hour).val(h.st2);jq(f.provider).val(h.brandid);if(j.allowOneWay){f.oneway[0].checked=!h.ow;f.oneway[1].checked=h.ow;if(h.ow){if(h.cdac){f.location2.value=h.cdac;f.citycode2.value=h.cdac+"/"+h.cdocid}else{f.location2.value=j.formatLocation(h.cdocity,h.cdostate,h.cdocntry,h.cdocntryname);f.citycode2.value=h.cdocid}}this.toggleOneWay(!f.oneway[0].checked)}}if(b){jq(f).submit();skipCompare=false}}return false},loadSettings:function(a){R9.fd.Form.prototype.loadSettings.call(this,a);this.allowOneWay=!!a.allowOneWay;this.dropoffDate=a.dropoffDate;this.pickupDate=a.pickupDate;this.submitOnPost=!!a.submitOnPost;this.useLast=!!a.useLast},onLoad:function(){R9.fd.Form.prototype.onLoad.call(this);var c=this;if(document.lasttab.havesearched.value=="false"){if(c.e.Search){c.e.Search.disabled=false}if(c.useLast){c.loadHistory(null,0,false)}var b=new Date();c.e.datelimit.value=(b.getMonth()-0+1)+"/"+b.getDate()+"/"+b.getFullYear();try{document.cars.location.focus()}catch(a){}}showPromo();compare2initializing=false;compare2chk();setCmp2Count();R9LoadFinished=new Date();var d=R9LoadFinished.getTime()-R9StartPage.getTime();recordEvent("client page load","front door","cars","ms",d);if(c.submitOnPost){setTimeout(function(){jq(c.e).submit()},250)}},onSubmit:function(){Profiler.markSearchStart();if(!this.isSubmitted){this.e.sp.value=undefined;this.e.providername.value=undefined;if(this.isValid()){if(comparewindows(this.e)){this.disableSearchButton();document.lasttab.havesearched.value="true";this.swapButtons();this.isSubmitted=true;var a=this.generateSearchUrl();if(a!=null){loadResults(a);return false}return true}else{popupBlockerMsg(this.e)}}else{alert(this.error)}}return false},toggleOneWay:function(a){jq(".location")[a?"addClass":"removeClass"]("oneWayLocation");compare2chk()}});function othercar(b){if(b.value.length>0){try{var a=window.open(b.value);a.focus()}catch(c){}}}function pickup_date_changed(){var b=jq("#pickup_date").datepicker("getDate"),a=jq("#dropoff_date").datepicker("getDate");if(a==null||b>a){b.setDate(b.getDate()+3);jq("#dropoff_date").datepicker("setDate",b)}}var form;

;var jsck_fdcar_en_gb="v428";
/* et=2, mt=1, c=p4, i=sparkle001, v=R114, cc=4, r=none */

