var mapLoaded = false; $(function() { loadDynamicAdzerkBanners(); $.fn.disableSelection = function() { return this .attr('unselectable', 'on') .css('user-select', 'none') .on('selectstart', false); }; if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt) { var len = this.length >>> 0; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } if (typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }; } if ($.browser && $.browser.msie) { $('input:radio, input:checkbox').click(function() { this.blur(); this.focus(); }); } // event price point selection $('#event_order_form .add_to_cart').prop("onclick", null).attr("onclick", null); $('#event_order_form .add_to_cart').on('click', function(e) { if (!$(this).hasClass('disabled')) { var total_tickets = 0; e.preventDefault(); $('.styled-select select').each(function(i, item) { var el = $(item); //if (el instanceof jQuery) { var val = parseInt(el.find('option:selected').val(), 10); total_tickets += val; //} }); if (total_tickets > 0) { $('#please_wait').show(); $('#event_order_form').submit(); } else { firstalert('Please select the number of tickets you would like to purchase.'); } } }); $('.cart-count').click(function() { window.location = url('packages.php?sub=packages&action=viewcart'); }); // Pinch-to-Zoom functionality /*if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) { var viewportmeta = document.querySelector('meta[name="viewport"]'); if (viewportmeta) { viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0'; document.body.addEventListener('gesturestart', function() { viewportmeta.content = 'width=device-width, minimum-scale=0.25, maximum-scale=1.6'; }, false); } }*/ $('.calendar').datepicker({ "dateFormat": 'mm/dd/y', beforeShow: function(el, inst) { var min_date = $(this).attr('data-min-date'); if (min_date && min_date.length > 0) { $(this).datepicker('option', 'minDate', min_date); } }, onClose: function(selectedDate, inst) { if (inst.id == 'check_in' || inst.id == 'check_out') { var minDate = new Date($('#check_in').val()); var curentCheckout = new Date($('#check_out').val()); if( minDate.getTime() > curentCheckout.getTime() ){ var tempDate = new Date(minDate.getTime()); tempDate.setDate(minDate.getDate() + 3); $("#check_out").datepicker('setDate', tempDate); } minDate.setDate(minDate.getDate() + 1); $("#check_out").datepicker('option', 'minDate', minDate); } } }); $('.tabs td').disableSelection(); $('.tabs td').click(function(e) { $('.with-triangles td.selected').each(function() { var width = $(this).css('width'); $(this).find('span').css('border-width', '12px ' + width + 'px 0 ' + width + 'px'); }); var el = $(this); var tab_container = $('#' + el.attr('data-tab')); if (tab_container.length && !tab_container.is(':visible')) { $('.tabs td').removeClass('selected'); el.addClass('selected'); $('.tab_content>div:visible').slideUp('fast', function() { $(tab_container.slideDown('fast', function() { var src = $('#video_tab_code').attr('src'); if ((el.attr('data-content') == 'video') && (typeof src == 'undefined' || !src || src.length <= 0)) { $('#video_tab_code').attr('src', 'packages.php?sub=' + el.attr('data-type') + '&action=video_iframe&id=' + el.attr('data-id')); } if (el.attr('data-content') == 'map') { if (!mapLoaded) { generateMap(el.attr('data-lat'), el.attr('data-lng'), el.attr('data-venue-name'), el.attr('data-address')); } } })); }); } }); //$("#market").chosen(); $('.countries').change(function() { link_provinces($(this)); }); $('.countries').each(function() { link_provinces($(this)); }); $('.popup').click(function() { var popup_text = $(this).attr('data-popup-text'); var popup_header = $(this).attr('data-popup-header'); if (popup_text && popup_text.length > 0) { var $popup = $('
').dialog({ autoOpen: true, title: popup_header, width: 630, height: 450, resizable: false, modal: true, closeOnEscape: true, open: function() { $('.ui-widget-overlay').bind('click', function() { $popup.dialog('close'); }); }, close: function(event, ui) { $(this).remove(); $popup = null; } }); $popup.html(popup_text); $popup.show().dialog('open'); } }); $('.iframepopup').click(function(e) { e.preventDefault(); var popup_header = $(this).attr('data-popup-header'); var $popup = $('