eval(liligo.namespace);if(!liligo.AjaxRequestHigh){var AjaxRequestHigh=AjaxRequest}else{var AjaxRequest=AjaxRequestHigh}var Form=new Class({constructor:function(A,B){this.form=document.createElement("form");this.form.style.display="none";this.form.action=(typeof A=="string")?action:A.action;this.form.method=(typeof B=="string")?B:((typeof A=="string")?"post":A.method);document.body.appendChild(this.form)},add:function(B,C){if(typeof B=="object"){return forEach(B,function(E,D){this.add(D,E)},this)}var A=document.createElement("input");A.type="hidden";A.name=B;A.value=C;this.form.appendChild(A)},copy:function(B,A){if(typeof B=="object"){return forEach(B,function(D,C){this.copy(C,D)},this)}if(!(tmp=$(B))){tmp={value:-1}}this.add(A,tmp.value)},submit:function(){this.form.submit()}});var SearchBox=new Abstract({name:null,checkForm:null,submit:null,initialize:function(){this.box=$("box-"+this.name);this.form=$("hptop-"+this.name+"-form");this.onSubmit=bindAsEventListener(this.onSubmit,this);Event.observe(this.form,"submit",this.onSubmit)},tryPreset:nullFunc,onSubmit:function(A){Event.stop(A);if(this.checkForm()){Event.stopObserving(this.form,"submit",this.onSubmit);Event.observe(this.form,"submit",bindAsEventListener(Event.stop,Event));Style.addClass(this.name+"-submit","loading");this.submit()}},setError:function(F,B,G){if(!G&&(typeof F=="object")&&(F.constructor==[].constructor)){var D=false;for(var C=0,A=F.length;C<A;C++){if(this.setError(F[C],B,true)){D=true}}return D}F=$(F);if(B){Style.addClass(F,"error");Style.addClass(this.box,"error");$(this.name+"-error").innerHTML=labels[B];try{F.focus()}catch(E){}return true}else{Style.removeClass(F,"error");Style.removeClass(this.box,"error");return false}}});var MoreLessSearchBox=new Abstract(SearchBox,{name:null,checkForm:null,submit:null,initialize:function(){this._base_initialize()}});var flight=new Singleton(MoreLessSearchBox,{name:"flight",initialize:function(){this._base_initialize();$("flight-direct").checked=false;$("flight-from").value=$("flight-to").value="";if($("hptop-flight-form")){$("hptop-flight-form").action=((window.config&&window.config.flightUrl)?window.config.flightUrl:"")+"/air/SearchFlights.jsp"}this.fromLoc=new CompLoc({type:"air",field:"flight-from",nextFocus:"flight-to",prevFocus:"flight-submit",onKeyDown:bind(function(E){if(window.AjaxRequestLow){AjaxRequestLow.pause()}if(E.keyCode!=Event.KEY_TAB){this.setError("flight-from")}},this),AjaxRequest:AjaxRequestHigh});this.toLoc=new CompLoc({type:"air",field:"flight-to",prevFocus:"flight-from",nextFocus:"flight-from-date",onKeyDown:bind(function(E){if(window.AjaxRequestLow){AjaxRequestLow.pause()}if(E.keyCode!=Event.KEY_TAB){this.setError("flight-to")}},this),AjaxRequest:AjaxRequestHigh});this.fromDate=new DatePicker({direction:DatePicker.DIR_DEP,field:"flight-from-date",oneWayRadio:"flight-roundtrip-oneway",offsetLeft:-93,offsetTop:19,months:2,firstDay:0,highPriority:true});this.toDate=new DatePicker({direction:DatePicker.DIR_RET,field:"flight-to-date",oneWayRadio:"flight-roundtrip-oneway",onSet:bind(this.onToDateSet,this),depPicker:this.fromDate,offsetLeft:-93,offsetTop:19,months:2,firstDay:0,highPriority:true});this.fromDate.retPicker=this.toDate;$("flight-roundtrip-roundtrip").checked=true;this.onewayChange();var A=bindAsEventListener(function(E){if(E.keyCode==Event.KEY_TAB){$("flight-from").focus()}Event.stop(E)},this);Event.observe("flight-more","keydown",A);Event.observe("flight-less","keydown",A);var C=bind(this.onewayChange,this);Event.observe("flight-roundtrip-oneway",{click:C,change:C});Event.observe("flight-roundtrip-roundtrip",{click:C,change:C});var D=function(E){if(!IE||(E===true)){return }setTimeout(bind(arguments.callee,0,true),10)};var B=function(E){if(!IE||(E===true)){return }setTimeout(bind(arguments.callee,0,true),10)};Event.observe("alert_reg_preview","click",bind(this.openPreview,this));Event.observe("alert_reg_new","click",bind(this.reinit,this));Event.observe("alert_reg_search","click",bind(this.launch,this))},openPreview:function(){var C="/alert/sample.jsp?preview=1&depCity="+$("flight-from").value.replace(/,.*/,"")+"&retCity="+$("flight-to").value.replace(/,.*/,"")+"&roundTrip="+($("flight-roundtrip-roundtrip").checked?true:false)+"&depDate="+$("flight-from-date").value+"&retDate="+$("flight-to-date").value+"&class="+$("flight-class").value+"&adults="+$("flight-adults").value+"&children="+$("flight-children").value+"&infants="+$("flight-infants").value;var D=620,A=600,G=parseInt((screen.availWidth/2)-(D/2)),F=parseInt((screen.availHeight/2)-(A/2)),B="width="+D+",height="+A+",status,scrollbars,left="+G+",top="+F+",screenX="+G+",screenY="+F;var E=window.open(C,"subWind",B)},tryPreset:function(){if(window.hptopconfig&&hptopconfig.air){var A=hptopconfig.air;if(A.presetAir){A=A.presetAir}if(A.from){$("flight-from").value=A.from}if(A.fromCode){$("flight-fromCode").value=A.fromCode}if(A.to){$("flight-to").value=A.to}if(A.toCode){$("flight-toCode").value=A.toCode}if(A.submit){$("flight-class").value=A._class;$("flight-adults").value=A.adults;$("flight-children").value=A.children;$("flight-infants").value=A.infants;$("flight-direct").checked=A.direct;$("flight-roundtrip-oneway").checked=!A.roundtrip;$("flight-roundtrip-roundtrip").checked=A.roundtrip;this.onewayChange();this.fromDate.set(A.fromDate);this.toDate.set(A.toDate);this.onSubmit()}}},reset:function(){$("alert_reg_email").value=$("flight-from").value=$("flight-to").value=$("flight-fromCode").value=$("flight-toCode").value="";$("flight-adults").value=1;$("flight-children").value=$("flight-infants").value=0;$("flight-class").value="EC";$("flight-roundtrip-roundtrip").checked=true;$("flight-direct").checked=false;Style.removeClass("flight-submit","loading")},onToDateSet:function(){$("flight-roundtrip-roundtrip").checked=true;this.onewayChange()},onewayChange:function(){if($("flight-roundtrip-oneway").checked){Style.addClass(this.form,"oneway");$("flight-to-date").value=labels.homepage_top_form_air_roundtrip_oneway
}else{Style.removeClass(this.form,"oneway");this.toDate.saveToFields()}},checkForm:function(){var A=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;if(!$("flight-from").value){this.setError("flight-from","homepage_top_form_air_alert_departure");return false}this.setError("flight-from","");if(!$("flight-to").value){this.setError("flight-to","homepage_top_form_air_alert_destination");return false}this.setError("flight-to","");if($("flight-fromCode").value&&$("flight-toCode").value&&($("flight-fromCode").value.split(",")[1]==$("flight-toCode").value.split(",")[1])){this.setError("flight-from","homepage_top_form_air_same_city");return false}if(!$("alert_reg_email").value){this.setError("alert_reg_email","recommend_email_alert_3");return false}if(!A.test($("alert_reg_email").value)){this.setError("alert_reg_email","recommend_email_alert");return false}this.setError("alert_reg_email","");return true},submit:function(){function B(J){var I=document.cookie;var L=J+"=";var K=I.indexOf("; "+L);if(K==-1){K=I.indexOf(L);if(K!=0){return null}}else{K+=2}var H=document.cookie.indexOf(";",K);if(H==-1){H=I.length}return unescape(I.substring(K+L.length,H))}var D=B("TRADEDOUBLER");if(D){var A="901442",F="122599";var E=Math.round((new Date().getTime()*Math.random()));var C="";C=escape(C);(new Image).src="http://tbl.tradedoubler.com/report?organization="+A+"&event="+F+"&leadNumber="+E+"&orderValue=1&tduid="+D+"&reportInfo="+C}urchinTracker("/Alert/Flight/StandaloneRegistration/ButtonClick");var G={fromLocation:$("flight-from").value,fromLocationCode:$("flight-fromCode").value,toLocation:$("flight-to").value,toLocationCode:$("flight-toCode").value,depDay:$("flight-from-date-day").value,depMonth:$("flight-from-date-month").value,depYear:$("flight-from-date-year").value,retDay:$("flight-to-date-day").value,retMonth:$("flight-to-date-month").value,retYear:$("flight-to-date-year").value,adults:$("flight-adults").value,children:$("flight-children").value,infants:$("flight-infants").value,dtime:$("flight-from-time").value,rtime:$("flight-to-time").value,email:$("alert_reg_email").value,ifSubmitButton:"ifSubmitButton",newSearch:"true",roundTrip:$("flight-roundtrip-roundtrip").checked?"roundTrip":"oneWay"};G["class"]=$("flight-class").value;if($("flight-direct").checked){G["preferDirectFlight"]="on"}$("alert_reg_registered_email").innerHTML=$("alert_reg_email").value;if($("alert_reg_nl").checked){if(window.config.domain.match(/^fr|it|es|uk$/)){new AjaxRequest("/widgets/gateway.jsp",{method:"post",parameters:{url:"http://liligo.cabestan.com/optin.cfm?EMAIL="+$("alert_reg_email").value+"&LANGUE="+liligo.getLang().toUpperCase()+"&CIV=&NOM=&PRENOM=&DEPARTURECITY=&call_method=post"}})}else{new AjaxRequest("/profile/subscribe.jsp",{parameters:{NOM:"",PRENOM:"",EMAIL:$("alert_reg_email").value,LANGUE:liligo.getLang(),DEPARTURECITY:"",CIV:""}})}}new AjaxRequest("/alert_reg/create.jsp",{parameters:G,onComplete:bind(this.response,this)})},launch:function(){var A=$("hptop-flight-form");A=new Form(A);A.copy({"flight-from":"fromLocation","flight-fromCode":"fromLocationCode","flight-to":"toLocation","flight-toCode":"toLocationCode","flight-class":"class","flight-from-date-day":"depDay","flight-from-date-month":"depMonth","flight-from-date-year":"depYear","flight-from-time":"dtime","flight-to-date-day":"retDay","flight-to-date-month":"retMonth","flight-to-date-year":"retYear","flight-to-time":"rtime","flight-adults":"adults","flight-children":"children","flight-infants":"infants"});A.add({ifSubmitButton:"ifSubmitButton",newSearch:"true",roundTrip:$("flight-roundtrip-roundtrip").checked?"roundTrip":"oneWay"});if($("flight-direct").checked){A.add("preferDirectFlight","on")}A.submit()},response:function(B,A){urchinTracker("/Alert/Flight/StandaloneRegistration/AlertSubmit");Style.hide("alert_reg_register");Style.show("alert_reg_registered")},reinit:function(){Style.hide("alert_reg_registered");Style.show("alert_reg_register");flight.reset();Event.observe(this.form,"submit",this.onSubmit)}});new Application({init:function(){if($("box-flight")){flight.initialize();flight.tryPreset()}if($("sponsoredlinks")){this.loadGoogleAdsense()}},loadGoogleAdsense:function(){var B="";var A=document.write;var D=1;var C=function(){var F={google_ad_client:"pub-5726924103237977",google_ad_slot:"0644082361",google_ad_width:728,google_ad_height:90};extend(window,F);var E=document.createElement("script");E.id="show_ads_sc";E.type="text/javascript";E.src="http://pagead2.googlesyndication.com/pagead/show_ads.js";document.getElementsByTagName("head")[0].appendChild(E)};document.write=function(E){B+=E;if(E.indexOf("</iframe>")!=-1){$("sponsoredlinks").innerHTML+=B+"<br />";if(D++<1){B="";setTimeout(C,100)}else{document.write=A;D=C=B=A=undefined}}};$("sponsoredlinks").innerHTML="";C()}})
