{"version":3,"file":"search-2.0.7.min.js","sources":["cogs/js/search-2.0.7.min.js"],"sourcesContent":["// Common functions for Walt Disney World and Disneyland Paris searches; v2.0.0\n// Author: Tom Nelson, December 2015\n\n// -------------------------------------------------------------------------------------------------------------------\n\n// Quick quote panel; homepage only\n\n// Reset all option when #ages panel is closed\nfunction reset() {\n $('.ages > span').addClass('hide').hide(); $('#ages select').attr('disabled', 'disabled');\n}\n\n// Control display of child age select menus\n// Updated to manage behaviour by framework (desktop/mobile)\nfunction children() {\n // Count child pax\n var childpax = $('#children').val();\n\n // Drop menu updated to show that at least one child is travelling\n if (childpax > 0) {\n // Different behaviours for desktop/mobile\n if (desktop) {\n $('#ages').slideDown(function() {\n $(this).removeClass('hide');\n });\n } else if (mobile) {\n $('#ages').removeClass('hide');\n }\n\n var transitionTime = $('#ages').is(':hidden') ? 0 : 500;\n\n // Loop through spans and fade in/out\n $('.ages > span').each(function(index) {\n if (index < childpax) {\n $(this).find('select').removeAttr('disabled');\n $(this).fadeIn(transitionTime, function() {\n $(this).removeClass('hide');\n });\n } else {\n $(this).fadeOut(transitionTime, function() {\n $(this).find('select').attr('disabled','disabled');\n $(this).addClass('hide');\n });\n }\n });\n } else {\n if (desktop) {\n $('#ages').slideUp(function() {\n $(this).addClass('hide'); reset();\n })\n } else if (mobile) {\n $('#ages').addClass('hide'); reset();\n }\n }\n if ($('#ages').attr('data-age-validation') == 'error') {\n if (mobile) {\n $([document.documentElement, document.body]).animate({\n scrollTop: $(\"#ages\").offset().top\n }, 500);\n }\n }\n}\n\n// Hide and show menus based on holiday type\nfunction holiday() {\n// Check holiday type\n var type = $('input:radio:checked').val().toLowerCase();\n// Show relevant menus for transport option, and update button label\n transport(type); button(type);\n}\n\n// Set menus for transport option\nfunction transport(type) {\n var visible = $('div.search > .options:visible').attr('id'); // Hide currently visible, unless type has not changed\n// Initially all options on the mobile QQ are visually hidden\n if (!visible && mobile) { var visible = $('div.search > .options:not(.hide)').attr('id'); }\n// Fade out/in correct panel (desktop)\n var hide = $('#' + visible)\n var show = $('#' + type + '-options')\n// Don't run until page has rendered\n if (visible.indexOf(type) != 0) {\n// Desktop\n if (desktop) { hide.fadeOut(function() { hide.addClass('hide'); show.fadeIn(function() { show.removeClass('hide'); }); }); }\n// Mobile\n if (mobile) {\n hide.addClass('hide');\n show.removeClass('hide');\n// WDW only\n if (brand == 'wdw') { accessible(type); }\n }\n }\n}\n\n// Set #day drop menu based on month/year selected\nfunction days() {\n// Built array and load days in the month\n var monthlength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);\n// Get data\n var monthyear = $('#month').val();\n var year = parseInt(monthyear.split('^')[1]);\n var month = parseInt(monthyear.split('^')[0]);\n// Correct for leap year\n if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { monthlength[1] = 29; }\n// Update #day menu\n selectmenu(monthlength[month - 1]);\n calendar();\n}\n\n// Set length of numeric select menu\nfunction selectmenu(length) {\n var object = $('#day')\n var option = $('#day option')\n// Read last option value on menu\n var size = parseInt($('#day option:last').val());\n// Set selected option to new length\n if (length < object.val()) { object.val(length).attr('selected',true); }\n// Add days\n if (size < length) { for (var i = size + 1; i <= length; i++) { $('