$(function(){$(document).pngFix();$("a.new-window").click(function(){window.open(this.href);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(a){var b=new Array();if(IsEmpty(a+"_txtDate")){b.push("Data di partenza")}if(CheckSelect(a+"_ddlDestinations","-1")){b.push("Selezionare una destinazione")}if(OpenAlertError(b)){document.forms.searchForm.destinationID.value=getSelectedValue(a+"_ddlDestinations");document.forms.searchForm.departureDate.value=$("#"+a+"_txtDate").val();document.forms.searchForm.searchDepartureDate.value=$("#"+a+"_txtDate").val();document.forms.searchForm.adults.value=getSelectedValue(a+"_ddlAdults");document.forms.searchForm.children.value=getSearchEngineChildren(a);document.forms.searchForm.dateType.value="week";document.forms.searchForm.dateTo.value="";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="";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,i){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=i;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(f){var b=-1;var e=-1;var a="";var g="";var d="";var c=-1;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")}if(g==""){g=_$("ddlAdvSearchDate").options[0].value}if(b==-1){c=e}else{c=b}if(c==-1){alert("Selezionare almeno una destinazione o località")}else{document.forms.searchForm.destinationID.value=c;document.forms.searchForm.childDestinationID.value=e;document.forms.searchForm.departureDate.value=g;document.forms.searchForm.adults.value=getSelectedValue(f+"_ddlAdults");document.forms.searchForm.priceRange.value=d;document.forms.searchForm.airportCode.value=a;document.forms.searchForm.children.value=getSearchEngineChildren(f);document.forms.searchForm.advSearch.value="1";document.forms.searchForm.dateType.value="week";document.forms.searchForm.dateTo.value="";document.forms.searchForm.submit()}};