$(function(){$("a.new-window").click(function(){window.open(this.href);return false})});var omniture_enabled=false;function getFromUrl(b,f){var d=false;var a=b.split("?");if(a.length>1){var e=a[1].split("&");for(i=0;i<e.length;i++){var c=e[i].split("=");if(c[0]==f){d=c[1];break}}}return d}function urlContains(a,b){if(getFromUrl(a,b)){return true}else{return false}}function checkNewsletter(a){if(_$(a+"_txtNewsletter").value==""){alert("Specificare un indirizzo e-mail")}else{if(!IsValidEmail(a+"_txtNewsletter")){alert("Indirizzo e-mail specificato non valido")}else{__doPostBack(a+"$lnkSubscribe")}}}function populateSearchEngineChildrenList(d){var c=getSelectedValue(d+"_ddlChildren");$("#searchengine_children").empty();for(var b=0;b<c;b++){var a=CreateNumericSelect("ddlChildrenAge_"+b,"main_select_numero_passeggeri floatRight",1,11,true,"< 1","0","");var e=$('<div class="cleared halfspacer">').append($(a));e.append('<p class="floatLeft">Et&agrave; '+(b+1)+"&deg; bambino</p>");e.appendTo("#searchengine_children")}}function getSearchEngineChildren(d){var c=getSelectedValue(d+"_ddlChildren");var a="";for(var b=0;b<c;b++){a+=getSelectedValue("ddlChildrenAge_"+b)+","}return a.substr(0,a.length-1)}function goToSearchResults(c){var d=new Array();if(IsEmpty(c+"_txtDate")){d.push("Data di partenza")}if($$(c+"_selectedDestinationID").val()=="-1"){d.push("Selezionare una destinazione")}if(OpenAlertError(d)){if(isOmnitureEnabled()){var a=new Object();a.destinazione=$("#"+c+"_selectedDestinationName").val();a.data=$("#"+c+"_txtDate").val();a.adulti=getSelectedValue(c+"_ddlAdults");a.bambini=getSearchEngineChildren(c);a.avanzata=false;try{sc_trackSearch(a)}catch(b){}}document.forms.searchForm.destinationID.value=$$(c+"_selectedDestinationID").val();document.forms.searchForm.departureDate.value=$("#"+c+"_txtDate").val();document.forms.searchForm.searchDepartureDate.value=$("#"+c+"_txtDate").val();document.forms.searchForm.adults.value=getSelectedValue(c+"_ddlAdults");document.forms.searchForm.children.value=getSearchEngineChildren(c);document.forms.searchForm.dateType.value="week";document.forms.searchForm.dateTo.value="";document.forms.searchForm.ref.value="search_engine";document.forms.searchForm.submit()}}function GoToPackage(c,e,b,d,a){document.forms.searchForm.departureDate.value=b;document.forms.searchForm.destinationID.value=d;document.forms.searchForm.duration.value=e;document.forms.searchForm.action=c;document.forms.searchForm.dateType.value="week";document.forms.searchForm.dateTo.value="";if(urlContains(c,"ref")){document.forms.searchForm.ref.value=getFromUrl(c,"ref")}document.forms.searchForm.submit()}function goToFlightReservation(a,c,b){document.forms.flightSearchForm.destinationID.value=a;document.forms.flightSearchForm.departureDate.value=c;document.forms.flightSearchForm.flightType.value=b;document.forms.flightSearchForm.submit()}function popUpGallery(d){var b=1000;var a=550;var c=(screen.width-b)/2;var e=(screen.height-a)/2;window.open(d,"popupGalleryWindow","screenX="+c+",screenY="+e+",left="+c+",top="+e+",width="+b+",height="+a+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no")}function popupGenerico(a){window.open(a,"popupWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=640,height=400,screenX=250,screenY=250,top=400,left=420")}function goToPage(a){$$("hdnPage").val(a);__doPostBack("lnkPagination","")}function GoToPackageFromSearch(b,c,e,h,g,a,f,d,j){document.forms.searchForm.destinationID.value=f;document.forms.searchForm.duration.value=c;document.forms.searchForm.searchDepartureDate.value=e;document.forms.searchForm.departureDate.value=h;document.forms.searchForm.adults.value=g;document.forms.searchForm.children.value=a;document.forms.searchForm.action=b;document.forms.searchForm.dateType.value=d;document.forms.searchForm.dateTo.value=j;if(urlContains(b,"ref")){document.forms.searchForm.ref.value=getFromUrl(b,"ref")}document.forms.searchForm.submit()}function showPaymentTab(b){for(var a=1;a<=4;a++){if(a==b){document.getElementById("idTabPrenota"+a).className="prenota"+a+" active";$("#idprenota"+a).show()}else{document.getElementById("idTabPrenota"+a).className="prenota"+a+" ";$("#idprenota"+a).hide()}}}function CreateDdl(k,m,d,j,a,b,e,c,g){newSelect=document.createElement("select");newSelect.setAttribute("id",m);newSelect.setAttribute("name",m);if(d!=""){newSelect.className=d}if(g!=""){newSelect.onchange=new Function(g)}if(b){newOption=document.createElement("option");newOptionText=document.createTextNode(c);newOption.appendChild(newOptionText);newOption.setAttribute("value",e);newSelect.appendChild(newOption)}if(j.length>0){var h=new Array();h=j.split("#");for(var f=0;f<h.length;f++){var l=h[f].split("@");newOption=document.createElement("option");newOptionText=document.createTextNode(l[0]);newOption.appendChild(newOptionText);newOption.setAttribute("value",l[1]);if(l[1]==a){newOption.setAttribute("selected","true")}newSelect.appendChild(newOption)}}k.appendChild(newSelect)}function StringBuilder(){this._strings=[];this.append=function(a){this._strings.push(a)};this.toString=function(){return this._strings.join("")}}function MaintainSession(){}function bindAdvancedSearch(f){$$("advancedSearchData").hide();$$("advancedSearchAjaxWait").show();var b=-1;var e=-1;var a="";var g="";var d="";if(!f){if(!CheckListBox("ddlAdvSearchDestinations")){b=getSelectedValue("ddlAdvSearchDestinations")}if(!CheckListBox("ddlAdvSearchLocalities")){e=getSelectedValue("ddlAdvSearchLocalities")}if(!CheckListBox("ddlAdvSearchDate")){g=getSelectedValue("ddlAdvSearchDate")}if(!CheckListBox("ddlAdvSearchAirport")){a=getSelectedValue("ddlAdvSearchAirport")}if(!CheckListBox("ddlAdvSearchPrice")){d=getSelectedValue("ddlAdvSearchPrice")}}var c=new SOAPClientParameters();c.add("parentDestinationID",b);c.add("destinationID",e);c.add("departureDate",g);c.add("airportCode",a);c.add("price",d);c.add("currentUserList","PRI");c.add("currentUserType",0);SOAPClient.invoke("/WebService/PhoneAndGoWS.asmx","AdvancedSearch",c,true,bindAdvancedSearch_CallBack)}function bindAdvancedSearch_CallBack(d){$$("advancedSearchData").show();$$("advancedSearchAjaxWait").hide();if(d!=null){$$("ddlAdvSearchDestinations").empty();$$("ddlAdvSearchLocalities").empty();$$("ddlAdvSearchDate").empty();$$("ddlAdvSearchAirport").empty();$$("ddlAdvSearchAirport").empty();$$("ddlAdvSearchPrice").empty();for(var c=0;c<d.ParentDestinations.length;c++){var b=CreateSelectOption(d.ParentDestinations[c].Name,d.ParentDestinations[c].ID,false);$$("ddlAdvSearchDestinations").append($(b))}for(var c=0;c<d.ChildDestinations.length;c++){var b=CreateSelectOption(d.ChildDestinations[c].Name,d.ChildDestinations[c].ID,false);$$("ddlAdvSearchLocalities").append($(b))}for(var c=0;c<d.DepartureDates.length;c++){var b=CreateSelectOption(d.DepartureDates[c],d.DepartureDates[c],false);$$("ddlAdvSearchDate").append($(b))}for(var c=0;c<d.Airports.length;c++){var b=CreateSelectOption(d.Airports[c].Name,d.Airports[c].Code,false);$$("ddlAdvSearchAirport").append($(b))}for(var c=0;c<d.Prices.length;c++){var e="";var a=d.Prices[c].split("|");if(a[0]==0){e="meno di €"+a[1]}else{if(a[1]==9999){e="oltre € "+a[0]}else{e="€ "+a[0]+" - € "+a[1]}}var b=CreateSelectOption(e,d.Prices[c],false);$$("ddlAdvSearchPrice").append($(b))}if(d.ParentDestinationID!=-1){setSelectedValue("ddlAdvSearchDestinations",d.ParentDestinationID)}if(d.DestinationID!=-1){setSelectedValue("ddlAdvSearchLocalities",d.DestinationID)}if(d.DepartureDate!=""){setSelectedValue("ddlAdvSearchDate",d.DepartureDate)}if(d.PriceRange!=""){setSelectedValue("ddlAdvSearchPrice",d.PriceRange)}if(d.AirportCode!=""){setSelectedValue("ddlAdvSearchAirport",d.AirportCode)}}}function goToSearchResultsFromAdvSearch(c){var b=-1;var k=-1;var f="";var l="";var d="";var h=-1;var a="";if(!CheckListBox("ddlAdvSearchDestinations")){b=getSelectedValue("ddlAdvSearchDestinations")}if(!CheckListBox("ddlAdvSearchLocalities")){k=getSelectedValue("ddlAdvSearchLocalities")}if(!CheckListBox("ddlAdvSearchDate")){l=getSelectedValue("ddlAdvSearchDate")}if(!CheckListBox("ddlAdvSearchAirport")){f=getSelectedValue("ddlAdvSearchAirport")}if(!CheckListBox("ddlAdvSearchPrice")){d=getSelectedValue("ddlAdvSearchPrice")}if(l==""){l=_$("ddlAdvSearchDate").options[0].value}if(k==-1){h=b}else{h=k}if(h==-1){alert("Selezionare almeno una destinazione o località")}else{if(isOmnitureEnabled()){var j=new Object();_$("ddlAdvSearchDestinations").selectedIndex=0;if(!CheckListBox("ddlAdvSearchLocalities")){j.destinazione=getSelectedText("ddlAdvSearchLocalities")}else{j.destinazione=getSelectedText("ddlAdvSearchDestinations")}j.data=l;j.adulti=getSelectedValue(c+"_ddlAdults");j.bambini=getSearchEngineChildren(c);j.avanzata=true;try{sc_trackSearch(j)}catch(g){}}document.forms.searchForm.destinationID.value=h;document.forms.searchForm.childDestinationID.value=k;document.forms.searchForm.departureDate.value=l;document.forms.searchForm.adults.value=getSelectedValue(c+"_ddlAdults");document.forms.searchForm.priceRange.value=d;document.forms.searchForm.airportCode.value=f;document.forms.searchForm.children.value=getSearchEngineChildren(c);document.forms.searchForm.advSearch.value="1";document.forms.searchForm.dateType.value="week";document.forms.searchForm.dateTo.value="";document.forms.searchForm.submit()}}function openDestinationsDialog(a,c,b){$$("destinationsDialog").load("/DestinationsLightbox.axd",{language:c,control:a,loyaltyflow:b},function(){$$("destinationsDialog").dialog("open")})}function setDestination(a,c,b){$$(a+"_selectedDestinationID").val(c);$$(a+"_selectedDestinationName").val(b);$$("destinationsDialog").dialog("close")}function isOmnitureEnabled(){return omniture_enabled}function loginUser(a){var b=new Array();if(IsEmpty(a+"_txtUsername")){b.push("Username")}if(IsEmpty(a+"_txtPassword")){b.push("Password")}OpenAlertError(b,a+"$lnkLogin")}function MaintainSession(){}function goToPackageFromLoyaltyLoginBox(b,c,e,j,g,a,f,d,k,h){document.forms.searchForm.destinationID.value=f;document.forms.searchForm.duration.value=c;document.forms.searchForm.searchDepartureDate.value=e;document.forms.searchForm.departureDate.value=j;document.forms.searchForm.adults.value=g;document.forms.searchForm.children.value=a;document.forms.searchForm.action=b;document.forms.searchForm.dateType.value=d;document.forms.searchForm.dateTo.value=k;$$("searchForm").append('<input type="hidden" id="loyalty" name="loyalty" value="'+h+'">');if(urlContains(b,"ref")){document.forms.searchForm.ref.value=getFromUrl(b,"ref")}document.forms.searchForm.submit()};