//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // jQuery //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var resizeId; var lastModal; var customizerEnabled = 0; var defaultColor; var originalNavigationCode; var navigationIsTouchingBrand; var responsiveNavigationTriggered = false; var lastclickinfo = new Array(); $(document).ready(function($) { "use strict"; /*$('#spinner').bind("ajaxSend", function() { $(this).show(); }).bind("ajaxComplete", function() { $(this).hide(); });*/ originalNavigationCode = $(".primary-nav").html(); if( $("body").hasClass("navigation-fixed") ){ fixedNavigation(true); } else { fixedNavigation(false); } if( customizerEnabled == 1 ){ $.getScript( "assets/misc/customizer.js", function( data, textStatus, jqxhr ) { loadColor("load_default_color"); }); } if( $(".tse-scrollable").length ){ $(".tse-scrollable").TrackpadScrollEmulator(); trackpadScroll("recalculate"); } if( $(".date-picker").length ){ $(".date-picker").datepicker({ language:'it' }); } heroSectionHeight(); // Render hero search form --------------------------------------------------------------------------------------------- $("select").on("rendered.bs.select", function () { var bootstrap_css = base_url + 'assets/css/bootstrap-select.min.css'; $('head').append( $('').attr('href', bootstrap_css) ); if( !viewport.is('xs') ){ $(".search-form.vertical").css( "top", ($(".hero-section").height()/2) - ($(".search-form .wrapper").height()/2) ); } trackpadScroll("initialize"); }); if( !viewport.is('xs') ){ $(".search-form.vertical").css( "top", ($(".hero-section").height()/2) - ($(".search-form .wrapper").height()/2) ); trackpadScroll("initialize"); } // Social Share ------------------------------------------------------------------------------------------------------- if( $(".social-share").length ){ socialShare(); } // Count down -------------------------------------------------------------------------------------------------------- if( $(".count-down").length ){ /* REMOVE THIS COMMENT IN YOUR PROJECT var year = parseInt( $(".count-down").attr("data-countdown-year"), 10 ); var month = parseInt( $(".count-down").attr("data-countdown-month"), 10 ) - 1; var day = parseInt( $(".count-down").attr("data-countdown-day"), 10 ); $(".count-down").countdown( {until: new Date(year, month, day), padZeroes: true, format: 'HMS'} ); */ var date = new Date(); $(".count-down").countdown( {until: new Date(date.getFullYear(), date.getMonth(), date.getDate() + 2 ), padZeroes: true, format: 'HMS'} ); } // iCheck ------------------------------------------------------------------------------------------------------------- if ($("input[type=checkbox]").length > 0) { $("input").iCheck(); } if ($("input[type=radio]").length > 0) { $("input").iCheck(); } // Smooth Scroll ------------------------------------------------------------------------------------------------------ $('.main-nav a[href^="#"], a[href^="#"].scroll').on('click',function (e) { e.preventDefault(); if( $(this).hasClass("to-top") ){ $('html, body').stop().animate({ 'scrollTop': 0 }, 2000, 'swing'); } else { var target = this.hash, $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top }, 2000, 'swing', function () { window.location.hash = target; }); } }); // Modal after click -------------------------------------------------------------------------------------------------- $("[data-modal-external-file], .quick-detail").live("click", function(e){ e.preventDefault(); var modalTarget, modalFile; if( $(this).closest(".item").attr("data-id") ){ modalTarget = $(this).closest(".item").attr("data-id"); modalFile = "modal_item.php"; } else { modalTarget = $(this).attr("data-target"); modalFile = $(this).attr("data-modal-external-file"); } if( $(this).attr("data-close-modal") == "true" ){ lastModal.modal("hide"); setTimeout(function() { openModal(modalTarget, modalFile); }, 400); } else { openModal(modalTarget, modalFile); } }); // Multiple modal hack ------------------------------------------------------------------------------------------------ $(document).on('show.bs.modal', '.modal', function () { var zIndex = 1040 + (10 * $('.modal:visible').length); $(this).css('z-index', zIndex); setTimeout(function() { $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack'); }, 0); }); // This just makes all bootstrap native .modals jive together /*$('.modal').on("hidden.bs.modal", function (e) { if($('.modal:visible').length) { $('.modal-backdrop').first().css('z-index', parseInt($('.modal:visible').last().css('z-index')) - 10); $('body').addClass('modal-open'); } }).on("show.bs.modal", function (e) { if($('.modal:visible').length) { $('.modal-backdrop.in').first().css('z-index', parseInt($('.modal:visible').last().css('z-index')) + 10); $(this).css('z-index', parseInt($('.modal-backdrop.in').first().css('z-index')) + 10); } });*/ // Map in Row listing ------------------------------------------------------------------------------------------------- $(".item.item-row").each(function() { var element = "map"+$(this).attr("data-id"); var place; $(this).find(".map").attr("id", element ); var _latitude = $(this).attr("data-latitude"); var _longitude = $(this).attr("data-longitude"); if( $(this).attr("data-address") ){ place = $(this).attr("data-address"); } else { place = false; } simpleMap(_latitude,_longitude, element, false, place); }); // Close "More" menu on click anywhere on page ------------------------------------------------------------------------ $(document).on("click", function(e){ if( e.target.className == "controls-more" ){ $(".controls-more.show").removeClass("show"); $(e.target).addClass("show"); } else { $(".controls-more.show").each(function() { $(this).removeClass("show"); }); } }); // Mobile navigation button -------------------------------------------------------------------------------------------- $(".nav-btn").on("click", function(){ $(this).toggleClass("active"); $(".primary-nav").toggleClass("show"); }); // Duplicate desired element ------------------------------------------------------------------------------------------ $(".duplicate").live("click", function(e){ e.preventDefault(); var duplicateElement = $(this).attr("href"); var parentElement = $(duplicateElement)[0].parentElement; $(parentElement).append( $(duplicateElement)[0].outerHTML ); }); // Enable image previews in multi file input -------------------------------------------------------------------------- if( $("input[type=file].with-preview").length ){ $("input.file-upload-input").MultiFile({ list: ".file-upload-previews" }); } // No UI Slider ------------------------------------------------------------------------------------------------------- if( $('.ui-slider').length > 0 ){ $('.ui-slider').each(function() { if( $("body").hasClass("rtl") ) var rtl = "rtl"; else rtl = "ltr"; var step; if( $(this).attr('data-step') ) { step = parseInt( $(this).attr('data-step') ); } else { step = 10; } var sliderElement = $(this).attr('id'); var element = $( '#' + sliderElement); var valueMin = parseInt( $(this).attr('data-value-min') ); var valueMax = parseInt( $(this).attr('data-value-max') ); $(this).noUiSlider({ start: [ valueMin, valueMax ], connect: true, direction: rtl, range: { 'min': valueMin, 'max': valueMax }, step: step }); if( $(this).attr('data-value-type') == 'price' ) { if( $(this).attr('data-currency-placement') == 'before' ) { $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ prefix: $(this).attr('data-currency'), decimals: 0, thousand: '.' })); $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ prefix: $(this).attr('data-currency'), decimals: 0, thousand: '.' })); } else if( $(this).attr('data-currency-placement') == 'after' ){ $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ postfix: $(this).attr('data-currency'), decimals: 0, thousand: ' ' })); $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ postfix: $(this).attr('data-currency'), decimals: 0, thousand: ' ' })); } } else { $(this).Link('lower').to( $(this).children('.values').children('.value-min'), null, wNumb({ decimals: 0 })); $(this).Link('upper').to( $(this).children('.values').children('.value-max'), null, wNumb({ decimals: 0 })); } }); } // Calendar if( $(".calendar").length ){ var date = new Date(); var month = date.getMonth(); for( var i = 1 ; i<=12 ; i++ ){ $('.calendar-wrapper').append('
'); $("#month_"+i).zabuto_calendar({ ajax: { url: "assets/php/calendar.php", modal: true }, action: function () { var date = $("#" + this.id).data("date"); $("#modal-date").val(date); return checkDate(this.id); }, language: "en", month: i, show_previous: false, show_next: false, today: true, nav_icon: { prev: '', next: '' } }); } $(".calendar-wrapper").owlCarousel({ items: 2, nav: true, autoHeight: true, navText: [], startPosition: month }); } // Form Validation $(".form-email .btn[type='submit']").on("click", function(){ var button = $(this); var form = $(this).closest("form"); button.prepend("
"); form.validate({ submitHandler: function() { var email = base_url + "assets/external/email.php"; $.post(email, form.serialize(), function(response) { //console.log(response); button.find(".status").append(response); form.addClass("submitted"); }); return false; } }); }); equalHeight(".container"); ratingPassive("body"); bgTransfer(); responsiveNavigation(); $('#From').selectpicker().filter('.with-ajax').ajaxSelectPicker({ ajax : { url : base_url + 'index.php/search/from', type : 'POST', dataType: 'json', // Use "{{{q}}}" as a placeholder and Ajax Bootstrap Select will // automatically replace it with the value of the search query. data : { q: '{{{q}}}' } }, log : 0, preprocessData: function (data) { var i, l = data.length, array = []; if (l) { for (i = 0; i < l; i++) { array.push($.extend(true, data[i], { text : data[i].value, value: data[i].value + "|" + data[i].coordinate + '|' + data[i].kind, data : { subtext: data[i].coordinate + ', ' + data[i].kind } })); } } // You must always return a valid array when processing data. The // data argument passed is a clone and cannot be modified directly. return array; }, preserveSelected: true, processData:function(){ } }); $('#To').selectpicker().filter('.with-ajax').ajaxSelectPicker({ ajax : { url : base_url + 'index.php/search/to', type : 'POST', dataType: 'json', // Use "{{{q}}}" as a placeholder and Ajax Bootstrap Select will // automatically replace it with the value of the search query. data : function() { return { q: '{{{q}}}', altro: $("#From option:selected").text() }; } }, log : 0, preprocessData: function (data) { var i, l = data.length, array = []; if (l) { for (i = 0; i < l; i++) { array.push($.extend(true, data[i], { text : data[i].value, value: data[i].value + "|" + data[i].coordinate + '|' + data[i].kind, data : { subtext: data[i].coordinate + ', ' + data[i].kind } })); } } // You must always return a valid array when processing data. The // data argument passed is a clone and cannot be modified directly. return array; }, preserveSelected: true }); $('select').trigger('change'); /*$('#From2').on('change', function(){ var selected = $(this).find("option:selected").val(); alert(selected); });*/ var urlParams; (window.onpopstate = function () { var match, pl = /\+/g, // Regex for replacing addition symbol with a space search = /([^&=]+)=?([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, query = window.location.search.substring(1); urlParams = {}; while (match = search.exec(query)) urlParams[decode(match[1])] = decode(match[2]); })(); $(".result-item, .results-content .item").children("a").on("click", function(e){ e.preventDefault(); //openModal( $(this).parent().attr("data-id"), "modal_item.php" ); var Modal = site_url + "/search/openModal"; openModal( $(this).parent().attr("data-id"),urlParams, Modal ); }); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // On Load //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $(window).load(function(){ initializeOwl(); }); $(window).resize(function(){ clearTimeout(resizeId); resizeId = setTimeout(doneResizing, 250); }); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Functions //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function heroSectionHeight(){ if( $(".hero-section").length > 0 ){ if( viewport.is('xs') ){ $(".map-wrapper").height( $(window).height() - 25 ); $(".hero-section").height( $(".hero-section .map-wrapper").height() + $(".hero-section .search-form").height() + $(".hero-section .results").height() + 40 ); $(".has-background").css( "min-height", $(window).height() - $("#page-header").height() + "px" ); } else { if( $("body").hasClass("navigation-fixed") ){ $(".hero-section.full-screen").height( $(window).height() - $("#page-header nav").height() ); $(".hero-section .map-wrapper").css( "height", "100%" ); } else { $(".hero-section.full-screen").height( $(window).height() - $("#page-header").height() ); $(".hero-section .map-wrapper").css( "height", "100%" ); if( $(".map-wrapper").length > 0 ){ reloadMap(); } } } if( !viewport.is('xs') ){ $(".search-form.vertical").css( "top", ($(".hero-section").height()/2) - ($(".search-form .wrapper").height()/2) ); } } } function beepry(volo,date1,date2,adult,children,infant,k){ $.ajax({ url: base_url + "index.php/search/beepry", method: "POST", // dataType: "html", data: { volo:volo,date1:date1,date2:date2,adult:adult,children:children,infant:infant }, success: function(results){ $('#flight_'+k).html('
Caricamento Voli in Corso...
'); var fields = results.split(","); if (fields[1] == true) { beepryPolling(fields[0],k); } else{ $('#flight_'+k).html('

'+fields[0]+'

'); } }, error : function (e) { console.log(e); } }); } function ticketmaster(){ var To = $('#ToSearch').val().split("|"); var FromDate = $('#FromDate').text(); var ToDate = $('#ToDate').text(); $('#ticketmaster').html('
Caricamento Eventi in Corso...
'); $.ajax({ url: base_url + "index.php/search/ticketmaster", method: "POST", // dataType: "html", data: { coordinate:To[1],datefrom: FromDate,dateto:ToDate}, success: function(results){ $('#ticketmaster').html(results); }, complete: function(e) { initializeOwl(); }, error : function (e) { console.log(e); } }); } function rentalcars(){ $('#rentalcars').html('
Caricamento Auto in Corso...
'); $.ajax({ url: base_url + "index.php/search/rentalcars", method: "POST", // dataType: "html", success: function(results){ $('#rentalcars').empty(); $('#rentalcars').html('

directions_carNoleggia la tua AUTO

' + results + '
'); }, error : function (e) { console.log(e); } }); } //Inizio Prestia e Comande function prestiaecomande(k){ $('#bus_'+k).html('
Caricamento Prestia e Comandè in Corso...
'); $.ajax({ url: base_url + "index.php/search/prestiaecomade", method: "POST", // dataType: "html", data: { volo:volo,date1:date1,date2:date2,adult:adult,children:children,infant:infant }, success: function(results){ $('#bus_'+k).html('
Caricamento Bus in Corso...
'); $('#bus_'+k).html('
' + results + '
'); }, complete: function(data) { FromDate = $('#FromDate').text().replace("-","/"); FromDate = FromDate.replace("-","/"); ToDate = $('#ToDate').text().replace("-","/"); ToDate = ToDate.replace("-","/"); $('#f_data_partenza').val(FromDate); $('#f_data_ritorno').val(ToDate); passeggeri = 0; passeggeri = parseInt($('#AdultSelect').text()); passeggeri += parseInt($('#ChildSelect').text()); $('#passeggeri').empty(); for(k=0; k < passeggeri; k++) { valore = '
'; $('#passeggeri').append(valore); } $('#TotalPax').val(passeggeri); $("a.swapdate").click(function(){ var axix = document.getElementById("f_data_partenza").value; var byiy = document.getElementById("f_data_ritorno").value; document.getElementById('f_data_ritorno').value = axix; document.getElementById('f_data_partenza').value = byiy; }); $("#button_check").click(function() { // validate and process form here if($("#route").val() == ""){ alert("Selezionare la rotta"); return false; } var dataString = $( ":input" ).serialize(); //alert (dataString);return false; $.ajax({ type: "POST", url: base_url + "index.php/search/submit_prestiaecomande", data: dataString, success: function(results) { $('#contact_form').html("
"); $('#message').html("

Contact Form Submitted!

") .append("

We will be in touch soon.

") .hide() .fadeIn(1500, function() { $('#message').append(""); }); } }); return false; }); //alert(passeggeri); //alert (FromDate); /*$('#f_data_partenza').datepicker({ format: 'dd/mm/yyyy' , language: codice_lingua , startDate: FromDate , autoclose: true }).on('show.bs.modal', function(event) { // prevent datepicker from firing bootstrap modal "show.bs.modal" event.stopPropagation(); }); $('#f_data_ritorno').datepicker({ format: 'dd/mm/yyyy' , language: codice_lingua , startDate: ToDate , autoclose: true }).on('show.bs.modal', function(event) { // prevent datepicker from firing bootstrap modal "show.bs.modal" event.stopPropagation(); }); */ }, error : function (e) { console.log(e); } }); } //Fine Prestia e Comande function AgodaHotels(valore){ valore = Math.floor(Math.random() * 29) + 1; var To = $('#ToSearch').val(); $.ajax({ type: "POST", url: base_url + "index.php/search/AgodaDatabase", data:{ to:To, valore:valore}, success: function(results) { $('#AgodaHotels').html(results); }, complete: function(data) { setTimeout(function(){ valore = Math.floor(Math.random() * 29) + 1; AgodaHotels(valore) }, 15000); } }); } function ferrysearch(variabile) { completa = variabile; //alert (completa); variabile = variabile.split("_"); $.ajax({ type: "POST", url: base_url + "index.php/search/ferrysearch", data:{ from:variabile[1], to:variabile[2],lat1:variabile[3], lng1:variabile[4],lat2:variabile[5], lng2:variabile[6]}, success: function(results) { if (results == 1) { traghettilines(variabile[0]); } else if (results == 2) { libertylines(variabile[0]); } //$('#bus_'+variabile[0]).html(results); } }); //alert (variabile); } function bussearch(variabile) { completa = variabile; //alert (completa); variabile = variabile.split("_"); $.ajax({ type: "POST", url: base_url + "index.php/search/bussearch", data:{ from:variabile[1], to:variabile[2],lat1:variabile[3], lng1:variabile[4],lat2:variabile[5], lng2:variabile[6]}, success: function(results) { if (results == 1) { prestiaecomande(variabile[0]); } else if (results == 2) { busradar(completa); } else if (results == 3) { flixbus(variabile[0]); } else if (results == 4) { bigbusecubing(variabile[0]); } else if (results == 5) { terravision(variabile[0]); } else if (results == 6) { infobus(variabile[0]); } //$('#bus_'+variabile[0]).html(results); } }); //alert (variabile); } function initializeh3click() { $(".parent").children("h3").click(function(e){ e.preventDefault(); $(".parent").children("section").hide(); var splitto = $(this).prop('id').split("_"); if (splitto[0] == "bussearch") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); bussearch(splitto[1]+'_'+splitto[2]+'_'+splitto[3]+'_'+splitto[4]+'_'+splitto[5]+'_'+splitto[6]+'_'+splitto[7]); } $(this).siblings("section").toggle(); } else if (splitto[0] == "ferrysearch") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); ferrysearch(splitto[1]+'_'+splitto[2]+'_'+splitto[3]+'_'+splitto[4]+'_'+splitto[5]+'_'+splitto[6]+'_'+splitto[7]); } $(this).siblings("section").toggle(); } else if (splitto[0] == "busradar") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); busradar(splitto[1]); } $(this).siblings("section").toggle(); } else if (splitto[0] == "bigbusecubing") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); bigbusecubing(splitto[1]); } $(this).siblings("section").toggle(); } else if (splitto[0] == "trainsearch") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); train(splitto[1]); } /*$('#traincontent_'+splitto[1]).modal({ show: true, backdrop: 'static', keyboard: true });*/ $(this).siblings("section").toggle(); } else if (splitto[0] == "VoloBeepry") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); beepry(volo,date1,date2,adult,children,infant,splitto[1]); } $(this).siblings("section").toggle(); } else if (splitto[0] == "traghettilines") { if (lastclickinfo.indexOf(splitto[0]+"_"+splitto[1]) == "-1") { lastclickinfo.push(splitto[0]+"_"+splitto[1]); traghettilines(splitto[1]); } $(this).siblings("section").toggle(); } //$(".parent").children("section").hide(); //$(this).siblings("section").show(); //alert($(this).prop('id')); //$(this).siblings("section").toggle(1000,'linear'); }); } function train(k) { var From = $('#FromModal').val(); var To = $('#ToModal').val(); From = From.split(","); To = To.split(","); var FromDate = $('#FromDate').text(); FromDate = FromDate.replace("-","."); FromDate = FromDate.replace("-","."); var ToDate = $('#ToDate').text(); passeggeri = 0; passeggeri = parseInt($('#AdultSelect').text()); passeggeri += parseInt($('#ChildSelect').text()); $('#train_'+k).html('
Caricamento Treni in Corso...
'); /*$('#busradar').html('

directions_busPrenota il Tuo BUS e il tuo Treno


Un servizio offerto da busradar.it
');*/ //$('#train_'+k).html(''); $('#train_'+k).html(''); /*var From = $('#ToSearch').val(); var To = $('#FromSearch').val(); $.ajax({ type: "POST", url: base_url + "index.php/search/trainline", data:{ to:To, from:From}, success: function(results) { $('#train_'+k).html(results); } });*/ } function bigbusecubing(k){ $('#bus_'+k).html('
Caricamento Bus in Corso...
'); /*$('#busradar').html('

directions_busPrenota il Tuo BUS e il tuo Treno


Un servizio offerto da busradar.it
');*/ $('#bus_'+k).html('
'); } function busradar(k){ //alert (k); trovo = k.split("_"); var From = $('#FromModal').val(); var To = $('#ToModal').val(); From = From.split(","); To = To.split(","); var FromDate = $('#FromDate').text(); FromDate = FromDate.replace("-","."); FromDate = FromDate.replace("-","."); var ToDate = $('#ToDate').text(); passeggeri = 0; passeggeri = parseInt($('#AdultSelect').text()); passeggeri += parseInt($('#ChildSelect').text()); $('#bus_'+trovo[0]).html('
Caricamento Bus in Corso...
'); /*$('#busradar').html('

directions_busPrenota il Tuo BUS e il tuo Treno


Un servizio offerto da busradar.it
');*/ $('#bus_'+trovo[0]).html('

Un servizio offerto da busradar.it
'); } function trainline(){ $('#trainline').html('
Caricamento Treni in Corso...
'); /* var uri = 'https://impit.tradedoubler.com/imp?type(img)g(23905526)a(2953595)' + new String (Math.random()).substring (2, 11); $('#trainline').html(''); */ var From = $('#ToSearch').val(); var To = $('#FromSearch').val(); $.ajax({ type: "POST", url: base_url + "index.php/search/trainline", data:{ to:To, from:From}, success: function(results) { $('#trainline').html(results); } }); //$('#trainline').html('
'); } function tiqets(){ $('#tiqets').html('
Caricamento Eventi in Corso...
'); var city = $('#ToModal').val(); var idcity = 0; var trovocountries = 0; var trovocity = 0; /*$.ajax({ url: base_url + "index.php/search/tiqest", method: "POST", // dataType: "html", data: { city: city }, success: function(results){ $('#tiqets').html(results); }, error : function (e) { console.log(e); } });*/ $.ajax({ url: base_url + "index.php/search/tiqest_init", method: "POST", // dataType: "html", data: { page:1, page_size:1, countries: city }, success: function(results){ results = results.split("|"); lunghezza = results[2]/results[1]; if (results[2] > 0) { for (i=1; i<=lunghezza;i++) { page = i; page_size = results[1]; city = results[3]; $.ajax({ url: base_url + "index.php/search/tiqest_countries", method: "POST", // dataType: "html", data: { page:page, page_size:page_size, countries: city }, success: function(results){ if (results > 0) { i = lunghezza; $.ajax({ url: base_url + "index.php/search/tiqest_init_city", method: "POST", // dataType: "html", data: { page:1, page_size:1, countries: city, idcountries: results }, success: function(results){ resultscity = results.split("|"); lunghezzacity = resultscity[2]/resultscity[1]; for (l=1; l<=lunghezzacity;l++) { pagecities = l; page_sizecities = resultscity[1]; city = resultscity[3]; idcountries = resultscity[4]; $.ajax({ url: base_url + "index.php/search/tiqest_city", method: "POST", // dataType: "html", data: { page:pagecities, page_size:page_sizecities, countries: city, idcountries: idcountries }, success: function(results){ idcity = results; if (idcity > 0) { l = lunghezzacity; $.ajax({ url: base_url + "index.php/search/tiqest", method: "POST", // dataType: "html", data: { city: city, idcity :idcity }, success: function(results){ $('#tiqets').html(results); }, error : function (e) { console.log(e); } }); } }, error : function (e) { console.log(e); } }); } }, error : function (e) { console.log(e); } }); } }, error : function (e) { console.log(e); } }); } } }, error : function (e) { console.log(e); } }); $.ajax({ url: base_url + "index.php/search/tiqest", method: "POST", // dataType: "html", data: { city: city, idcity :idcity }, success: function(results){ $('#tiqets').html(results); }, error : function (e) { console.log(e); } }); } function citysightseeing(){ /*$('#busforfun').html('
Caricamento Divertimenti in Corso...
'); $('#busforfun').html('
');*/ $('#citysightseeing').html('
Caricamento in Corso...
'); $('#citysightseeing').html('

Prenota il Tuo Giro della Città

'); } function thefork(){ /*$('#busforfun').html('
Caricamento Divertimenti in Corso...
'); $('#busforfun').html('
');*/ $('#thefork').html('
Caricamento in Corso...
'); $('#thefork').html('

Prenota il Tuo Ristorante

'); } function flixbus(k){ /*$('#busforfun').html('
Caricamento Divertimenti in Corso...
'); $('#busforfun').html('
');*/ $('#bus_'+k).html('
Caricamento in Corso...
'); $('#bus_'+k).html('
'); } function infobus(k){ /*$('#busforfun').html('
Caricamento Divertimenti in Corso...
'); $('#busforfun').html('
');*/ $('#bus_'+k).html('
Caricamento in Corso...
'); $('#bus_'+k).html('
'); } function sportsevents365(){ $('#sportsevents365').html('
Caricamento Eventi Sportivi in Corso...
'); $('#sportsevents365').html('

Prenota il Tuo Evento Sportivo

UEFA Champions League tickets
'); } function hotelsclick(){ $('#hotelsclick').html('
Caricamento Hotels in Corso...
'); var uri = 'https://impit.tradedoubler.com/imp?type(iframe)g(23009580)a(2953595)' + new String (Math.random()).substring (2, 11); $('#hotelsclick').html(''); } function bookingcom1(){ $('#bookingcom1').empty(); $('#bookingcom1').html('
Caricamento Hotels in Corso...
'); $.ajax({ url: base_url + "index.php/search/bookingcom1", method: "POST", // dataType: "html", success: function(results){ $('#bookingcom1').html(results); }, error : function (e) { console.log(e); } }); } function bookingcom2(){ $('#bookingcom2').empty(); $('#bookingcom2').html('
Caricamento Hotels in Corso...
'); $.ajax({ url: base_url + "index.php/search/bookingcom2", method: "POST", // dataType: "html", success: function(results){ $('#bookingcom2').html('

Prenota la Tua Struttura

' + results + '
'); }, error : function (e) { console.log(e); } }); } function adsense(){ //$('#adsense').html(''); } function traghettilines(k){ $('#ferry_'+k).html('
Caricamento Traghetti in Corso...
'); $.ajax({ url: base_url + "index.php/search/traghettilines", method: "POST", // dataType: "html", success: function(results){ $('#ferry_'+k).html('
' + results + '
'); }, error : function (e) { console.log(e); } }); } function libertylines(k){ $('#ferry_'+k).html('
Caricamento Traghetti in Corso...
'); $.ajax({ url: base_url + "index.php/search/libertylines", method: "POST", // dataType: "html", success: function(results){ $('#ferry_'+k).html('
' + results + '
'); }, error : function (e) { console.log(e); } }); } function beepryPolling(session,k){ $.ajax({ url: base_url + "index.php/search/beepryPolling", method: "POST", // dataType: "html", data: { session:session }, success: function(results){ $('#flight_'+k).html('
Caricamento Voli in Corso...stato richiesta: '+results+'
'); if (results == "UpdatesComplete") { showbeepry(session,k); } else{ setTimeout(function(){ beepryPolling(session,k); },200) } }, error : function (e) { console.log(e); } }); } function showbeepry(session,k){ $.ajax({ url: base_url + "index.php/search/showbeepry", method: "POST", // dataType: "html", data: { session:session }, success: function(results){ if (results != ""){ $('#flight_'+k).html('
' + results + '
'); //initializeEasySteps(); } else { $('#flight_'+k).html('

Prenota il Tuo Volo

Nessun Volo trovato in base alle richieste! Si prega di riprovare con date diverse
'); } }, complete:function(e) { initializeEasyPaginate(); }, error : function (e) { console.log(e); } }); } function openModal(target,urlparam, modalPath){ lastclickinfo = new Array(); $("body").append(''); $("#" + target + ".modal").on("show.bs.modal", function () { var _this = $(this); lastModal = _this; //alert (_this); $.ajax({ //url: base_url + "assets/external/" + modalPath, url: modalPath, method: "POST", dataType: "html", data: { id: target, param:urlparam }, success: function(results){ _this.html(results); var bootstrap_css = base_url + 'assets/css/bootstrap-select.min.css'; $('head').append( $('').attr('href', bootstrap_css) ); $(".selectpicker").selectpicker(); if( $("input[type=file]").length ){ $.getScript( base_url + "assets/js/jQuery.MultiFile.min.js", function( data, textStatus, jqxhr ) { $("input.file-upload-input").MultiFile({ list: ".file-upload-previews" }); }); } _this.find(".gallery").addClass("owl-carousel"); ratingPassive(".modal"); var img = _this.find(".gallery img:first")[0]; if( img ){ $(img).load(function() { timeOutActions(_this); }); } else { timeOutActions(_this); } // socialShare(); _this.on("hidden.bs.modal", function () { $(lastClickedMarker).removeClass("active"); $(".pac-container").remove(); _this.remove(); }); _this.addClass("show"); }, error : function (e) { console.log(e); } }); }); $("#" + target + ".modal").modal("show"); function timeOutActions(_this){ setTimeout(function(){ /*if( _this.find(".map").length ){ if( _this.find(".modal-dialog").attr("data-address") ){ simpleMap( 0, 0, "map-modal", _this.find(".modal-dialog").attr("data-marker-drag"), _this.find(".modal-dialog").attr("data-address") ); } else { simpleMap( _this.find(".modal-dialog").attr("data-latitude"), _this.find(".modal-dialog").attr("data-longitude"), "map-modal", _this.find(".modal-dialog").attr("data-marker-drag") ); } }*/ bookingcom1(); adsense(); rentalcars(); sportsevents365(); AgodaHotels(0); tiqets(); ticketmaster(); //thefork(); //citysightseeing(); //initializeOwl(); //initializeFitVids(); //initializeReadMore(); initializeh3click(); }, 200); //alert($('#ToSearch').val()); } } // Transfer "img" into CSS background-image function bgTransfer(){ //disable-on-mobile if( viewport.is('xs') ){ } $(".bg-transfer").each(function() { $(this).css("background-image", "url("+ $(this).find("img").attr("src") +")" ); }); } function ratingPassive(element){ $(element).find(".rating-passive").each(function() { for( var i = 0; i < 5; i++ ){ if( i < $(this).attr("data-rating") ){ $(this).find(".stars").append("
") } else { $(this).find(".stars").append("
") } } }); } function socialShare(){ var socialButtonsEnabled = 0; if ( socialButtonsEnabled == 1 ){ var jssocials_css = base_url + 'assets/css/jssocials.css'; var jssocials_theme_css = base_url + 'assets/css/jssocials-theme-minima.css'; $('head').append( $('').attr('href', jssocials_css) ); $('head').append( $('').attr('href', jssocials_theme_css) ); $.getScript( base_url +"assets/js/jssocials.min.js", function( data, textStatus, jqxhr ) { $(".social-share").jsSocials({ shares: ["twitter", "facebook", "googleplus", "linkedin", "pinterest"] }); }); } } function initializeFitVids(){ if ($(".video").length > 0) { $(".video").fitVids(); } } function initializeOwl(){ if( $(".owl-carousel").length ){ $(".owl-carousel").each(function() { var items = parseInt( $(this).attr("data-owl-items"), 10); if( !items ) items = 1; var nav = parseInt( $(this).attr("data-owl-nav"), 2); if( !nav ) nav = 0; var dots = parseInt( $(this).attr("data-owl-dots"), 2); if( !dots ) dots = 0; var center = parseInt( $(this).attr("data-owl-center"), 2); if( !center ) center = 0; var loop = parseInt( $(this).attr("data-owl-loop"), 2); if( !loop ) loop = 0; var margin = parseInt( $(this).attr("data-owl-margin"), 2); if( !margin ) margin = 0; var autoWidth = parseInt( $(this).attr("data-owl-auto-width"), 2); if( !autoWidth ) autoWidth = 0; var navContainer = $(this).attr("data-owl-nav-container"); if( !navContainer ) navContainer = 0; var autoplay = $(this).attr("data-owl-autoplay"); if( !autoplay ) autoplay = 0; var fadeOut = $(this).attr("data-owl-fadeout"); if( !fadeOut ) fadeOut = 0; else fadeOut = "fadeOut"; if( $("body").hasClass("rtl") ) var rtl = true; else rtl = false; $(this).owlCarousel({ navContainer: navContainer, animateOut: fadeOut, autoplaySpeed: 2000, autoplay: autoplay, autoheight: 1, center: center, loop: loop, margin: margin, autoWidth: autoWidth, items: items, nav: nav, dots: dots, autoHeight: true, rtl: rtl, navText: [] }); if( $(this).find(".owl-item").length == 1 ){ $(this).find(".owl-nav").css( { "opacity": 0,"pointer-events": "none"} ); } }); } } function trackpadScroll(method){ if( method == "initialize" ){ if( $(".results-wrapper").find("form").length ) { if( !viewport.is('xs') ){ $(".results-wrapper .results").height( $(".results-wrapper").height() - $(".results-wrapper .form")[0].clientHeight ); } } } else if ( method == "recalculate" ){ setTimeout(function(){ if( $(".tse-scrollable").length ){ $(".tse-scrollable").TrackpadScrollEmulator("recalculate"); } }, 1000); } } // Do after resize function doneResizing(){ var $equalHeight = $('.container'); for( var i=0; i<$equalHeight.length; i++ ){ equalHeight( $equalHeight ); } responsiveNavigation(); heroSectionHeight(); } // Responsive Navigation function responsiveNavigation(){ if( viewport.is('xs') ){ $("body").addClass("nav-btn-only"); if( $("body").hasClass("nav-btn-only") && responsiveNavigationTriggered == false ){ responsiveNavigationTriggered = true; $(".primary-nav .has-child").children("a").attr("data-toggle", "collapse"); $(".primary-nav .has-child").find(".nav-wrapper").addClass("collapse"); $(".mega-menu .heading").each(function(e) { $(this).wrap(""); $(this).parent().attr("data-toggle", "collapse"); $(this).parent().addClass("has-child"); $(this).parent().attr("aria-controls", "mega-menu-collapse-"+e); }); $(".mega-menu ul").each(function(e) { $(this).attr("id", "mega-menu-collapse-"+e); $(this).addClass("collapse"); }); } } else { navigationIsTouchingBrand = false; responsiveNavigationTriggered = false; $("body").removeClass("nav-btn-only"); $(".primary-nav").html(""); $(".primary-nav").html(originalNavigationCode); } } function equalHeight(container){ if( !viewport.is('xs') ){ var currentTallest = 0, currentRowStart = 0, rowDivs = new Array(), $el, topPosition = 0; $(container).find('.equal-height').each(function() { $el = $(this); //var marginBottom = $el.css("margin-bottom").replace("px", ""); //console.log( $el.css("margin-bottom").replace("px", "") ); $($el).height('auto'); topPostion = $el.position().top; if (currentRowStart != topPostion) { for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } rowDivs.length = 0; // empty the array currentRowStart = topPostion; currentTallest = $el.height(); rowDivs.push($el); } else { rowDivs.push($el); currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest); } for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) { rowDivs[currentDiv].height(currentTallest); } }); } } // Viewport ------------------------------------------------------------------------------------------------------------ var viewport = (function() { var viewPorts = ['xs', 'sm', 'md', 'lg']; var viewPortSize = function() { return window.getComputedStyle(document.body, ':before').content.replace(/"/g, ''); }; var is = function(size) { if ( viewPorts.indexOf(size) == -1 ) throw "no valid viewport name given"; return viewPortSize() == size; }; var isEqualOrGreaterThan = function(size) { if ( viewPorts.indexOf(size) == -1 ) throw "no valid viewport name given"; return viewPorts.indexOf(viewPortSize()) >= viewPorts.indexOf(size); }; // Public API return { is: is, isEqualOrGreaterThan: isEqualOrGreaterThan } })(); // Rating -------------------------------------------------------------------------------------------------------------- function rating(element){ var ratingElement = ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '' ; if( !element ) { element = ''; } $.each( $(element + ' .star-rating'), function(i) { $(this).append(ratingElement); if( $(this).hasClass('active') ){ $(this).append(''); } // If rating exists var rating = $(this).attr('data-rating'); for( var e = 0; e < rating; e++ ){ var rate = e+1; console.log("a"); $(this).children('.stars').children( '.s' + rate ).addClass('active'); } }); var ratingActive = $('.star-rating.active i'); ratingActive.mouseenter(function() { for( var i=0; i<$(this).attr('data-score'); i++ ){ var a = i+1; $(this).parent().children('.s'+a).addClass('hover'); } }) .mouseleave(function() { for( var i=0; i<$(this).attr('data-score'); i++ ){ var a = i+1; $(this).parent().children('.s'+a).removeClass('hover'); } }); ratingActive.on('click', function(){ $(this).parents(".star-rating").find("input").val( $(this).attr('data-score') ); $(this).parent().children('.fa').removeClass('active'); for( var i=0; i<$(this).attr('data-score'); i++ ){ var a = i+1; $(this).parent().children('.s'+a).addClass('active'); } return false; }); } // Read more ----------------------------------------------------------------------------------------------------------- function initializeEasySteps() { $.ajax({ type: "GET", url: base_url + "assets/js/jquery.steps.min.js", success: StepsCallBack, dataType: "script", cache: true }); function StepsCallBack(){ var $readMore = $("#CentralSteps"); $readMore.steps({ headerTag: "h3", contentContainerTag: "section", transitionEffect: "slideLeft", stepsOrientation: "vertical", enablePagination: false, autoFcous: true, enableAllSteps: true }); } } function initializeEasyPaginate() { $.ajax({ type: "GET", url: base_url + "assets/js/jPages.min.js", success: readMoreCallBack, dataType: "script", cache: true }); function readMoreCallBack(){ var collapseHeight; var $readMore = $(".holder"); $readMore.jPages({ containerID : "VoloBeepryRead", perPage : 5, startPage : 1, startRange : 1, midRange : 8, endRange : 1, first : "primo", previous : "precedente", next : "successivo", last : "ultimo", animation : false, fallback : 200 }); } } function initializeReadMoreBeePry(){ $.ajax({ type: "GET", url: base_url + "assets/js/readmore.min.js", success: readMoreCallBack, dataType: "script", cache: true }); function readMoreCallBack(){ var collapseHeight; var $readMore = $(".VoloBeepryRead"); if( $readMore.attr("data-collapse-height") ){ collapseHeight = parseInt( $readMore.attr("data-collapse-height"), 10 ); }else { collapseHeight = 400; } $readMore.readmore({ speed: 500, collapsedHeight: collapseHeight, blockCSS: 'display: inline-block; width: auto; min-width: 120px;', moreLink: 'Mostra Tutti i voli', lessLink: 'Mostra Meno' }); } } function initializeReadMore(){ $.ajax({ type: "GET", url: base_url + "assets/js/readmore.min.js", success: readMoreCallBack, dataType: "script", cache: true }); function readMoreCallBack(){ var collapseHeight; var $readMore = $(".read-more"); if( $readMore.attr("data-collapse-height") ){ collapseHeight = parseInt( $readMore.attr("data-collapse-height"), 10 ); }else { collapseHeight = 55; } $readMore.readmore({ speed: 500, collapsedHeight: collapseHeight, blockCSS: 'display: inline-block; width: auto; min-width: 120px;', moreLink: 'Leggi Tutto', lessLink: 'Leggi Meno' }); } } function fixedNavigation(state){ if( state == true ){ $("body").addClass("navigation-fixed"); var headerHeight = $("#page-header").height(); $("#page-header").css("position", "fixed"); $("#page-content").css({ "-webkit-transform" : "translateY(" + headerHeight + "px)", "-moz-transform" : "translateY(" + headerHeight + "px)", "-ms-transform" : "translateY(" + headerHeight + "px)", "-o-transform" : "translateY(" + headerHeight + "px)", "transform" : "translateY(" + headerHeight + "px)" }); } else if( state == false ) { $("body").removeClass("navigation-fixed"); $("#page-header").css("position", "relative"); $("#page-content").css({ "-webkit-transform" : "translateY(0px)", "-moz-transform" : "translateY(0px)", "-ms-transform" : "translateY(0px)", "-o-transform" : "translateY(0px)", "transform" : "translateY(0px)" }); } } // Show element after desired time ------------------------------------------------------------------------------------ if( !viewport.is('xs') ){ var messagesArray = []; $("[data-toggle=popover]").popover({ template: '' }); $(".popover .close").live('click',function () { $(this).closest(".popover").popover("hide"); }); $("[data-show-after-time]").each(function() { var _this = $(this); setTimeout(function(){ if( _this.attr("data-toggle") == "popover" ){ _this.popover("show"); } else { for( var i=0; i < messagesArray.length; i++ ){ $(messagesArray[i]).css("bottom", parseInt( $(messagesArray[i]).css("bottom") ) + _this.context.clientHeight + 10 ); } messagesArray.push(_this); _this.addClass("show"); if( _this.attr("data-close-after-time") ){ setTimeout(function(){ closeThis(); }, _this.attr("data-close-after-time") ); } } }, _this.attr("data-show-after-time") ); $(this).find(".close").on("click",function () { closeThis(); }); function closeThis(){ _this.removeClass("show"); setTimeout(function(){ _this.remove(); }, 400 ); } }); } // Show element when scrolled desired amount of pixels ---------------------------------------------------------------- $("[data-show-after-scroll]").each(function() { var _this = $(this); var scroll = _this.attr("data-show-after-scroll"); var offsetTop = $(this).offset().top; $(window).scroll(function() { var currentScroll = $(window).scrollTop(); if (currentScroll >= scroll) { _this.addClass("show"); } else { _this.removeClass("show"); } }); });