$(document).ready(function(){ initLogo(); initHover(); initMenuSite(); initSelect(); initDestList(); initCalendar(); initFootPopups(); initIDontKnowMyDates(); initSelectChild(); initOpenClose(); initAnotherRoom(); initQuestionBox(); initCarVariants(); initAdditionalTabs(); checkChildAgeDropDowns(); makeAllCalenders(); initTabs(); }); function initCalendar() { if ($('#calerdar-from').get(0)) { $('#calerdar-from').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatefrom, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calerdar-to').get(0)) { $('#calerdar-to').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateto, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin').get(0)) { $('#calendar-checkin').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout').get(0)) { $('#calendar-checkout').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin2').get(0)) { $('#calendar-checkin2').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein2, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout2').get(0)) { $('#calendar-checkout2').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout2, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin3').get(0)) { $('#calendar-checkin3').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein3, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout3').get(0)) { $('#calendar-checkout3').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout3, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin4').get(0)) { $('#calendar-checkin4').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein4, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout4').get(0)) { $('#calendar-checkout4').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout4, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin5').get(0)) { $('#calendar-checkin5').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein5, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout5').get(0)) { $('#calendar-checkout5').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout5, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin6').get(0)) { $('#calendar-checkin6').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein6, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout6').get(0)) { $('#calendar-checkout6').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout6, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin7').get(0)) { $('#calendar-checkin7').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein7, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout7').get(0)) { $('#calendar-checkout7').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout7, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin8').get(0)) { $('#calendar-checkin8').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein8, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout8').get(0)) { $('#calendar-checkout8').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout8, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin9').get(0)) { $('#calendar-checkin9').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein9, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout9').get(0)) { $('#calendar-checkout9').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout9, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin10').get(0)) { $('#calendar-checkin10').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein10, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout10').get(0)) { $('#calendar-checkout10').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout10, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin11').get(0)) { $('#calendar-checkin11').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein11, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout11').get(0)) { $('#calendar-checkout11').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout11, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkin12').get(0)) { $('#calendar-checkin12').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein12, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#calendar-checkout12').get(0)) { $('#calendar-checkout12').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout12, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#anchor11').get(0)) { $('#anchor11').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout12, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } if ($('#anchor12').get(0)) { $('#anchor12').datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updateout12, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); } } function updatefrom(date) { $('#from-date').val(date); } function updateto(date) { $('#to-date').val(date); } function updatein(date) { $('#check-in').val(date); } function updateout(date) { $('#check-out').val(date); } function updatein2(date) { $('#check-in2').val(date); } function updateout2(date) { $('#check-out2').val(date); } function updatein3(date) { $('#check-in3').val(date); } function updateout3(date) { $('#check-out3').val(date); } function updatein4(date) { $('#check-in4').val(date); } function updateout4(date) { $('#check-out4').val(date); } function updatein5(date) { $('#check-in5').val(date); } function updateout5(date) { $('#check-out5').val(date); } function updatein6(date) { $('#check-in6').val(date); } function updateout6(date) { $('#check-out6').val(date); } function updatein7(date) { $('#check-in7').val(date); } function updateout7(date) { $('#check-out7').val(date); } function updatein8(date) { $('#check-in8').val(date); } function updateout8(date) { $('#check-out8').val(date); } function updatein9(date) { $('#check-in9').val(date); } function updateout9(date) { $('#check-out9').val(date); } function updatein10(date) { $('#check-in10').val(date); } function updateout10(date) { $('#check-out10').val(date); } function updatein11(date) { $('#check-in11').val(date); } function updateout11(date) { $('#check-out11').val(date); } function updatein12(date) { $('#check-in12').val(date); } function updateout12(date) { $('#check-out12').val(date); } function initLogo() { //$("div.logo div.details").hover( $("div.logo").hover( function(){ //$(this).parents('div.logo').addClass('active-logo'); $(this).addClass('active-logo'); }, function(){ //$(this).parents('div.logo').removeClass('active-logo'); $(this).removeClass('active-logo'); } ); } function initMenuSite() { $("ul.site a.link").click(function(e){ e.preventDefault(); $(this).parent('li').toggleClass('active'); }); $("ul.site li").hover( function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover');} ); } function initSelect() { if (includeCustomDropDowns) { $("select").selectbox(); } } function initTabs() { $("div.sidebar > ul.tabs").tabs(); $("#popup-destination-list ul.dl-tabs").tabs(); $('#map-search a.close').click(function(e){ e.preventDefault(); $(this).parents('div.sidebar').find('ul.ui-tabs-nav li.ui-state-active').removeClass('ui-state-active'); $(this).parents('div.sidebar').find('ul.ui-tabs-nav li:first').addClass('ui-state-active'); $(this).parents('div.sidebar').find('#map-search').addClass('ui-tabs-hide'); $(this).parents('div.sidebar').find('#quick-search').removeClass('ui-tabs-hide'); }); } function initHover() { $("div.bottom-bar ul.link li").hover( function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover');} ); } function initDestList(){ $('#btn-dest-list').click(function(){ //$(this).toggleClass('btn-dest-active'); //$('#popup-destination-list').toggleClass('destination-list-hide'); return false; }); $('#popup-destination-list a.close').click(function(){ //$('#btn-dest-list').removeClass('btn-dest-active'); //$('#popup-destination-list').addClass('destination-list-hide'); return false; }); /*$('#popup-destination-list ul.dests a').click(function(){ //$('#btn-dest-list').removeClass('btn-dest-active'); //$('#popup-destination-list').addClass('destination-list-hide'); if ($('#your_destination').val() == "") { //$('#your_destination').val($(this).text()); } else { //$('#your_destination').val($('#your_destination').val() + "," + $(this).text()); } return false; });*/ } function initFootPopups(){ $('#footer div.bottom-bar ul.link li a').click(function(){ if($(this).parent().find('div').length == 0) return true; if($(this).parent().hasClass('popup-active')) return false; $('#footer div.bottom-bar ul.link li').removeClass('popup-active'); $(this).parent().addClass('popup-active'); return false; }); $('#footer div.bottom-bar ul.link a.close').click(function(){ $('#footer div.bottom-bar ul.link li').removeClass('popup-active'); return false; }); } function initIDontKnowMyDates() { $("input.dont_know").click(function (){ if($(this)[0].checked){ $(this).parent().parent().find('li input.form-text').addClass('inactive'); $(this).parent().parent().find('li input.form-text2').addClass('inactive'); $(this).parent().parent().find('li input.form-text').attr('disabled', true); $(this).parent().parent().find('li input.form-text2').attr('disabled', true); } else{ $(this).parent().parent().find('li input.form-text').removeClass('inactive'); $(this).parent().parent().find('li input.form-text2').removeClass('inactive'); $(this).parent().parent().find('li input.form-text').attr('disabled', false); $(this).parent().parent().find('li input.form-text2').attr('disabled', false); } }); } function initSelectChild() { $("li.nchild span.jquery-selectbox-item").click(function (){ if(parseInt($(this).text()) == 0) { $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox').hide('fast',function(){ if (!$('li.child-age div.jquery-selectbox:visible').size()){ $(this).parents('div.room').find('div.with-headers li.child-age label').hide('fast'); } }); } if(parseInt($(this).text()) == 1) { $(this).parents('div.room').find('div.with-headers li.child-age label').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:lt(1)').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:gt(0)').hide('fast'); } if(parseInt($(this).text()) == 2) { $(this).parents('div.room').find('div.with-headers li.child-age label').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:lt(2)').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:gt(1)').hide('fast'); } if(parseInt($(this).text()) == 3) { $(this).parents('div.room').find('div.with-headers li.child-age label').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:lt(3)').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox:gt(2)').hide('fast'); } if(parseInt($(this).text()) == 4) { $(this).parents('div.room').find('div.with-headers li.child-age label').show('fast'); $(this).parents('div.form-item').find('li.child-age div.jquery-selectbox').show('fast'); } }); } function initOpenClose() { $('div.block-inner a.click').click(function (e) { e.preventDefault(); if ($(this).parents('div.block-inner').find('div.room').is(":hidden")) { $(this).parents('div.block-inner').find('div.thumbnail').slideDown('fast'); $(this).parents('div.block-inner').find('div.room').slideDown('fast'); $(this).parents('div.block-inner').find('div.car-options').show(); $(this).parents('div.block-inner').find('div.message').slideUp('fast'); $(this).parents('div.block-inner').find('a.click').css('background-position','100% -22px'); $(this).parents('div.block-inner').find('div.check ul.radios-inline').show(); $(this).parents('div.block-inner').find('div.check a.get-a-quote').hide(); $(this).parents('div.block-inner').find('div.respons a.click').text('Save & Minimize'); } else { $(this).parents('div.block-inner').find('div.message').slideDown('fast'); $(this).parents('div.block-inner').find('div.thumbnail').slideUp('fast'); $(this).parents('div.block-inner').find('div.car-options').hide(); $(this).parents('div.block-inner').find('div.room').slideUp('fast'); $(this).parents('div.block-inner').find('a.click').css('background-position','100% 0'); $(this).parents('div.block-inner').find('div.check a.get-a-quote').show(); $(this).parents('div.block-inner').find('div.check ul.radios-inline').hide(); $(this).parents('div.block-inner').find('div.respons a.click').text('Maximize'); //This does a ajax call to the script that does the saving of the enquiry.. saveThisEnquiry($(this).parents('div.block-inner').find('#form_number').val()); } }); } function initAnotherRoom(){ $('div.another-room a').click(function (e) { e.preventDefault(); $(this).parents('div.block-inner').find('div.room-options:last').clone(true).insertAfter($(this).parents('div.block-inner').find('div.room-options:last')); $(this).parents('div.block-inner').find('div.room-options:last').addClass('wo-headers'); //$(this).parents('div.block-inner').find('div.room-options:last').addClass('roomNumber_'+initRoomCounters); //initRoomCounters++; }); } function initQuestionBox(){ $('div.ask-question input').click(function () { if($(this)[0].checked){ $(this).parents('div.room').find('div.question-area label').hide(); $(this).parents('div.room').find('div.question-area').slideDown('fast'); } else { $(this).parents('div.room').find('div.question-area').slideUp('fast'); } }); } function initCarVariants(){ $('div.car-options input:radio').click(function (){ if($(this).val() == '1'){ $(this).parents('div.block-inner').find('div.pick-up-top').hide(); $(this).parents('div.block-inner').find('li.inline-time').show(); $(this).parents('div.block-inner').find('li.place-info').hide(); $(this).parents('div.block-inner').find('li.location').show(); $(this).parents('div.block-inner').find('div.label-width').show(); $(this).parents('div.block-inner').find('div.ask-question').show(); $(this).parents('div.block-inner').find('div.question-area').hide(); } if($(this).val() == '2'){ $(this).parents('div.block-inner').find('div.pick-up-top').hide(); $(this).parents('div.block-inner').find('li.inline-time').show(); $(this).parents('div.block-inner').find('li.place-info').show(); $(this).parents('div.block-inner').find('li.location').hide(); $(this).parents('div.block-inner').find('div.label-width').show(); $(this).parents('div.block-inner').find('div.ask-question').show(); $(this).parents('div.block-inner').find('div.question-area').hide(); } if($(this).val() == '3'){ $(this).parents('div.block-inner').find('div.pick-up-top').show(); $(this).parents('div.block-inner').find('li.inline-time').hide(); $(this).parents('div.block-inner').find('li.place-info').show(); $(this).parents('div.block-inner').find('li.location').hide(); $(this).parents('div.block-inner').find('div.label-width').hide(); $(this).parents('div.block-inner').find('div.pick-up-top li.location').show(); $(this).parents('div.block-inner').find('div.pick-up-top li.inline-time').show(); $(this).parents('div.block-inner').find('div.ask-question').show(); $(this).parents('div.block-inner').find('div.question-area').show(); $(this).parents('div.block-inner').find('div.ask-question').hide(); $(this).parents('div.block-inner').find('div.question-area').show(); $(this).parents('div.block-inner').find('div.question-area label').show(); } }); } function checkChildAgeDropDowns () { var i = 0; form = $("#form_number_"+i); while (form.find("h3:eq(0)").html()) { var t = 0; value = form.find("div.room-options:eq("+t+") li.nchild .jquery-selectbox-currentItem").html(); while (value) { if (value > 0) { form.find('div.with-headers:eq('+t+') li.child-age label').show('fast'); form.find('div.room-options:eq('+t+') li.child-age div.jquery-selectbox:lt('+value+')').show('fast'); form.find('div.room-options:eq('+t+') li.child-age div.jquery-selectbox:gt('+(value-1)+')').hide('fast'); } t++; value = form.find("div.room-options:eq("+t+") li.nchild .jquery-selectbox-currentItem").html(); } i++; form = $("#form_number_"+i); } } function makeAllCalenders () { var cntr = 0; var enquiryCalender = $('#check-in_'+cntr).get(0); var enquiryCalender2 = $('#check-out_'+cntr).get(0); while (enquiryCalender) { //alert(cntr); $('#check-in_'+cntr).datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein2, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); $('#check-out_'+cntr).datepick({closeAtTop: false, showOn: 'button', changeMonth: false, dateFormat: 'dd/mm/yy', onSelect: updatein2, changeYear: false, mandatory: true, buttonImageOnly: true, buttonImage: 'images/ico-calendar.gif'}); cntr++; var enquiryCalender = $('#check-in_'+cntr).get(0); var enquiryCalender2 = $('#check-out_'+cntr).get(0); } } function initAdditionalTabs(){ /*$('ul.add_tabs').append($('div.scrollable ul.tabs li:gt(5)'));*/ }