var OUTBOUND_DEPARTURE=2;var OUTBOUND_ARRIVAL=3;var INBOUND_DEPARTURE=4;var INBOUND_ARRIVAL=5;function setFlightTypeAndAirports(a){switch(a){case"retour":$("#selInpSearchF2From").hide();$("#selInpSearchF2To").hide();$("#returnFlightDepartureText").hide();$("#returnFlightArrivalText").hide();$("#returnDatePicker").show();$("#returnDateText").show();setAirports("selInpSearchF1From",$("#selInpSearchF1From").val(),a);break;case"one_way":$("#selInpSearchF2From").hide();$("#selInpSearchF2To").hide();$("#returnFlightDepartureText").hide();$("#returnFlightArrivalText").hide();$("#returnDatePicker").hide();$("#returnDateText").hide();setAirports("selInpSearchF1From",$("#selInpSearchF1From").val(),a);break;case"open_jaw":$("#selInpSearchF2From").show();$("#selInpSearchF2To").show();$("#returnFlightDepartureText").show();$("#returnFlightArrivalText").show();$("#returnDatePicker").show();$("#returnDateText").show();break;default:break}}function setAirports(c,e,g){var d;var b;var a;var f;switch(c){case"selInpSearchF1From":switch(g){case"retour":if(e!="xxx"){$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e);$("#selInpSearchF2To").val(e);$("#selInpSearchF2ToHidden").val(e);d=$("#selInpSearchF1To").val();f=$("#selInpSearchF2From").val();updateDestinations($("#selInpSearchF1From").val(),"#selInpSearchF1To",OUTBOUND_ARRIVAL,d);updateDestinations($("#selInpSearchF1From").val(),"#selInpSearchF2From",OUTBOUND_ARRIVAL,f)}else{$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e);$("#selInpSearchF2To").val(e);$("#selInpSearchF2ToHidden").val(e)}break;case"one_way":if(e!="xxx"){$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e);d=$("#selInpSearchF1To").val();updateDestinations($("#selInpSearchF1From").val(),"#selInpSearchF1To",OUTBOUND_ARRIVAL,d)}else{$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e)}break;case"open_jaw":if(e!="xxx"){$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e);d=$("#selInpSearchF1To").val();updateDestinations($("#selInpSearchF1From").val(),"#selInpSearchF1To",OUTBOUND_ARRIVAL,d)}else{$("#selInpSearchF1From").val(e);$("#selInpSearchF1FromHidden").val(e)}break;default:break}break;case"selInpSearchF1To":switch(g){case"retour":if(e!="xxx"){$("#selInpSearchF1To").val(e);$("#selInpSearchF1ToHidden").val(e);$("#selInpSearchF2From").val(e);$("#selInpSearchF2FromHidden").val(e);b=$("#selInpSearchF1From").val();updateDestinations($("#selInpSearchF1To").val(),"#selInpSearchF1From",OUTBOUND_DEPARTURE,b)}else{$("#selInpSearchF1To").val(e);$("#selInpSearchF1ToHidden").val(e);$("#selInpSearchF2From").val(e);$("#selInpSearchF2FromHidden").val(e)}break;case"one_way":$("#selInpSearchF1To").val(e);$("#selInpSearchF1ToHidden").val(e);break;case"open_jaw":$("#selInpSearchF1To").val(e);$("#selInpSearchF1ToHidden").val(e);break;default:break}break;case"selInpSearchF2From":switch(g){case"open_jaw":if(e!="xxx"){$("#selInpSearchF2From").val(e);$("#selInpSearchF2FromHidden").val(e);a=$("#selInpSearchF2To").val();updateDestinations($("#selInpSearchF2From").val(),"#selInpSearchF2To",INBOUND_ARRIVAL,a)}else{$("#selInpSearchF2From").val(e);$("#selInpSearchF2FromHidden").val(e)}break;default:break}break;case"selInpSearchF2To":switch(g){case"open_jaw":if(e!="xxx"){$("#selInpSearchF2To").val(e);$("#selInpSearchF2ToHidden").val(e);f=$("#selInpSearchF2From").val();updateDestinations($("#selInpSearchF2To").val(),"#selInpSearchF2From",INBOUND_DEPARTURE,f)}else{$("#selInpSearchF2To").val(e);$("#selInpSearchF2ToHidden").val(e)}break;default:break}break;default:break}}function init(f){var c=$("#selInpSearchF1From").val();var j=$("#selInpSearchF1To").val();var b=$("#selInpSearchF2From").val();var d=$("#selInpSearchF2To").val();if(f=="retour"){if(c!=d||j!=b){$("#selInpSearchF2From").val(j);$("#selInpSearchF2To").val(c)}}var h=$("#selInpSearchF1FromHidden").val();var a=$("#selInpSearchF1ToHidden").val();var g=$("#selInpSearchF2FromHidden").val();var e=$("#selInpSearchF2ToHidden").val();if(h!=""&&h!="xxx"){$("#selInpSearchF1From").val(h)}else{$("#selInpSearchF1FromHidden").val(c)}if(a!=""&&a!="xxx"){$("#selInpSearchF1To").val(a)}else{$("#selInpSearchF1ToHidden").val(j)}if(g!=""&&g!="xxx"){$("#selInpSearchF2From").val(g)}else{$("#selInpSearchF2FromHidden").val(b)}if(e!=""&&e!="xxx"){$("#selInpSearchF2To").val(e)}else{$("#selInpSearchF2ToHidden").val(d)}setFlightTypeAndAirports(f)}function updateDestinations(d,e,b,c){var a="LoadAirports.action?airportCode="+d+"&identifier="+b;$(e).emptySelect();$.getJSON(a,function(f){$(e).loadSelect(f);$(e).val(c);$(e+"Hidden").val(c)})}function updateDepartureYear(){var a=$("#departureDay").val();var c=$("#departureMonth").val();var b=$("#departureYear").val();var e=new Date(b,c,a);var d=new Date();if(e<d){$("#departureYear").val(parseInt(b)+1)}}function updateReturnYear(){var b=$("#returnDay").val();var d=$("#returnMonth").val();var c=$("#returnYear").val();var a=new Date(c,d,b);var e=new Date();if(a<e){$("#returnYear").val(parseInt(c)+1)}}function updateReturnDate(){var b=$("#departureDay").val();if(b.length<2){b="0"+b}var c=$("#departureMonth").val();if(c.length<2){c="0"+c}var d=b+c+$("#departureYear").val();var a="UpdateReturnDate.action?departureDate="+d;$.getJSON(a,function(e){updateReturnLinked(e[0].returnDate);d=b+"/"+c+"/"+$("#departureYear").val();$("#departureDate").val(d);$("#returnDate").val(e[0].returnDate)})}function updateReturnDateField(){var a=$("#returnDay").val()+"/"+$("#returnMonth").val()+"/"+$("#returnYear").val();$("#returnDate").val(a)}function hideErrorMessage(a){document.getElementById(a).style.display="none"}function fInitAlertErrMsg(a){vAlertMsg=0;document.getElementById(a).style.display="none";document.getElementById("iFrameErrMsg").style.display="none"}function fCoords(b){var a=0;var d=0;if(!b){var b=window.event}if(b.pageX||b.pageY){a=b.pageX;d=b.pageY}else{if(b.clientX||b.clientY){a=b.clientX+document.documentElement.scrollLeft;d=b.clientY+document.documentElement.scrollTop}}var c=new Array();c.x=a;c.y=d;return c}function fShowMO(d,c,a){var b=new Array("&agrave;","&eacute;","&egrave;","&acute;");aantal=0;if(self.innerWidth){innerwidth=self.innerWidth}else{if(document.body&&document.body.clientWidth){innerwidth=document.body.clientWidth}}for(i=0;i<b.length;i++){found=0;found=c.indexOf(b[i],0);while(found!=(-1)){found=c.indexOf(b[i],found+b[i].length);aantal+=b[i].length}}pixBreedte=((c.length-aantal)*8.2);if(pixBreedte>220){breed=220;lang=(Math.ceil(pixBreedte/220)-1)*13}else{breed=pixBreedte;lang=13}pos=fCoords(d);if(pos.x>(innerwidth/2)){pos.x-=breed}document.getElementById("MOInfo").style.width=breed+"px";document.getElementById("IfMOInfo").style.width=(breed+4)+"px";document.getElementById("MOInfo").style.height=lang+"px";document.getElementById("IfMOInfo").style.height=(lang+4)+"px";if(vShopWin="true"){pos.y=pos.y-10;pos.x=pos.x+10}if(browser.isIE55||browser.isIE6up){document.getElementById("IfMOInfo").style.visibility="visible";if(a=="up"){document.getElementById("IfMOInfo").style.top=(pos.y-lang-22)+"px"}else{document.getElementById("IfMOInfo").style.top=(pos.y+22)+"px"}document.getElementById("IfMOInfo").style.left=pos.x+"px"}else{document.getElementById("IfMOInfo").style.width="1px";document.getElementById("IfMOInfo").style.height="1px"}document.getElementById("MOInfo").style.visibility="visible";document.getElementById("MOInfo").innerHTML=c;if(a=="up"&&(browser.isIE55||browser.isIE6up)){document.getElementById("MOInfo").style.top=(pos.y-lang-22)+"px"}else{document.getElementById("MOInfo").style.top=(pos.y+22)+"px"}document.getElementById("MOInfo").style.left=pos.x+"px"}function fHideMO(){document.getElementById("MOInfo").style.visibility="hidden";document.getElementById("MOInfo").style.left="0px";document.getElementById("MOInfo").style.top="0px";document.getElementById("IfMOInfo").style.visibility="hidden";document.getElementById("IfMOInfo").style.left="0px";document.getElementById("IfMOInfo").style.top="0px"}function BrowserDetect(){var a=navigator.userAgent.toLowerCase();this.isGecko=(a.indexOf("gecko")!=-1&&a.indexOf("safari")==-1);this.isAppleWebKit=(a.indexOf("applewebkit")!=-1);this.isKonqueror=(a.indexOf("konqueror")!=-1);this.isSafari=(a.indexOf("safari")!=-1);this.isOmniweb=(a.indexOf("omniweb")!=-1);this.isOpera=(a.indexOf("opera")!=-1);this.isIcab=(a.indexOf("icab")!=-1);this.isAol=(a.indexOf("aol")!=-1);this.isIE=(a.indexOf("msie")!=-1&&!this.isOpera&&(a.indexOf("webtv")==-1));this.isMozilla=(this.isGecko&&a.indexOf("gecko/")+14==a.length);this.isFirebird=(a.indexOf("firebird/")!=-1);this.isNS=((this.isGecko)?(a.indexOf("netscape")!=-1):((a.indexOf("mozilla")!=-1)&&!this.isOpera&&!this.isSafari&&(a.indexOf("spoofer")==-1)&&(a.indexOf("compatible")==-1)&&(a.indexOf("webtv")==-1)&&(a.indexOf("hotjava")==-1)));this.isIECompatible=((a.indexOf("msie")!=-1)&&!this.isIE);this.isNSCompatible=((a.indexOf("mozilla")!=-1)&&!this.isNS&&!this.isMozilla);this.geckoVersion=((this.isGecko)?a.substring((a.lastIndexOf("gecko/")+6),(a.lastIndexOf("gecko/")+14)):-1);this.equivalentMozilla=((this.isGecko)?parseFloat(a.substring(a.indexOf("rv:")+3)):-1);this.appleWebKitVersion=((this.isAppleWebKit)?parseFloat(a.substring(a.indexOf("applewebkit/")+12)):-1);this.versionMinor=parseFloat(navigator.appVersion);if(this.isGecko&&!this.isMozilla){this.versionMinor=parseFloat(a.substring(a.indexOf("/",a.indexOf("gecko/")+6)+1))}else{if(this.isMozilla){this.versionMinor=parseFloat(a.substring(a.indexOf("rv:")+3))}else{if(this.isIE&&this.versionMinor>=4){this.versionMinor=parseFloat(a.substring(a.indexOf("msie ")+5))}else{if(this.isKonqueror){this.versionMinor=parseFloat(a.substring(a.indexOf("konqueror/")+10))}else{if(this.isSafari){this.versionMinor=parseFloat(a.substring(a.lastIndexOf("safari/")+7))}else{if(this.isOmniweb){this.versionMinor=parseFloat(a.substring(a.lastIndexOf("omniweb/")+8))}else{if(this.isOpera){this.versionMinor=parseFloat(a.substring(a.indexOf("opera")+6))}else{if(this.isIcab){this.versionMinor=parseFloat(a.substring(a.indexOf("icab")+5))}}}}}}}}this.versionMajor=parseInt(this.versionMinor);this.isDOM1=(document.getElementById);this.isDOM2Event=(document.addEventListener&&document.removeEventListener);this.mode=document.compatMode?document.compatMode:"BackCompat";this.isWin=(a.indexOf("win")!=-1);this.isWin32=(this.isWin&&(a.indexOf("95")!=-1||a.indexOf("98")!=-1||a.indexOf("nt")!=-1||a.indexOf("win32")!=-1||a.indexOf("32bit")!=-1||a.indexOf("xp")!=-1));this.isMac=(a.indexOf("mac")!=-1);this.isUnix=(a.indexOf("unix")!=-1||a.indexOf("sunos")!=-1||a.indexOf("bsd")!=-1||a.indexOf("x11")!=-1);this.isLinux=(a.indexOf("linux")!=-1);this.isNS4x=(this.isNS&&this.versionMajor==4);this.isNS40x=(this.isNS4x&&this.versionMinor<4.5);this.isNS47x=(this.isNS4x&&this.versionMinor>=4.7);this.isNS4up=(this.isNS&&this.versionMinor>=4);this.isNS6x=(this.isNS&&this.versionMajor==6);this.isNS6up=(this.isNS&&this.versionMajor>=6);this.isNS7x=(this.isNS&&this.versionMajor==7);this.isNS7up=(this.isNS&&this.versionMajor>=7);this.isIE4x=(this.isIE&&this.versionMajor==4);this.isIE4up=(this.isIE&&this.versionMajor>=4);this.isIE5x=(this.isIE&&this.versionMajor==5);this.isIE55=(this.isIE&&this.versionMinor==5.5);this.isIE5up=(this.isIE&&this.versionMajor>=5);this.isIE6x=(this.isIE&&this.versionMajor==6);this.isIE6up=(this.isIE&&this.versionMajor>=6);this.isIE4xMac=(this.isIE4x&&this.isMac)}var browser=new BrowserDetect();function readDepartureLinked(){$("#departureDate").val($("#departureDay").val()+"/"+$("#departureMonth").val()+"/"+$("#departureYear").val());return{}}function readReturnLinked(){$("#returnDate").val($("#returnDay").val()+"/"+$("#returnMonth").val()+"/"+$("#returnYear").val());return{}}function updateDepartureLinked(a){$("#departureDay").val(Number(a.substring(0,2)));$("#departureMonth").val(Number(a.substring(3,5)));$("#departureYear").val(Number(a.substring(6,10)));updateReturnDate()}function updateReturnLinked(a){$("#returnDay").val(Number(a.substring(0,2)));$("#returnMonth").val(Number(a.substring(3,5)));$("#returnYear").val(Number(a.substring(6,10)))}function checkLinkedDepartureDays(){var a=32-new Date($("#departureYear").val(),$("#departureMonth").val()-1,32).getDate();$("#departureDay option").attr("disabled","");$("#departureDay option:gt("+(a-1)+")").attr("disabled","disabled");if($("#departureDay").val()>a){$("#departureDay").val(a)}}function checkLinkedReturnDays(){var a=32-new Date($("#returnYear").val(),$("#returnMonth").val()-1,32).getDate();$("#returnDay option").attr("disabled","");$("#returnDay option:gt("+(a-1)+")").attr("disabled","disabled");if($("#returnDay").val()>a){$("#returnDay").val(a)}};
