$(document).ready(function(){function r(n){for(var t="",r=0,i;;){if(i=$(".cTicketsNeeded_"+r,n),!i.length)return t;t=t+(t==""?"":",")+i.val();r++}}function n(n,t){var u=0,r;return n.Action=="Add"&&($.each(n.PriceLevelNeeds.split(","),function(){u+=1*this}),!u)?($('<div><span class="icon40 icon40error"><\/span>'+"Select the number of tickets you need.".Localize()+"<\/div>").dialog({modal:!0,width:400,title:"Error in finding tickets".Localize(),buttons:[{text:"OK".Localize(),click:function(){$(this).dialog("close")}}]}),!1):i?!1:(i=!0,r=$('<div><span class="icon40 icon40info"><\/span>'+"Finding and reserving tickets ...".Localize()+" <\/div>").dialog({modal:!0,title:"Please wait ...".Localize(),width:400}),$.ajax({type:"POST",url:UrlPre+"/handlers/findticket.ashx",data:n,error:function(){i=!1;r.dialog("close");$('<div><span class="icon40 icon40error"><\/span> '+"An error occurred while communicating with the server.".Localize()+"<\/div>").dialog({modal:!0,width:400,title:"Error in finding tickets".Localize(),buttons:[{text:"Refresh the page".Localize(),click:function(){window.location.reload(!0)}}]});t&&t()},success:function(msg){var sl,st,buttons;i=!1;r.dialog("close");msg.Success?($("#cAddedToCartPopupMsg").html(msg.Msg),$("#cAddedToCartPopupCashMsg").html(msg.PayCashStr),window.HallMap&&typeof HallMap.mapScroll!="undefined"&&(reservedInfo=eval(msg.ReservedInfo),availInfo=eval(msg.AvailInfo),sl=HallMap.mapScroll.scrollLeft(),st=HallMap.mapScroll.scrollTop(),HallMap.Render(),HallMap.mapScroll.scrollLeft(sl),HallMap.mapScroll.scrollTop(st)),msg.Options&&($("#cPrices").html(msg.Options),$("#cPrices").change()),msg.TRs&&($("#cAvailGrps").html(msg.TRs),InitTimers()),$("#cShoppingCartModule").show(),$("#cShoppingCartContainer").html(msg.ShoppingCart),BindLinksToLoginPopup("#cShoppingCartContainer"),Reflow($(".shoppingCartTable")),msg.Msg&&$("#cAddedToCartPopup").parent().css({position:"fixed"}).end().dialog("open")):(buttons={},msg.Refresh?buttons["Refresh the page".Localize()]=function(){window.location.reload(!0)}:buttons["OK".Localize()]=function(){$(this).dialog("close")},$('<div><span class="icon40 icon40error"><\/span>'+msg.Msg+"<\/div>").dialog({width:400,modal:!0,title:"Error in finding tickets".Localize(),buttons:buttons}));t&&t()}}),!1)}var i,e,u,t;if($(".venueMap a").click(function(n){n.preventDefault();var t=$(this).attr("href"),i=$(".eventName").text(),r='<div id="overlayContent"><iframe id="eventInfo" src="'+t+'&overlay=1"  frameborder="0" align="right" marginwidth="0px" scrolling="auto" ><\/iframe><\/div>';return $(r).dialog({modal:!0,title:i,width:"90%",height:$(window).height()*.9}),!1}),$("#cAddedToCartPopup").dialog({autoOpen:!1,width:400,modal:!0,position:"center"}),$("#cFindTickets").click(function(){return n({Action:"Add",EventId:EventId,GrpId:"",PriceLevelId:$("#cPrices").val(),PriceLevelNeeds:r($(".pricePanel")),SeatPreference:0,SelectedSeat:-1}),!1}),$("#cHallMapAddToCart").click(function(){var t=$("#cReserveOverlay"),i=r(t),u=0;return($.each(i.split(","),function(){u+=1*this}),!u)?($('<div ><span class="icon40 icon40error"><\/span>'+"Select the number of tickets you need.".Localize()+"<\/div>").dialog({modal:!0,width:400,title:"Error in finding tickets".Localize(),dialogClass:"topMost",buttons:[{text:"OK".Localize(),click:function(){$(this).dialog("close")}}]}),!1):(n({Action:"Add",EventId:EventId,PackageEventIds:PackageEventIds,GrpId:$("#cGrpId",t).val(),PriceLevelId:0,PriceLevelNeeds:i,SeatPreference:$("#cSeatPreference",t).val(),SelectedSeat:$("#cSelectedSeat",t).val()}),$("#cCancel",t).click(),!1)}),$("#cGAAddToCart").click(function(){var t="",i="",r="";return($("#cAvailGrps select").each(function(){var n=$(this);1*n.val()&&(t=t+(t==""?"":",")+n.data("groupid"),i=i+(i==""?"":",")+n.data("variationindex"),r=r+(r==""?"":",")+n.val())}),!t)?($('<div ><span class="icon40 icon40error"><\/span>'+"Select the number of tickets you need.".Localize()+"<\/div>").dialog({modal:!0,width:400,title:"Error in finding tickets".Localize(),dialogClass:"topMost",buttons:[{text:"OK".Localize(),click:function(){$(this).dialog("close")}}]}),!1):(n({Action:"Add",EventId:EventId,GrpId:t,VariationIndex:i,PriceLevelId:0,PriceLevelNeeds:r,SeatPreference:0,SelectedSeat:-1}),!1)}),i=!1,$(".cPriceSelector").length){$(".cPriceSelector").each(function(){for(var t=$(this),u=t.attr("data-eventid"),e=pricesInfo[u].isAssigned,f=pricesInfo[u].prices,n='<div class="row hideWhenDifferentPrices"><label>'+"Ticket Type:".Localize()+' <select class="cPriceLevels">',r,i=0;i<f.length;i++)r=f[i],n=n+'<option value="'+r.id+'">'+PackageCurrencySymbol+r.price+" - "+r.title+"<\/option>";n+='<\/select><\/label><\/div><div class="row INeedRow"><\/div>';n=n+'<div class="filterrow " style="text-align:center;"><button class="cFindTickets nsBtn '+(t.attr("data-buyallpackageid")>0?"large":"medium")+' primary" data-ga="FindTicketPackageAuto_FindTickets">'+(e?"Find Best Available Seats".Localize():"Find Tickets".Localize())+(t.attr("data-buyallpackageid")>0?" ("+"All Events".Localize()+") ":"")+"<\/button><\/div>";t.html(n)});$(".pricePanel  .cSeatingChart").click(function(n){var u,f,e,i,r;return(n.preventDefault(),n.stopPropagation(),u=$(this),f=u.parents(".cPriceSelector"),!Validator.IsValidAll($(".packageEvent")))?($('<div title="'+"Select the date".Localize()+'">'+"Select the date for the event.".Localize()+"<\/div>").dialog({modal:!0,buttons:[{text:"Ok".Localize(),click:function(){$(this).dialog("close")}}]}),!1):(e=f.attr("data-eventId"),i="",$(".packageEvent .cPriceSelector").each(function(){i=i+($(this).attr("data-instanceEventId")||$(this).attr("data-eventId"))+","}),r=$(this).attr("href").replace("#buy","?frame=1&moduleOnly=1&noheader=1&notopnav=1&nomoduleheader=1&nomodulewrap=1&linktarget=frame&ChartOnly=1&noProceedToCheckOut=1&PackageEventIds="+i+"#buy"),r!=$("#cSeatingChartFrame").attr("src")&&($("#cSeatingChartFrame").attr("src",""),$("#cSeatingChartFrame").attr("src",r)),t.dialog("open"),!1)});$(".pricePanel .cPriceSelector .cFindTickets").click(function(){var s=$(this),u=s.parents(".cPriceSelector"),t,i;if(!Validator.IsValidAll($(".packageEvent")))return $('<div title="'+'Select the date"'.Localize()+">"+"Select the date for the event.".Localize()+"<\/div>").dialog({modal:!0,buttons:[{text:"Ok".Localize(),click:function(){$(this).dialog("close")}}]}),!1;var e=u.attr("data-eventId"),f=pricesInfo[e].prices,o=$(".cPriceLevels :selected",u).val(),h=null;for(t=0;t<f.length;t++)if(f[t].id==o){h=f[t];break}return i="",$(".packageEvent .cPriceSelector").each(function(){i=i+($(this).attr("data-instanceEventId")||$(this).attr("data-eventId"))+","}),n({Action:"Add",EventId:e,PackageEventIds:i,GrpId:"",PriceLevelId:o,PriceLevelNeeds:r(u),SeatPreference:0,SelectedSeat:-1},UpdateYourTickets),!1});$(".packageEvent .cPriceSelector .cFindTickets").click(function(){var f=$(this),i=f.parents(".cPriceSelector"),t;if(!Validator.IsValidAll(f.parents(".packageEvent")))return $('<div title="'+"Select the date".Localize()+'">'+"Select the date for the event.".Localize()+"<\/div>").dialog({modal:!0,buttons:[{text:"Ok".Localize(),click:function(){$(this).dialog("close")}}]}),!1;var e=i.attr("data-eventId"),u=pricesInfo[e].prices,o=$(".cPriceLevels :selected",i).val(),s=null;for(t=0;t<u.length;t++)if(u[t].id==o){s=u[t];break}return n({Action:"Add",EventId:e,PackageEventIds:i.attr("data-instanceEventId"),GrpId:"",PriceLevelId:o,PriceLevelNeeds:r(i),SeatPreference:0,SelectedSeat:-1},UpdateYourTickets),!1});$(".packageEvent .cSelectRecurrence").change(function(){var n=$(this),t=$("option:selected",n).val(),i=n.parents(".packageEvent");$(".packageEventTickets",i).attr("data-eventId",t);$(".cPriceSelector",i).attr("data-instanceEventId",t);UpdateYourTickets()});window.UpdateYourTickets=function(){$(".packageEventTickets").each(function(){var t=$(this),i=t.attr("data-eventId"),n="";$('.shoppingCart .cSCEventLink a[data-event_Id="'+i+'"]').each(function(){var t=$(this).parents("tr");n=n+"<p>"+$(".cSCSection",t).text()+" / "+$(".cSCRow",t).text()+" / "+$(".cSCSeat",t).text()+" / "+$(".cSCPrice",t).text()+'&nbsp;&nbsp;<i class="cRemoveFromCart fa fa-trash fa-15x fa-hover" data-id="'+$(".cSCId",t).text()+'" data-variation="'+$(".cSCVariation",t).text()+'" data-eventid="'+i+'"><\/i><\/p>'});t.html(n||"No tickets.".Localize())})};UpdateYourTickets();$(".packageEventTickets").click(function(n){var t=$(n.target),i;t.hasClass("cRemoveFromCart")&&(i='.shoppingCart a.cUnreserveTicket[data-eventid="'+t.attr("data-eventid")+'"][data-id="'+t.attr("data-id")+'"][data-variation="'+t.attr("data-variation")+'"]',$(i).click())});$(".cPriceSelector .cPriceLevels").change(function(){for(var u=$(this),h=u.parents(".cPriceSelector"),l=h.attr("data-eventId"),e=pricesInfo[l].prices,a=$(":selected",u).val(),t=null,s,i,r,n=0;n<e.length;n++)if(e[n].id==a){t=e[n];break}var c=t.levels&&t.levels.length,v=u.parents(".pricePanel").length,o="";if(v&&(o="sets of".Localize()+" "+$(".packageEvent .cPriceSelector ").length+' <span class="hideWhenDifferentPrices"> * <\/span>'),$(".packageEvent .cPriceSelector .cFindTickets"),s='<span class="INeed">'+"I need".Localize()+'<\/span><select class="cTicketsNeeded_0">'+f(100,c,t)+'<\/select><span title="'+t.desc+'">'+o+'<span class="hideWhenDifferentPrices">'+PackageCurrencySymbol+t.price+" - "+t.title+"<\/span><\/span><br/>",t.levels){for(i=t,r="",n=0;n<i.levels.length;n++)r=r+'<span class="INeed">'+"and".Localize()+'<\/span><select class="cTicketsNeeded_'+(n+1)+'">'+f(100,c,i.levels?i.levels[n]:null)+'<\/select><span title="'+i.levels[n].desc+'">'+o+'<span class="hideWhenDifferentPrices">'+PackageCurrencySymbol+i.levels[n].price+" - "+i.levels[n].title+"<\/span><\/span><br/>";s+=r}$(".INeedRow",h).html(s)}).change();function f(n,t,i){var u="",f=!1,r;for(t&&(u='<option value="0" selected="selected">0<\/option>',f=!0),r=i?i.min:0;r<=(i?i.max:15)&&r<=n;r+=i?i.increment:1)u=u+'<option value="'+r+'"'+(f?"":' selected="selected" ')+">"+r+"<\/option>",f=!0;return u}$("body").css("overflow","hidden");e=$(window).width();u=$(window).height();$("body").css("overflow","auto");t=$("#cSeatingChartFrameContainer").dialog({title:"Choose on the seating chart:".Localize(),modal:!0,autoOpen:!1,width:e,height:u,draggable:!1,position:"top",open:function(){$("body").css("overflow","hidden");$("#cSeatingChartFrame").attr("height",u-$(".cSeatingChartFrameContainerDialog .ui-dialog-titlebar").height())},close:function(){$("body").css("overflow","auto");$("#cSeatingChartFrame").attr("src","");n({Action:"GetCart"},UpdateYourTickets)}});$("#cSeatingChartFrameContainer").parent().addClass("cSeatingChartFrameContainerDialog");$("<a href='#' style='float:right; margin-right:1em;' class=''>"+"Back to the sales page".Localize()+' &nbsp;&nbsp;<i class="fa fa-close" ><\/i><\/a>').insertBefore(".cSeatingChartFrameContainerDialog .ui-dialog-titlebar-close").click(function(n){n.preventDefault();t.dialog("close")});$(".packageEvent .cSeatingChart").click(function(n){n.preventDefault();n.stopPropagation();var i=$(this).attr("href").replace("#buy","?frame=1&moduleOnly=1&noheader=1&notopnav=1&nomoduleheader=1&nomodulewrap=1&linktarget=frame&ChartOnly=1&noProceedToCheckOut=1#buy");return i!=$("#cSeatingChartFrame").attr("src")&&($("#cSeatingChartFrame").attr("src",""),$("#cSeatingChartFrame").attr("src",i)),t.dialog("open"),!1});$("#cSeatingChartFrameContainer a").click(function(){t.dialog("close")});window.addEventListener("message",function(n){n.data.indexOf("TicketorCloseSeatingChart")==0&&t.dialog("close")},!1)}$("#cApplyPurchasePassword").click(function(){return n({Action:"ApplyPurchasePassword",EventId:EventId,Password:$("#cPurchasePassword").val()},function(){window.location.reload(!0)}),!1})});$(document).ready(function(){$(".showMoreInfo").click(function(n){var i,t,r,u,f;return $(window).width()<780?!0:(n.preventDefault(),i=$(this).closest("tr"),u="",i.length?(t=$(".idfield",i).html(),r=$(".eventTitle",i).text()):(t=$(this).attr("href").substr($(this).attr("href").lastIndexOf("-")+1),t=t.replace("?","&"),r=$(".eventName a",$(this).closest(".upcomingEvent,body")).text()),(location.href.toLowerCase().indexOf("/members/")>=0||location.href.toLowerCase().indexOf("/tickets/")>=0)&&(u="../"),$("#overlayContent").remove(),f='<div id="overlayContent"><iframe id="eventInfo" src="'+u+"EventInfoOverlay.aspx?eventId="+t+'"  frameborder="0" align="right" marginwidth="0px" scrolling="auto" ><\/iframe><\/div>',$(f).dialog({modal:!0,autoOpen:!1,resizable:!1,title:r,width:"90%",height:$(window).height()*.9,close:function(){$(this).dialog("destroy").remove()}}),$("#overlayContent").parent().css({position:"fixed"}).end().dialog("open"),!1)})}),function(n){var u=6e4,t=function(n){return n.toISOString().replace(/-|:|\.\d+/g,"")},r=function(n){return n.end?t(n.end):t(new Date(n.start.getTime()+n.duration*u))},i={google:function(n){var i=t(n.start),u=r(n),f=encodeURI(["https://www.google.com/calendar/render","?action=TEMPLATE","&text="+(n.title||""),"&dates="+(i||""),"/"+(u||""),"&details="+(n.description||""),"&location="+(n.address||""),"&url="+(n.url||""),"&sprop=&sprop=name:"].join(""));return'<a class="icon-google" target="_blank" href="'+f+'"><i class="fa fa-plus"><\/i> '+"Google Calendar".Localize()+"<\/a>"},onlineOutlook:function(n){var i=t(n.start),u=r(n),f=encodeURI(["http://addtocalendar.com/atc/outlookonline","?utz=-480&uln=en-US&vjs=1.5","&e[0][title]="+(n.title||""),"&e[0][date_start]="+(i||""),"&e[0][date_end]="+(u||""),"&e[0][description]="+(n.description||""),"&e[0][location]="+(n.address||""),"&e[0][url]="+(n.url||"")].join(""));return'<a class="icon-onlineOutlook" target="_blank" href="'+f+'"><i class="fa fa-plus"><\/i> '+"Outlook Online".Localize()+"<\/a>"},yahoo:function(n){var i=n.end?(n.end.getTime()-n.start.getTime())/u:n.duration,r=i<600?"0"+Math.floor(i/60):Math.floor(i/60)+"",f=i%60<10?"0"+i%60:i%60+"",e=r+f,o=t(n.start),s=encodeURI(["http://calendar.yahoo.com/?v=60&view=d&type=20","&title="+(n.title||""),"&st="+o,"&dur="+(e||""),"&desc="+(n.description||""),"&in_loc="+(n.address||""),"&URL="+(n.url||"")].join(""));return'<a class="icon-yahoo" target="_blank" href="'+s+'"><i class="fa fa-plus"><\/i> '+"Yahoo! Calendar".Localize()+"<\/a>"},ics:function(n,i,u){var f=t(n.start),e=r(n),o=encodeURI("data:text/calendar;charset=utf8,"+["BEGIN:VCALENDAR","VERSION:2.0","BEGIN:VEVENT","URL:"+document.URL,"DTSTART:"+(f||""),"DTEND:"+(e||""),"SUMMARY:"+(n.title||""),"DESCRIPTION:"+(n.description||""),"LOCATION:"+(n.address||""),"END:VEVENT","END:VCALENDAR"].join("\n"));return'<a class="'+i+'" target="_blank" href="'+o+'"><i class="fa fa-plus"><\/i> '+u+" "+"Calendar".Localize()+"<\/a>"},ical:function(n){return this.ics(n,"icon-ical","iCal")},outlook:function(n){return this.ics(n,"icon-outlook","Outlook")}},f=function(n){return{google:i.google(n),yahoo:i.yahoo(n),ical:i.ical(n),outlook:i.outlook(n)}},e=function(n){return n.data!==undefined&&n.data.start!==undefined&&(n.data.end!==undefined||n.data.duration!==undefined)},o=function(n,t,i){var r='<div id="'+i+'" class="add-to-calendar cAutoDropDown cDropDownMenu" style="padding-top:15px;"><div class="clearfix"><i class="fa fa-calendar-plus-o  fa-15x fa-hover"   ><\/i>&nbsp; '+"Add to Calendar".Localize()+'<\/div><ul class="ui-widget-content ui-corner-all">';return Object.keys(n).forEach(function(t){r+="<li>"+n[t]+"<\/li>"}),r+="<\/ul><\/div>"},s=function(n){if(n.options&&n.options.class)return n.options.class},h=function(n){return n.options&&n.options.id?n.options.id:Math.floor(Math.random()*1e6)};n.createCalendar=function(n){if(!e(n)){console.log("Event details missing.");return}return o(f(n.data),s(n),h(n))}}(this)