function initGMap(){if($("#mapPoints").length!==0){var t=$("#mapPoints .item"),i={center:new google.maps.LatLng(parseFloat(t.eq(0).data("lat")),parseFloat(t.eq(0).data("lng"))),zoom:18,disableDefaultUI:!0,draggable:!1,scrollwheel:!1,scaleControl:!1,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,"myStyle"]}},r=new google.maps.StyledMapType([{stylers:[{saturation:-100}]}],{name:"Styled Map"}),n=new google.maps.Map(document.getElementById("mapCanvas"),i);console.log(n);n.mapTypes.set("myStyle",r);n.setMapTypeId("myStyle");window.mm=[];t.each(function(t,i){var r=new google.maps.Marker({position:new google.maps.LatLng(parseFloat($(i).data("lat")),parseFloat($(i).data("lng"))),map:n,draggable:!1,animation:google.maps.Animation.DROP,icon:{url:"/static/images/map-marker.png",size:new google.maps.Size(41,46)},shadow:{url:"/static/images/map-marker-shadow.png",size:new google.maps.Size(46,28),anchor:new google.maps.Point(7,24)}});mm.push(r)});$(".contact .tabs .links a").click(function(t){var r,i,u;t.preventDefault();r=$(this).attr("href").replace("#","");$(".contact .tabs .links .active").removeClass("active");$(".contact .tabs .items .active").removeClass("active");$(this).addClass("active");$('.contact .tabs .items .item[data-tab="'+r+'"]').addClass("active");i=$('.contact .tabs .items .item[data-tab="'+r+'"]');u=new google.maps.LatLng(parseFloat(i.data("lat")),parseFloat(i.data("lng")));n.setCenter(u);$("#mapControls a").attr("href",i.data("link"))})}}function EventList(n){this.options={containerSelector:"#list",itemSelector:".item",chapterSelector:".chapter",chapterTemplateSelector:"#chapterTemplate",chaptersCount:0,currentChapter:1,filterContainerSelector:"#filter",filterQuerySelector:".query",filterQueryDelay:300,filterQuerySubmitSelector:".query",filterCitySelector:"select.city",filterTermSelector:"select.term",filterGenreSelector:"select.genre",filterExpandSelector:".expand",emptyContainerSelector:"#listEmpty",nextButtonSelector:"#listNext"};$.extend(this.options,n);this.init(n)}var $window=$(window),$document=$(document),$wrapper=$("#wrapper"),$content=$(".content"),menuTouchMove=!1;Array.prototype.indexOf||(Array.prototype.indexOf=function(n,t){for(var i=t||0,r=this.length;i<r;i++)if(this[i]===n)return i;return-1});$.site=$.site||function(){var n,t,i;return $("body").removeClass("no-js"),$("body").addClass("js"),n=$("#bigSearch"),n.length>0&&(t=n.attr("placeholder"),i=n.attr("placeholder").substring(0,16)),{init:function(){var t,i,n,r,f;document.addEventListener("touchstart",function(){},!0);t=new OtherInfo($(".detail .intro .priceInfo .otherInfo"),{parts:".part",switchWidthLimit:tabletScreenPoint,onSwitchTo:function(n){new Tooltip(n,{mobileWidthLimit:tabletScreenPoint})}});i=new Tooltip($(".tooltip"),{mobileWidthLimit:tabletScreenPoint});$("li.user").on("click",function(){var n=$(this);$(this).toggleClass("active");$(this).hasClass("active")||$(this).css("bottom","auto");setTimeout(function(){},150)});$("body").delegate('a[href^="#"]',"click",function(n){n.preventDefault();var t=this.hash,i=$(t);i.length&&smsticket.layout.scrollTo(i,function(){window.location.hash=t})});n=$(".promoActions");n.length>0&&(r=new SwipeList({parent:n,iScrollContainer:n.find(".items"),items:n.find(".item"),initSlideNav:!0,tabletScreenPoint:tabletScreenPoint,autoSlide:!0}));var u=new SwipeList({parent:$(".mediaComponentContainer").find("#thumbScroller"),iScrollContainer:$(".mediaComponentContainer").find(".thumbs"),items:$(".mediaComponentContainer").find(".thumb"),setOverflowAfterDestroy:!0,horizontalSlider:!0,tabletScreenPoint:tabletScreenPoint}),e=new TextExpander($(".textExpander")),o=new ticketFormatChanger($(".changeTicketFormat"),{tabletScreenPoint:tabletScreenPoint,desktopScreenPoint:desktopScreenPoint});this.onResize();$(".showLoginForm").on("click",function(){var n=$(this),t=$(".loginForm");n.toggleClass("active");n.hasClass("active")?t.show():t.hide()});$(".menuTrigger").on("click",function(){var n=$(this);n.parent().toggleClass("opened")});$('input[type="checkbox"], input[type="radio"]').checkBox();$(".show-pass").on("change",function(){var n=$(this).parents(".formRow").find("input.mutable"),t=n.val();n.attr("type")==="password"?(n.clone().attr("type","text").val(t).insertAfter(n.parents(".formRow").find("input.mutable")),n.parents(".formRow").find('input[type="password"]').remove()):(n.clone().attr("type","password").val(t).insertAfter(n.parents(".formRow").find("input.mutable")),n.parents(".formRow").find('input[type="text"]').remove())});$("body").delegate(".notification .closeButton","click",function(n){n.preventDefault();$(this).closest(".notification").remove()});f=new MediaComponent($(".mediaComponentContainer"),u);$("body").delegate("#dialogOverlay, #dialog .closeButton, #dialog .close, #dialog .cancel","click",function(n){n.preventDefault();$("#dialog").trigger("dialog:close").remove()});$(".purchase.step2 .mobileOnly a").on("click",function(n){n.preventDefault();var t=0;$("#loginDuringBuy").children().each(function(n,i){t+=$(i).outerHeight();t+=parseInt($(i).css("margin-top"));t+=parseInt($(i).css("margin-bottom"))});$("#loginDuringBuy").height(t)});$(".cancelLogin").on("click",function(n){n.preventDefault();$("#loginDuringBuy").height(0)})},toggleMenu:function(){if($(".offCanvas").toggleClass("active"),$(".offCanvas").hasClass("active")){var n=0;$(".offCanvas li").each(function(t,i){n+=$(i).outerHeight()});n+=$(".offCanvas .loginForm").outerHeight();$(".offCanvas").css("height",n)}else $(".offCanvas").css("height",0)},onResize:function(){$(".content").resize(function(){});$window.resize(function(){if($wrapper.css("height","auto"),$wrapper.height()<$window.height()&&$wrapper.css("height",$window.height()),$window.width()<tabletScreenPoint?n.length>0&&n.attr("placeholder",i):n.attr("placeholder",t),$window.width()<tabletScreenPoint){$(".detail").off("click",".event");$(".detail").on("click",".event",function(){window.location.href=$(this).find(".smallButton").attr("href")});$(".profile .ticket .mainInfo").off("click");$(".profile .ticket .mainInfo").on("click",function(){window.location.href=$(this).find(".text a").attr("href")});$(".profile .ticket .actions .smallButton").each(function(n,t){$(t).data("text-mobile")!==undefined&&$(t).text($(t).data("text-mobile"))})}else{$(".payStyle").eq(0).show();$(".payStyle").eq(1).hide();$(".detail").off("click",".ticket");$(".profile .ticket .mainInfo").off("click");$(".profile .ticket .actions .smallButton").each(function(n,t){$(t).data("text-standard")!==undefined&&$(t).text($(t).data("text-standard"))});var r=$(document).outerHeight()-$("#header").outerHeight()-$("#footer").outerHeight();$(".purchase.step1.map .column").outerHeight()<$(".content").height()}}).trigger("resize")}}}();$(document).ready(function(){$.site.init()});EventList.prototype.init=function(n){this.cacheElements();this.currentChapter=n.currentChapter;this.chapterTemplate=Handlebars.compile($(this.options.chapterTemplateSelector).html());this.chaptersCount=this.options.chaptersCount;this.bindEvents();this.redraw()};EventList.prototype.cacheElements=function(){this.$filterContainer=$(this.options.filterContainerSelector);this.$filterQuery=$(this.options.filterQuerySelector,this.$filterContainer);this.$filterCity=$(this.options.filterCitySelector,this.$filterContainer);this.$filterTerm=$(this.options.filterTermSelector,this.$filterContainer);this.$filterGenre=$(this.options.filterGenreSelector,this.$filterContainer);this.$filterExpand=$(this.options.filterExpandSelector,this.$filterContainer);this.$listContainer=$(this.options.containerSelector);this.$listEmpty=$(this.options.emptyContainerSelector);this.$nextButton=$(this.options.nextButtonSelector)};EventList.prototype.bindEvents=function(){var n=$.proxy(this.onFilterChanged,this);this.$filterTerm.on("change",n);this.$filterCity.on("change",n);this.$filterGenre.on("change",n);this.$filterExpand.on("click",$.proxy(this.onFilterToggled,this));this.$filterQuery.on("keyup",$.proxy(this.onFilterQueryChanged,this));this.$nextButton.on("click",$.proxy(this.onNextButtonClicked,this))};EventList.prototype.unbindEvents=function(){this.$filterTerm.off("change");this.$filterCity.off("change");this.$filterGenre.off("change");this.$filterExpand.off("click");this.$filterQuery.off("keyup");this.$nextButton.off("keyup")};EventList.prototype.addPage=function(){var t=this._getLastChapter(),n;this._chapterIsVisible(t)?this.currentChapter+1<=this.chaptersCount&&this.loadChapter(this.currentChapter+1):(n=t.attr("data-page")||1,n++,t.attr("data-page",n).addClass("page"+n),this.redraw(),this.updateState())};EventList.prototype.addChapter=function(n){var t=this.chapterTemplate(n);this.currentChapter=n.currentChapter;this.chaptersCount=n.chaptersCount;var r=$.map($(this.options.itemSelector,this.$listContainer),function(n){return $(n).data("id")}),u=$.map(n.items,function(n){return n.id}),i=this.currentChapter==1?"html":"append";this.$listContainer[i](t);this.redraw();this.updateState()};EventList.prototype.loadChapter=function(n){var t,i;this.xhr&&this.xhr.readyState!=4&&this.xhr.abort();t={chapter:n,query:this.$filterQuery.val()};this._filterIsActive()&&$.extend(t,{term:this.$filterTerm.val(),city:this.$filterCity.val(),genre:this.$filterGenre.val()});i=this;$.jsonAjax({beforeSend:function(n){i.xhr=n},handleError:function(n,t,i){i.statusText!="abort"&&smsticket.layout.notify(n,"error")},url:this.options.ajaxUrl,data:t,loaderEnabled:!1,cache:!1,type:"GET"}).done(function(n){i.addChapter(n)})};EventList.prototype.redraw=function(){var n=this.currentChapter>=this.chaptersCount&&this._chapterIsVisible(this._getLastChapter())||this.chaptersCount===0;this.$nextButton.toggle(!n);$(window).off("unveil");this.$listContainer.find("img.delayed:not(.unveiled)").unveil(200,function(){$(this).addClass("unveiled")});this.chaptersCount==0?(this.$listContainer.empty(),this.$listEmpty.show()):this.$listEmpty.hide()};EventList.prototype.onFilterToggled=function(){var n=!!this.$filterTerm.val()||!!this.$filterCity.val()||!!this.$filterGenre.val();this._filterIsActive()&&(this.$filterTerm.val("").selectmenu(),this.$filterCity.val("").selectmenu(),this.$filterGenre.val("").selectmenu());n&&this.loadChapter(1)};EventList.prototype.onFilterChanged=function(){this.loadChapter(1)};EventList.prototype.onFilterQueryChanged=function(n){var t=$.ui.keyCode,r=n.keyCode==t.ENTER||n.keyCode==t.SPACE||!$(this).val.length,i;this.filterQueryDelayTimer&&clearTimeout(this.filterQueryDelayTimer);this.filterQueryDelayTimer=null;r?this.onFilterChanged():(i=this,this.filterQueryDelayTimer=setTimeout(function(){i.onFilterChanged()},this.options.filterQueryDelay))};EventList.prototype.onNextButtonClicked=function(){this.addPage()};EventList.prototype.onNextButtonClicked=function(){this.addPage()};EventList.prototype.updateState=function(){var n,t,i;Modernizr.history&&(n={},this.currentChapter>1&&(n.chapter=this.currentChapter),t=this._getLastChapter().attr("data-page"),t>1&&(n.page=t),!this.$filterTerm.val()||(n.term=this.$filterTerm.val()),!this.$filterQuery.val()||(n.query=this.$filterQuery.val()),!this.$filterCity.val()||(n.city=this.$filterCity.val()),!this.$filterGenre.val()||(n.genre=this.$filterGenre.val()),i=location.pathname,$.isEmptyObject(n)||(i+="?"+$.param(n)),console.log($.isEmptyObject(n)),console.log(n),history.pushState(null,"",i))};EventList.prototype._filterIsActive=function(){return this.$filterExpand.is(".expanded")};EventList.prototype._getLastChapter=function(){return $(this.options.chapterSelector,this.$listContainer).last()};EventList.prototype._chapterIsVisible=function(n){return!n.find(this.options.itemSelector).filter(":hidden").length};window.Step1Map=function(){"use strict";var n=function(n,t,i,r,u){this.mapDefinitionUrl=n;this.eventStatusUrl=t;this.options=i;this.maxTickets=r;this.areaPrices=u;this.$form=$("#step1SelectionForm");this.$tickets=$("#tickets");this.$mobileTicketsExpander=$("#mobileTicketsExpander");this.$continueButton=$("#continueButton");this.$planeSwitch=$("#planeSwitch");smsticket.layout.setShowLoaderTimeout();$.ajax(n,{loaderEnabled:!1}).done($.proxy(this.onMapDefinitionLoaded,this))};return n.prototype.createTicketSelector=function(n){var t={ticketsHolderSelector:".selectedTickets",summaryHolderSelector:".sum",summaryPriceSelector:".price",maxTickets:this.maxTickets},i={ticketRowSelector:".ticket",ticketRowTemplateSelector:"#ticketRowTemplate",priceLevelSelector:"select.priceLevel",priceSelector:".price",promoCodeSelector:".promoCode input",discountSelector:".discount",removeSelector:".closeButton",priceLevelSelectOptionFormat:function(n){return'<span class="left">'+n.text()+'<\/span><span class="right">'+n.data("price-with-symbol")+"<\/span>"}};this.ticketSelector=new TicketSelector(n,t,i)},n.prototype.createSeatsMap=function(n,t){var i={onClick:$.proxy(this.onMapClick,this),tooltipText:$.proxy(this.tooltipText,this)};this.activePlane=n;this.seatsMap=new SeatsMap($("#seatsMap"),n,t,i)},n.prototype.bindEvents=function(){this.$form.on("submit",$.proxy(this.onSubmit,this));$(this.ticketSelector).on("remove",$.proxy(this.onTicketRemoved,this));$(this.ticketSelector).on("area:change",$.proxy(this.onAreaStatusChanged,this));this.$planeSwitch.find("a").on("click",$.proxy(this.onPlaneSwitchClick,this))},n.prototype.updateControls=function(){var n=this.ticketSelector.isEmpty(),t,i;this.$tickets.toggle(!n);this.$mobileTicketsExpander.toggleClass("visible",!n);this.$continueButton.toggleClass("inactive",n).prop("disabled",n);t=this.$tickets.find(".selectedTickets");t.hasClass("expanded")&&(i=0,t.find(".ticket").each(function(){i+=this.scrollHeight}),t.css("height",i))},n.prototype.setStatus=function(n,t){for(var r,i,u,e,o,s=this.activePlane,h=t.areas,f=0;f<n.length;f++)if(r=n[f],i=h[r],i.seats||(this.seatsMap.setAreaStatus(r,i.status),i.status===MapHelper.STATUS_AVAILABLE&&this.mapDefinition.showTicketCounts&&this.setAreaTooltip(r,function(){return s.regions["a"+r].name+" ("+i.ticketsAvailable+"/"+i.ticketsSeed+")"})),u=i.seats,u)for(e in u)o=u[e],o!==MapHelper.STATUS_AVAILABLE&&this.seatsMap.setSeatStatus(e,o)},n.prototype.setAreaStatus=function(n,t){this.seatsMap.setAreaStatus(n,t)},n.prototype.setAreaTooltip=function(n,t){this.seatsMap.setFullname("a"+n,t)},n.prototype.setSeatStatus=function(n,t,i){this.eventStatus.areas[n].seats[t]=i;this.activePlane.regions["s"+t]&&this.seatsMap.setSeatStatus(t,i)},n.prototype.switchPlane=function(n){smsticket.layout.showLoader();this.seatsMap.destroy();var t=this.mapDefinition.planes[n];this.activatePlaneSwitch(n);this.createSeatsMap(t,this.mapDefinition.statuses);this.setStatus(t.areaIds,this.eventStatus);smsticket.layout.hideLoader()},n.prototype.activatePlaneSwitch=function(n){this.$planeSwitch.find("li").removeClass("active");this.$planeSwitch.find("#planeSwitch"+n).addClass("active")},n.prototype.onMapDefinitionLoaded=function(n){this.mapDefinition=n;$.ajax(this.eventStatusUrl,{loaderEnabled:!1}).done($.proxy(this.onEventStatusLoaded,this))},n.prototype.onEventStatusLoaded=function(n){var t=this.mapDefinition,i;this.eventStatus=n;i=t.planes[t.initialPlaneId];this.activatePlaneSwitch(t.initialPlaneId);this.createSeatsMap(i,t.statuses);this.createTicketSelector(n);this.ticketSelector.loadPrerenderedTickets();this.setStatus(this.activePlane.areaIds,n);this.bindEvents();smsticket.layout.hideLoaderAndClearTimeout()},n.prototype.onPlaneSwitchClick=function(n){var t=$(n.target),i=t.data("id");this.switchPlane(i)},n.prototype.onMapClick=function(n){var t,i,r,u,f,e;if(console.log("click: "+n),t=this.activePlane.regions[n],MapHelper.isSeat(n)){if(r={regionId:n,areaId:t.areaId,fullname:t.fullname},i=t.areaId,u=MapHelper.idFromRegionId(n),f=this.eventStatus.areas[i].seats[u],f!==MapHelper.STATUS_AVAILABLE&&f!==MapHelper.STATUS_SELECTED)return;if(r.color=this.activePlane.regions["a"+i].color,console.log("remove "+n),this.ticketSelector.hasTicket(n))this.ticketSelector.removeFirstTicket(n),this.setSeatStatus(i,u,MapHelper.STATUS_AVAILABLE);else{if(this.ticketSelector.isFull()){smsticket.layout.notify(this.options.cannotReserveMoreTicketsNotice,"info");return}r.seatId=u;this.ticketSelector.addTicket(r);this.setSeatStatus(i,u,MapHelper.STATUS_SELECTED)}}else{if(this.ticketSelector.isFull()){smsticket.layout.notify(this.options.cannotReserveMoreTicketsNotice,"info");return}if(i=t.areaId,e=this.eventStatus.areas[i].status,e!==MapHelper.STATUS_AVAILABLE)return;r={regionId:n,areaId:t.areaId,fullname:t.name,color:t.color};this.ticketSelector.addTicket(r)}this.updateControls()},n.prototype.tooltipText=function(n,t,i){var e=this.eventStatus.areas[t],u,r,f;return u=i?e.seats[i]:e.status,r=n.fullname,f=this.areaPrices[t],f&&(r+="<br>"+f),u===MapHelper.STATUS_SELECTED?r+="<br>"+this.options.selectedSeatStatus:u===MapHelper.STATUS_SOLD&&(r+="<br>"+this.options.notAvailableSeatStatus),n.note&&(r+="<br><b>"+n.note+"<b>"),r},n.prototype.onTicketRemoved=function(n,t){var i=t.seatId,r=t.areaId;i&&this.setSeatStatus(r,i,MapHelper.STATUS_AVAILABLE);this.updateControls()},n.prototype.onAreaStatusChanged=function(n,t,i){this.setAreaStatus(t,i)},n.prototype.onSubmit=function(){this.$continueButton.prop("disabled",!0).addClass("inactive")},n}();window.Step1Selection=function(){"use strict";var n=function(n,t,i){this.areaId=n;this.eventStatus=t;this.maxTickets=i;this.$addButton=$("#addHolder > a");this.$form=$("#step1SelectionForm");this.$submitBtn=$("#step1SelectionBtn");this.createTicketSelector(t);this.ticketSelector.loadPrerenderedTickets();this.updateControls();this.bindEvents()};return n.prototype.createTicketSelector=function(){var n={ticketsHolderSelector:"#ticketsHolder",summaryHolderSelector:"#summaryHolder",summaryPriceSelector:"#summaryPrice",maxTickets:this.maxTickets};this.ticketSelector=new TicketSelector(this.eventStatus,n,{ticketRowSelector:".ticket",ticketRowTemplateSelector:"#ticketRowTemplate",priceKindSelector:"select.priceKind",priceLevelSelector:"select.priceLevel",priceSelector:".price",promoCodeSelector:".promoCode input",discountSelector:".discount",removeSelector:".closeButton"})},n.prototype.bindEvents=function(){this.$addButton.on("click",$.proxy(this.onAddButtonClick,this));this.$form.on("submit",$.proxy(this.onSubmit,this));$(this.ticketSelector).on("remove",$.proxy(this.onTicketRemoved,this))},n.prototype.updateControls=function(){this.$addButton.toggle(!this.ticketSelector.isFull())},n.prototype.onAddButtonClick=function(n){n.preventDefault();var t=parseInt(this.ticketSelector.$ticketsHolder.find(".ticket:last .priceKind").val());this.ticketSelector.addTicket({areaId:this.areaId,kindId:t});this.updateControls()},n.prototype.onTicketRemoved=function(){this.updateControls()},n.prototype.onSubmit=function(){this.$submitBtn.prop("disabled",!0).addClass("inactive")},n}();window.Step3=function(){"use strict";var t=function(n,t){return n.toCurrencyString()+" "+t},n=function(n){var t,i;if(this.options=n,this.requestInProgress=!1,this.promoCodeFormVisible=!1,this.setPaymentMethods(this.options.paymentMethods),this.$sendSmsTickets=$("#SendSmsTickets"),this.$sendSmsTicketsHiddens=$(".sendSmsTicketsHidden"),this.$paymentMethods=$("#paymentMethods"),this.$noPayment=$("#noPayment"),this.$paymentForms=this.$paymentMethods.find(".paymentMethodForm"),this.$paymentSubmitBtns=this.$paymentForms.find(".paymentMethodBtn"),this.options.enablePromoCode){if(this.$promoCodeSection=$("#promoCode"),this.$promoCodeFormHolder=$("#promoCodeFormHolder"),this.$promoCodeListHolder=$("#promoCodeListHolder"),this.promoCodeFormTemplate=Handlebars.compile($("#promoCodeFormTemplate").text()),t=this.options.promoCodes,t)for(this.promoCodesCount=t.length,i=0;i<t.length;i++)this.displayPromoCode(t[i]);else this.promoCodesCount=0;this.updateUI();this.renderPromoCodeForm()}this.bindEvents()};return n.prototype.bindEvents=function(){this.$sendSmsTickets.on("change",$.proxy(this.onSendSmsTicketsChange,this));this.$paymentForms.on("submit",$.proxy(this.disablePaymentSubmitBtns,this))},n.prototype.setPaymentMethods=function(n){for(var i=[],t=0;t<n.length;t++)i.push($.extend(!0,{},n[t]));this.paymentMethods=i},n.prototype.disablePaymentSubmitBtns=function(){this.$paymentSubmitBtns.prop("disabled",!0).addClass("inactive")},n.prototype.renderPromoCodeForm=function(){var n,t,i;this.$promoCodeFormHolder.html(this.promoCodeFormTemplate());n=this.$promoCodeFormHolder.find("form");$.validator.unobtrusive.parse(n);t=n.data("validator");i=t.settings;i.showErrors=function(t){var r=!0,i,u;for(i in t)u=t[i],n.find('[data-valmsg-for="'+i+'"]').text(u),r=!1;smsticket.layout.redrawErrors(n,r)};this.$promoCodeFormHolder.on("submit","form",$.proxy(this.onPromoCodeSubmit,this));this.promoCodeFormVisible=!0},n.prototype.updateUI=function(){this.options.allowMultiplePromoCodes||(this.promoCodesCount===0?this.$promoCodeSection.removeClass("list").addClass("form"):this.$promoCodeSection.removeClass("form").addClass("list"))},n.prototype.displayPromoCode=function(n){var i={translations:this.options.translations,currencySymbol:this.options.currencySymbol},t=new Step3PromoCode(n,i);this.$promoCodeListHolder.append(t.$el);t.render();$(t).on("removeRequest",$.proxy(this.onPromoCodeRemove,this))},n.prototype.updatePaymentMethods=function(n){var r,s,h;if(n){for(r=0;r<this.paymentMethods.length;r++){var u=this.paymentMethods[r],i=u.Prices,c=u.PaymentMethodId,f=this.$paymentForms.filter('[data-id="'+c+'"]'),l=f.parent();if(l.toggle(u.IsAllowed),u.IsAllowed){var a=f.find(".paymentMethodBtn"),e=f.find("p"),o=i.PriceWithVoucherApplied+i.BuyerHandlingFee.Total,v=t(o,this.options.currencySymbol);a.val(v);i.BuyerHandlingFee.Total===0&&i.AdditionalPayment===0?e.text(this.options.translations.paymentMethodNoHandlingFee):(s=f.data("price-info"),h=String.format(s,t(i.BuyerHandlingFee.Total,this.options.currencySymbol),t(i.AdditionalPayment,this.options.currencySymbol),o),e.text(h))}}this.$paymentMethods.show();this.$noPayment.hide()}else this.$paymentMethods.hide(),this.$noPayment.show()},n.prototype.updatePaymentMethodsWithSmsTickets=function(n){for(var t,r=!0,i=0;i<this.paymentMethods.length;i++)if(t=this.paymentMethods[i],this.options.prSmsPaymentMethodIds.indexOf(t.PaymentMethodId)===-1){var e=n?this.options.smsTicketsPrice:0,u=t.Prices.BasePrice-t.Prices.Discount+e,f=u-t.Prices.VoucherValue;f<=0?(t.Prices.Price=t.Prices.PriceWithVoucherApplied=0,r=!1):(t.Prices.Price=u,t.Prices.PriceWithVoucherApplied=f)}return r},n.prototype.updateAfterPromoCodeAction=function(n){this.updateUI();this.setPaymentMethods(n.paymentMethodsPrices);var t=n.requiresPayment;this.$sendSmsTickets.is(":checked")&&(t=this.updatePaymentMethodsWithSmsTickets(!0));this.updatePaymentMethods(t)},n.prototype.toggleButton=function(n,t){t?n.prop("disabled",!1).removeClass("inactive"):n.prop("disabled",!0).addClass("inactive")},n.prototype.onSendSmsTicketsChange=function(n){n.preventDefault();var i=$(n.target),t=i.is(":checked"),r=this.updatePaymentMethodsWithSmsTickets(t);this.updatePaymentMethods(r);this.$sendSmsTicketsHiddens.val(t)},n.prototype.onPromoCodeSubmit=function(n){var f,e,t,u;if(n.preventDefault(),this.requestInProgress)return console.log("request already in progress"),!1;var i=this.$promoCodeFormHolder.find("form"),r=i.find("#Code"),o=r.val().trim();return i.valid()?(f={Code:o},e={type:"POST",url:this.options.addPromoCodeUrl,contentType:"application/json",dataType:"json",data:JSON.stringify(f)},smsticket.layout.redrawErrors(this.$promoCodeForm,!0),t=this,u=i.find('input[type="submit"]'),this.toggleButton(u,!1),this.requestInProgress=!0,$.ajax(e).done(function(n){var f,e;if(t.requestInProgress=!1,n.statusCode===200)r.val(""),t.promoCodesCount+=1,t.displayPromoCode(n.promoCode),t.updateAfterPromoCodeAction(n);else if(n.statusCode===302)window.location=n.location;else if(n.statusCode===400&&(f=n.errors,f)){for(e in f)i.find('[data-valmsg-for="'+e+'"]').text(f[e][0]);smsticket.layout.redrawErrors(i,!1)}r.focus();t.toggleButton(u,!0)}),!1):!1},n.prototype.onPromoCodeRemove=function(n,t,i){if(this.requestInProgress){console.log("request already in progress");return}var u={Code:i},f={type:"POST",url:this.options.removePromoCodeUrl,contentType:"application/json",dataType:"json",data:JSON.stringify(u)},r=this;this.requestInProgress=!0;$.ajax(f).done(function(n){r.requestInProgress=!1;n.statusCode===200?(r.promoCodesCount-=1,r.updateAfterPromoCodeAction(n),t.remove(),$(t).off()):n.statusCode===302&&(window.location=n.location)})},n}();window.Step3PromoCode=function(){"use strict";var f=0,e=1,t=0,i=1,r=0,u=1,n=function(n,t){this.model=n;this.options=$.extend({},t);this.promoCodeDescriptionTemplate=Handlebars.compile($("#promoCodeDescriptionTemplate").text());this.$el=$('<div class="promoCodeItem"><\/div>')};return n.prototype.render=function(){var o,n=this.model;if(n.type===f)if(n.discountTarget===t&&n.discountType===r)o=String.format(this.options.translations.discountDescriptionTicketAmount,n.discountName,n.discountValue.toCurrencyString(),this.options.currencySymbol);else if(n.discountTarget===t&&n.discountType===u)o=String.format(this.options.translations.discountDescriptionTicketPerc,n.discountName,n.discountValue,n.discount.toCurrencyString(),this.options.currencySymbol);else if(n.discountTarget===i&&n.discountType===u)o=String.format(this.options.translations.discountDescriptionPurchasePerc,n.discountName,n.discountValue.toCurrencyString(),n.discount.toCurrencyString(),this.options.currencySymbol);else throw"Invalid combination of discount target and type for discount";else if(n.type===e)if(n.discountTarget===i&&n.discountType==r)o=String.format(this.options.translations.voucherDescriptionPurchaseAmount,n.discountName,n.discountValue,n.discount.toCurrencyString(),this.options.currencySymbol);else throw"Invalid combination of discount target and type for voucher";else throw"Invalid promo code type";this.$el.html(this.promoCodeDescriptionTemplate({codeDescription:String.format(this.options.translations.promoCodeDescription,n.code),discountDescription:o}));this.bindEvents()},n.prototype.bindEvents=function(){this.$el.on("click",".closeButton",$.proxy(this.onRemoveClick,this))},n.prototype.remove=function(){this.$el.off();this.$el.remove()},n.prototype.onRemoveClick=function(n){n.preventDefault();$(this).trigger("removeRequest",[this,this.model.code])},n}();window.TicketSelector=function(){"use strict";function n(n,t,i){this.eventStatus=n;this.options={maxTickets:10,ticketsHolderSelector:"#ticketsHolder",summaryHolderSelector:"#summaryHolder",summaryPriceSelector:"#summaryPrice"};this.ticketOptions={ticketRowSelector:".ticket",ticketRowTemplateSelector:"#ticketRowTemplate",priceKindSelector:"select.priceKind",priceLevelSelector:"select.priceLevel",priceSelector:".price",promoCodeSelector:".promoCode input",discountSelector:".discount",removeSelector:".closeButton",priceLevelSelectOptionFormat:null};$.extend(this.options,t);$.extend(this.ticketOptions,i);this.initialize()}function t(n,t,i){this.template=t;this.options=n;this.attributes=i}return n.prototype.initialize=function(){this.tickets=[];this.$ticketsHolder=$(this.options.ticketsHolderSelector);this.$summaryHolder=$(this.options.summaryHolderSelector);this.$summaryPrice=$(this.options.summaryPriceSelector);this.ticketIdx=0;this.ticketRowTemplate=Handlebars.compile($(this.ticketOptions.ticketRowTemplateSelector).html());this.bindEvents()},n.prototype.bindEvents=function(){},n.prototype.unbindEvents=function(){},n.prototype.addTicket=function(n,i){var u=n.areaId,e=this.eventStatus.areas,f,r,o;if(typeof i=="undefined"&&(this.isFull()||e[u].ticketsAvailable===0))return!1;n.Index=this.ticketIdx;f=$.extend({},this.ticketOptions);i&&(f.$el=i);r=new t(f,this.ticketRowTemplate,n).render(this.$ticketsHolder);$(r).on("change",$.proxy(this.computePrice,this));$(r).on("remove",$.proxy(this.onTicketRemove,this));return this.tickets.push(r),this.ticketIdx++,i||(o=--e[u].ticketsAvailable,typeof n.seatId=="undefined"&&o===0&&$(this).trigger("area:change",[u,MapHelper.STATUS_SOLD])),this.computePrice(),!0},n.prototype.removeTicket=function(n){var i=this.tickets.indexOf(n);this.tickets.splice(i,1);var t=n.attributes.areaId,r=this.eventStatus.areas,u=++r[t].ticketsAvailable;typeof n.attributes.seatId=="undefined"&&u===1&&$(this).trigger("area:change",[t,MapHelper.STATUS_AVAILABLE]);this.computePrice();$(this).trigger("remove",n.attributes)},n.prototype.hasTicket=function(n){for(var i=this.tickets,t=0;t<i.length;t++)if(i[t].attributes.regionId===n)return!0;return!1},n.prototype.removeFirstTicket=function(n){for(var i,r=this.tickets,t=0;t<r.length;t++)if(i=r[t],i.attributes.regionId===n)return i.remove(),!0;return!1},n.prototype.loadPrerenderedTickets=function(){for(var u,f=this.$ticketsHolder.find(this.ticketOptions.ticketRowSelector),i=0;i<f.length;i++){var n=$(f[i]),r=n.find('[name="TicketSelections.Index"]').val(),s=n.find('[name="TicketSelections['+r+'].EventPlaceAreaId"]'),e=n.find('[name="TicketSelections['+r+'].EventPlaceSeatId"]'),o=parseInt(s.val(),10),t={areaId:o};e.length===1?(u=parseInt(e.val(),10),t.regionId="s"+u,t.seatId=u):t.regionId="a"+o;this.addTicket(t,n);this.ticketIdx=Math.max(this.ticketIdx,parseInt(r,10)+1)}this.computePrice()},n.prototype.isFull=function(){var n=0,t=this.eventStatus.areas;for(var i in t)n+=t[i].ticketsAvailable;return this.tickets.length>=this.options.maxTickets||n===0},n.prototype.isEmpty=function(){return this.tickets.length===0},n.prototype.computePrice=function(){for(var t=0,i=this.tickets,n=0;n<i.length;n++)t+=i[n].price;this.$summaryPrice.html(t.toCurrencyString())},n.prototype.onTicketRemove=function(n,t){n.preventDefault();this.removeTicket(t)},t.prototype.render=function(n){var i=this.options,t,r;return this.options.$el?t=this.$el=this.options.$el:(r=this.template(this.attributes),t=this.$el=$(r),n.append(t)),this.$priceKind=t.find(i.priceKindSelector),this.$priceLevel=t.find(i.priceLevelSelector),this.$price=t.find(i.priceSelector),this.$promoCode=t.find(i.promoCodeSelector),this.$discount=t.find(i.discountSelector),this.$remove=t.find(i.removeSelector),this.attributes.kindId&&this.$priceKind.find('option[value="'+this.attributes.kindId+'"]').attr("selected","selected"),this.bindEvents(),this.$priceKind.selectmenu(),this.ensureAppearance(this.$priceKind),this.$priceLevel.selectmenu({format:i.priceLevelSelectOptionFormat}),this.ensureAppearance(this.$priceLevel),this.computePrice(),this},t.prototype.bindEvents=function(){this.$priceLevel.chained(this.$priceKind,"data-kind");this.$priceKind.on("change",$.proxy(this.onPriceKindChange,this));this.$priceLevel.on("change",$.proxy(this.onPriceLevelChange,this));this.$remove.on("click",$.proxy(this.onRemove,this))},t.prototype.unbindEvents=function(){this.$priceKind.off();this.$priceLevel.off();this.$remove.off()},t.prototype.computePrice=function(){var n=this.$priceLevel.find("option:selected");this.price=parseFloat(n.data("price-value"));this.$price.data("price-value",this.price).html(n.data("price-text"));$(this).trigger("change")},t.prototype.remove=function(){this.unbindEvents();this.$el.remove();$(this).trigger("remove",[this])},t.prototype.onPriceKindChange=function(n){n.preventDefault();this.ensureAppearance(this.$priceKind);this.ensureAppearance(this.$priceLevel);this.computePrice()},t.prototype.onPriceLevelChange=function(n){n.preventDefault();this.ensureAppearance(this.$priceLevel);this.$priceLevel.selectmenu();this.computePrice()},t.prototype.onRemove=function(n){n.preventDefault();this.remove()},t.prototype.ensureAppearance=function(n){$("option",n).length<=1?(n.addClass("singleOption"),n.selectmenu("disable")):n.removeClass("singleOption")},n}()