{"version":3,"file":"search-2.0.18.min.js","sources":["walt-disney-world/cogs/js/search-2.0.18.min.js"],"sourcesContent":["// Functions for Walt Disney World searches; v2.0.0\n// Author: Tom Nelson, December 2015\n\n// -------------------------------------------------------------------------------------------------------------------\n\n// Quick quote panel; homepage only\n\n// Determine if user is a travel agent\nvar agent = ($('body').attr('data-agent') == 'true');\n\n// Check if selected dates are eligible for current offer\nfunction offerEligible(outbound, inbound) {\n if (typeof showPrelaunchSearchWarningModal !== 'undefined' && showPrelaunchSearchWarningModal) {\n warningOfferPrelaunchModal();\n return false;\n }\n\n var offerType = $('#quick-quote').attr('data-offer-type');\n if (offerType == null || offerType == 'undefined') { offerType = 'free-dine' };\n // Is the arrival journey after the last offer date? Or is the journey window is excluded from the offer\n /*if (inbound >= departureWindowEnd.getTime() && offerType != 'free-nights') {\n warning('Sorry, your return journey is after ' + moment(departureWindowEnd).subtract(1, 'days').format('Do MMMM YYYY') + '.', 'Unfortunately Disney Hotels are not yet on sale for the dates you\\'ve chosen. Please adjust your dates or call our Disney Experts freephone on ' + phone + '* for help with your enquiry.')\n return false;\n }*/\n //Free Dine\n // Is the arrival journey before the offer start date?\n /*if (outbound.getTime() < arrivalWindowStart.getTime() && offerType != 'free-nights') {\n warning('Your dates aren\\'t eligible for our Early Booker Package offer.', 'Unfortunately, the dates you\\'ve selected don\\'t benefit from our Early Booker Package offer. Arrivals before ' + moment(arrivalWindowStart).format('Do MMMM YYYY') + ' are excluded, so please adjust and search again.')\n return false;\n }\n // Is the arrival journey after the last offer date? Or is the journey window is excluded from the offer\n if (outbound >= departureWindowEnd.getTime() && offerType != 'free-nights') {\n warning('Your dates aren\\'t eligible for our Early Booker Package offer.', 'Unfortunately, the dates you\\'ve selected don\\'t benefit from our Early Booker Package offer. Arrivals after ' + moment(departureWindowEnd).subtract(1, 'days').format('Do MMMM YYYY') + ' are excluded, so please adjust and search again.')\n return false;\n }*/\n if (offerType !== 'free-nights' && typeof exclusionWindows === 'object' && exclusionWindows.length && dateIsExcluded(outbound)) {\n warningOfferModal();\n return false;\n }\n //Free Nights\n if (outbound.getTime() < arrivalWindowStart.getTime()\n || outbound.getTime() > arrivalWindowEnd.getTime()\n || (inbound > departureWindowEnd.getTime()\n || (exclusionWindowStart.getTime() <= outbound.getTime() && outbound.getTime() <= exclusionWindowEnd.getTime())\n || (outbound.getTime() < exclusionWindowStart.getTime() && inbound >= exclusionWindowStart.getTime()))\n ) {\n var exclusionStr;\n if (offerType == 'free-nights') {\n if (noExclusion) {\n exclusionStr = moment(arrivalWindowStart).format('Do MMMM YYYY') + ' and arrivals after ' + moment(arrivalWindowEnd).format('Do MMMM YYYY');\n }\n warning('Sorry, your dates aren\\'t eligible for this offer.', 'The dates you\\'ve selected don\\'t benefit from our Free Nights and Free Days package. Stays before ' + exclusionStr + ' are excluded, so please adjust your dates and search again.'); GA.sendEvent('Alert', 'Search', 'Free Nights Offer Off Sale');\n }\n else {\n warningOfferModal();\n // if (noExclusion) {\n // exclusionStr = 'Arrivals after ' + moment(arrivalWindowEnd).format('Do MMMM YYYY');\n // }\n // else {\n // exclusionStr = 'Easter (' + moment(exclusionWindowStart).format('Do MMMM') + ' – ' + moment(exclusionWindowEnd).format('Do MMMM') + ') and arrivals after ' + moment(arrivalWindowEnd).format('Do MMMM');\n // }\n // warning('Sorry, your travel dates are not eligible for an offer.', 'Unfortunately, the dates you\\'ve selected do not benefit from our free dining or 10% discount offers for ' + arrivalWindowEnd.getFullYear() + ' arrivals. ' + exclusionStr + ' are excluded, please adjust your dates and search again.'); GA.sendEvent('Alert', 'Search', 'Free Dine Offer Off Sale');\n }\n return false;\n }\n // Otherwise valid\n return true;\n}\n\n// Check duration is valid for holiday type\nfunction duration(type, nights) {\n // Determine minimum duration\n var minduration = 1;\n switch (type) { case 'flights': case 'package': minduration = 5; }\n // Is duration too short?\n if (nights < minduration) { warning('Sorry, your hotel stay is too short.', 'Unfortunately we require package hotel stays to be five nights or more. Please adjust your dates or call our Disney Experts freephone on ' + phone + '* for help with your enquiry.'); GA.sendEvent('Alert', 'Search', 'Below Minimum Stay Duration'); return false; };\n // Otherwise valid\n return true;\n}\n\n// Get dates for validation\nfunction valid(type) {\n // Get outbound and inbound dates and convert to date object\n var monthyear = $('#month').val();\n var year = parseInt(monthyear.split('^')[1]);\n var month = parseInt(monthyear.split('^')[0]) - 1; // Months are zero-indexed in JavaScript\n var day = parseInt($('#day').val());\n var nights = parseInt($('#nights').val())\n var outbound = new Date(year, month, day);\n var inbound = new Date(new Date(+outbound + (nights * 864e5)).toDateString()); // Convert to string to ensure 00:00:00\n var minimum = new Date(+new Date + 6048e5); // Bookings must be a minimum of 7 days (604800000 milliseconds) from today for flights/packages\n var minimumdays = 7;\n // Override miminum for ticket only\n switch (type) {\n case 'tickets': minimum = new Date(+new Date + 2592e5); minimumdays = 3; submit = true; break; // Bookings must be a minimum of 3 days (259200000 milliseconds) from today for ticket only\n };\n // Override minimum for travel agents\n if (agent) { minimum = new Date(+new Date + 1469e6); minimumdays = 17; } // Bookings must be a minimum of 17 days (1469000000 milliseconds) from today for all product types\n // Check eligible departure\n if (minimum.getTime() > outbound.getTime()) { warning('Sorry, your departure date is within ' + minimumdays + ' days.', 'Please adjust your dates and search again, or call our Disney Experts freephone on ' + phone + '* for help with your enquiry.'); GA.sendEvent('Alert', 'Search', 'Departure Within ' + minimumdays + ' Days'); return false; }\n // Validate pararmeters for hotel-inclusive holidays; ticket only searches are excluded from these checks\n if (type != 'tickets') {\n // Maximum of 8 pax online, excluding infants\n var infants = $('.ages select:has(option[value=1]:selected)').length;\n var passengers = parseInt($('#adults').val()) + parseInt($('#children').val()) - infants;\n if (passengers > 8) { warning('Sorry, your party includes more than eight guests.', 'Unfortunately to accommodate your whole party you\\'ll need to book multiple rooms. You can do this by making separate reservations for each room, or call our Disney Experts freephone on ' + phone + '* for help with your enquiry.'); GA.sendEvent('Alert', 'Search', 'Occupancy: 9+ Guests'); return false; }\n // Maximum of 1 infant online\n if (infants > 1) { warning('Sorry, your party includes more than 1 infant.', 'Unfortunately we\\'re unable to book your holiday online. Please call our Disney Experts freephone on ' + phone + '* for help with your enquiry.'); GA.sendEvent('Alert', 'Search', 'Occupancy: 2+ Infants'); return false; }\n // Check if arrival date is eligble for the current offer\n journey = offerEligible(outbound, inbound);\n // If hotel is available then check duration requirements for selected option\n if (journey) { journey = duration(type, nights); }\n // Is journey okay?\n if (!journey) { return false; };\n // If valid journey then show intermission\n intermission();\n // Pause carousel\n // billboard.slick('slickPause');\n }\n // Post form\n return true;\n}\n\n// Set button content\nfunction button(type) {\n var label\n switch (type) {\n case 'flights': label = 'Search Packages'; break;\n case 'package': case 'hotel': label = 'Search Packages'; break;\n case 'tickets': label = 'Buy Tickets'; break;\n }\n $('#quick-quote input.button').val(label);\n}\n\n// Return hotel category based on code\nfunction category(code) {\n switch (code) {\n case 'ALL': return 'All Hotels'; break;\n case 'VAL': return 'Value Hotels'; break;\n case 'MOD': return 'Moderate Hotels'; break;\n case 'DLX': return 'Deluxe Hotels'; break;\n case 'HAH': return 'Deluxe Villas'; break;\n case 'SWD': return 'Other Hotels'; break;\n case 'GNB': return 'Local Hotels'; break;\n case 'RHV': return 'Orlando Villas'; break;\n case 'VER': return 'Beach Hotels'; break;\n }\n}\n\n// Show/hide accessible rooms checkbox\nfunction accessible(type) {\n // Get checkbox\n var accessible = $('.accessible');\n // Suppress for tickets option\n if (type == 'tickets') { accessible.addClass('hide'); } else { accessible.removeClass('hide'); }\n}\n\n// -------------------------------------------------------------------------------------------------------------------\n\n// On ready\n$(document).ready(function () {\n\n // Catch form post\n $('#form').submit(function (event) {\n // Prevent DOM from unloading before we have fired the tracking code\n event.preventDefault();\n // Get transport method\n var type = $('input:radio:checked').val().toLowerCase();\n // Valid dates?\n if (valid(type)) {\n doSearch()\n }\n });\n\n});\n\nfunction doSearch() {\n // Get transport method\n var type = $('input:radio:checked').val().toLowerCase();\n\n form = $('#form').get(0);\n var query;\n var pageview;\n var analytics;\n // Set delay; default equals 2 seconds after image has loaded\n delay = 2000;\n // Submission varies by type\n switch (type) {\n case 'flights': query = 'Flights + Hotel + Ticket'; pageview = 'flights'; analytics = 'QQUKContFlight_Link'; delay = 500; break; // Override for flight inclusive\n case 'package': query = 'Hotel + Ticket'; pageview = 'hotel-ticket'; analytics = 'QQUKContPackage_Link'; break;\n case 'hotel': query = 'Hotel Only'; pageview = 'hotel'; analytics = 'QQUKContRoomOnly_Link'; break;\n case 'tickets': query = 'Ticket Only'; pageview = 'tickets'; analytics = 'QQUKContTicketOnly_Link'; delay = 250; break;\n }\n // Capture search data and log in Google Analytics\n searches(type, query, brand, null)\n // Add _trackEvent to the _gaq\n GA.sendEvent('Book', 'Search (Packages)', query);\n // Add virtual pageview to enable funnel reporting\n _gaq.push(['_trackPageview', '/walt-disney-world/book/search/' + pageview + '/']);\n // Add link tracking to Adobe Analytics call\n // s_wdpro.trackClick({},analytics);\n // Add _linkByPost to the _gaq to track cross-domain searches; appends querystring variables to form action\n GA.linkByPost(form);\n // Add the call to the _gaq queue; delay form submission to allow _trackEvent to complete and interstitial to load\n submitForm();\n}"],"names":["agent","$","attr","offerEligible","outbound","inbound","offerType","exclusionStr","showPrelaunchSearchWarningModal","warningOfferPrelaunchModal","exclusionWindows","length","dateIsExcluded","warningOfferModal","getTime","arrivalWindowStart","arrivalWindowEnd","departureWindowEnd","exclusionWindowStart","exclusionWindowEnd","noExclusion","moment","format","warning","GA","sendEvent","duration","type","nights","minduration","phone","valid","monthyear","val","year","parseInt","split","month","day","Date","toDateString","minimum","minimumdays","submit","infants","journey","intermission","button","label","category","code","accessible","addClass","removeClass","doSearch","query","pageview","toLowerCase","form","get","delay","analytics","searches","brand","_gaq","push","linkByPost","submitForm","document","ready","event","preventDefault"],"mappings":"AAQA,IAAIA,MAAyC,QAAhCC,EAAE,MAAM,EAAEC,KAAK,YAAY,EAGxC,SAASC,cAAcC,EAAUC,GAC7B,IAKIC,EA6BIC,EAlCR,MAA+C,aAA3C,OAAOC,iCAAmDA,iCAC1DC,2B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