window.HallMap={};var clickToBuy=!1,clickToBuyShowPopUp=!1;$(document).ready(function(){($get("newSection")&&(window.hallMapEditorMode=!0),typeof hallSeatChart!="undefined"&&hallSeatChart!=null)&&(HallMap={version:2,pageCover:$("#pageCover"),container:$("#mapContainer"),activeSection:null,preventSectionClick:!1,reserveOverlay:$("#cReserveOverlay"),cSection:$("#cSection"),cRow:$("#cRow"),cPrice:$("#cPrice"),cCount:$("#cCount"),cPreference:$("#cSeatPreference"),cSelectedSeat:$("#cSelectedSeat"),cGrpPrice:$("#cGrpPrice"),cGrpId:$("#cGrpId"),totSeats:0,totAvail:0,totSold:0,mapScroll:null,prevHover:null,seatSize:10,seatSpacing:2,sectionSpacing:10,tooltip:null,styles:$("#cHallMapStyles"),cssPatern:"",zoomFactor:1,prevZoomFactor:1,noCss3:!1,pricePanel:$(".pricePanel"),sectionLevelActualSize:!0,init:function(){function t(){$(".cScrollLeft")[HallMap.mapScroll[0].scrollLeft>0?"show":"hide"]();$(".cScrollRight")[HallMap.mapScroll[0].scrollLeft+HallMap.mapScroll.width()+5<HallMap.mapScroll[0].scrollWidth?"show":"hide"]()}var n=HallMap,i;hallSeatChart.settings||(i={settings:{version:3}},hallSeatChart[0]&&hallSeatChart[0].settings&&(i.settings=hallSeatChart.settings||hallSeatChart[0].settings,delete hallSeatChart[0].settings),i.secRows=hallSeatChart,hallSeatChart=i);hallSeatChart.settings&&(hallSeatChart.settings.sectionLevelFirst?($("#cSectionLevelFirst").prop("checked",!0),sectionLevelFirst=!0,hallSeatChart.settings.sectionLevelActualSize!=!0&&(hallSeatChart.settings.sectionLevelActualSize=!1),HallMap.sectionLevelActualSize=hallSeatChart.settings.sectionLevelActualSize):(HallMap.sectionLevelActualSize=!0,hallSeatChart.settings.sectionLevelActualSize!=!1&&(hallSeatChart.settings.sectionLevelActualSize=!0)),hallSeatChart.settings.zoom&&hallSeatChart.settings.zoom!=1&&HallMap.setZoom(hallSeatChart.settings.zoom),HallMap.rotation=hallSeatChart.settings&&hallSeatChart.settings.rotation?hallSeatChart.settings.rotation:0);HallMap.noCss3=$("body").hasClass("ie8")||$("body").hasClass("ie7")||$("body").hasClass("ie6");HallMap.version=hallSeatChart.settings.version||2;$(".cPrices2",n.pricePanel).change(function(){var r=n.indexInPriceInfoIds(pricesInfo,$("option:selected",$(this)).val()),f,i,e,u,t;if(r<0&&(r=n.indexInPriceInfo(pricesInfo,$("option:selected",$(this)).val())),f=pricesInfo&&pricesInfo[r]&&pricesInfo[r].levels,f){for(u=n.getCountOptions(100,f,pricesInfo[r].min?pricesInfo[r]:null),$(".cTicketsNeeded_0",n.pricePanel).html(u),i=pricesInfo[r],e='<span title="'+i.desc+'">'+currencySymbol+i.price+(i.fees==""?"":" <sub> +"+i.fees+"<\/sub>")+(i.title?" - ":" ")+i.title+"<\/span><br/>",t=0;t<i.levels.length;t++)e=e+'<span class="INeed2">'+"and".Localize()+'<\/span><select class="cTicketsNeeded_'+(t+1)+'">'+n.getCountOptions(100,f,pricesInfo[r].levels[t])+'<\/select><span title="'+i.levels[t].desc+'">'+currencySymbol+i.levels[t].price+(i.levels[t].fees==""?"":" <sub> +"+i.levels[t].fees+"<\/sub>")+(i.levels[t].title?" - ":" ")+i.levels[t].title+"<\/span><br/>";$(".cPriceLevelRequest2",n.pricePanel).html(e);$(".cPriceLevelRequest2",n.pricePanel).show();$(".cPriceLevelRequest2 span",n.pricePanel).tooltip({content:function(){var n=$(this);return n.attr("title")}})}else{for(u="",t=0;t<16;t++)u=u+'<option value="'+t+'"'+(t==0?' selected="selected" ':"")+">"+t+"<\/option>";$(".cTicketsNeeded_0",n.pricePanel).html(u);$(".cPriceLevelRequest2",n.pricePanel).html("");$(".cPriceLevelRequest2",n.pricePanel).hide()}pricesInfo&&pricesInfo[r]&&pricesInfo[r].levels&&pricesInfo[r].levels.length?($(".cTicketsNeeded_0 option:first-child",n.pricePanel).prop("disabled",!1),$(".cTicketsNeeded_0",n.pricePanel).val(0)):($(".cTicketsNeeded_0",n.pricePanel).val(1),$(".cTicketsNeeded_0 option:first-child",n.pricePanel).remove())}).change();$("#cZoomSlider").slider({min:.05,max:2,value:hallSeatChart.settings&&hallSeatChart.settings.zoom?hallSeatChart.settings.zoom:1,step:.05,slide:function(n,t){HallMap.setZoom(t.value)},stop:function(n,t){window.hallMapEditorMode&&HallMapEditor.SaveZoom(t.value)}});$("#cRotate90").click(function(){var n=!HallMap.rotation||isNaN(HallMap.rotation)?0:HallMap.rotation;n+=90;n>=360&&(n=n%360);HallMap.setRotation(n);window.hallMapEditorMode&&HallMapEditor.SaveRotation(n)});$("#mapWrapper").mouseenter(function(){t()});$("#mapWrapper").mouseleave(function(){$(".cScrollRight,.cScrollLeft").hide()});$(".cScrollRight").mouseenter(function(){HallMap.mapScroll.animate({scrollLeft:HallMap.mapScroll[0].scrollWidth-HallMap.mapScroll.width()+"px"},{duration:2e3,always:t})});$(".cScrollRight").mouseleave(function(){HallMap.mapScroll.stop(!0,!1);t()});$(".cScrollLeft").mouseenter(function(){HallMap.mapScroll.animate({scrollLeft:"0px"},{duration:2e3,always:t})});$(".cScrollLeft").mouseleave(function(){HallMap.mapScroll.stop(!0,!1);t()})},Render:function(){var tt,r,s,h,e,l,ut,y,n,it,et,o,a,rt,p,v,u,f,t,c,ot,w,g,b,nt;for(HallMap.v3=HallMap.version==3,hallSeatChart.settings&&(sectionLevelFirst=hallSeatChart.settings.sectionLevelFirst),HallMap.totSeats=0,HallMap.totAvail=0,HallMap.totSold=0,this.cssPatern=".seat {width:{0}px; height:{0}px; margin-left: {1}px;margin-right: {1}px;-webkit-border-radius: {3}px;border-radius: {3}px; }.section {margin-left:{2}px; margin-right:{2}px;}",tt=String.format(this.cssPatern,this.seatSize,this.seatSpacing/2,this.sectionSpacing/2,this.seatSize/2),this.styles.remove(),this.styles=$('<style id="cHallMapStyles" type="text/css">'+tt+"<\/style>"),$("head").append(this.styles),r=this.container,this.mapScroll=r.closest("#mapScroll"),typeof pricesInfo!="undefined"&&pricesInfo||(pricesInfo=[]),availInfo=typeof availInfo!="undefined"?availInfo:[],soldInfo=typeof soldInfo!="undefined"?soldInfo:null,reservedInfo=typeof reservedInfo!="undefined"?reservedInfo:null,hallMapEditorMode=typeof hallMapEditorMode!="undefined"?hallMapEditorMode:null,TotSeats=0,TotAvail=0,TotSold=0,r.css("visibility","hidden"),r.html(""),$("#mapContainer+.guide").remove(),r.addClass("mixMap mapContainer"),$("#fullScreen").click(this.zoom),$("#exitFullScreen").click(this.zoom),this.mapScroll.scroll(this.scroll),$(window).resize(this.resize),$(window).keypress(this.keypress),$(document).keydown(this.keypress),$("#pressEsc").click(function(){$("#pressEsc").hide()}),r.append('<div class="seatTooltip"><\/div>'),this.tooltip=$(".seatTooltip",r),HallMap.zoomFactor!=1&&HallMap.setZoom(HallMap.zoomFactor),HallMap.IsBinded||(r.click(this.click),r.mouseover(this.mouseover),r.mouseenter(this.hoverIn),r.mouseleave(this.hoverOut),HallMap.IsBinded=1),e=hallSeatChart.secRows.length-1;e>=0;e--){for(l=$('<div class="sectionRow clearfix" data-secr="'+e+'"><\/div>'),r.append(l),ut=l.position().top,h=50,s=10,hallSeatChart.secRows[e].sections=hallSeatChart.secRows[e].sections||[],y=0;y<hallSeatChart.secRows[e].sections.length;y++){n=hallSeatChart.secRows[e].sections[y];it=0;n.sectionRow=hallSeatChart.secRows[e].sectionRow;var ft=HallMap.v3?n.type+" "+n.typeDetail+(sectionLevelFirst&&n.type=="rows"?" sectionLevel":""):sectionLevelFirst?" sectionLevel":"",i=$('<div class="section '+ft+'" data-sec="'+y+'"><\/div>'),k=$('<div><span class="sectionName">'+(hallMapEditorMode?'<div class="settings ui-icon ui-icon-gear"><\/div>':"")+(n.type=="table"?n.sectionName:n.sectionName)+'<\/span><div class="closeBtn"><\/div><\/div>');if(!HallMap.noCss3&&n.r&&i.attr("data-rotation",n.r).css("-moz-transform","rotate("+n.r+"deg)").css("-webkit-transform","rotate("+n.r+"deg)").css("-o-transform","rotate("+n.r+"deg)").css("-ms-transform","rotate("+n.r+"deg)").css("transform","rotate("+n.r+"deg)"),i.css("left",n.x),(!HallMap.noCss3||!n.r||HallMap.v3)&&n.y&&(i.css("top",n.y),it=n.y),l.append(i),i.append(k),et=0,n.totSeats=0,n.totAvail=0,n.totSold=0,n.type=="shape")i.width(n.w).height(n.h),i.html((hallMapEditorMode?'<span class="shapeInner1"><\/span><span class="shapeInner2"><\/span><span class="sectionName"><div class="settings ui-icon ui-icon-gear"><\/div><\/span>':"")+'<span class="sectionTitle">'+n.sectionName+"<\/span>"),i.addClass("notAvailSection");else if(n.type=="GA"){i.width(n.w).height(n.h);i.html((hallMapEditorMode?'<span class="sectionName"><div class="settings ui-icon ui-icon-gear"><\/div><\/span>':"")+'<span class="sectionTitle">'+n.sectionName+"<\/span>");var u=0,f=0,d=0;if(price=0,charge="-",availInfo)for(t=0;t<availInfo.length;t++)availInfo[t].sectionRow==n.sectionRow&&availInfo[t].section==n.sectionName&&(u+=availInfo[t].seats.length,price=availInfo[t].price,charge=availInfo[t].charge,availGrpIndex=t);if(soldInfo)for(t=0;t<soldInfo.length;t++)soldInfo[t].sectionRow==n.sectionRow&&soldInfo[t].section==n.sectionName&&(f+=soldInfo[t].seats.length);for(t=0;t<n.rows.length;t++)d+=n.rows[t].to;n.totAvail=u;n.totSold=f;n.totSeats=d;this.totAvail+=u;this.totSold+=f;this.totSeats+=d;u==0?i.addClass("notAvailSection"):(rt='<div data-r="0" class="row"><div class="seatContainer clearfix alignleft"><div class="seat '+HallMap.seatClassName(availGrpIndex,-1,-1,1)+'"><span class="seatNumber"><\/span><\/div><\/div><\/div>',i.append(rt),p='<div class="label">Section: <\/div><div class="seatRowName">'+n.sectionName+"<\/div>",p+='<div class="label">'+"Price:".Localize()+' <\/div><div class="seatPrice">'+currencySymbol+price+(charge!="-"?"<sub> + "+charge+"<\/sub>":"")+"<\/div>",u&&(p+='<div class="seatStatus">'+"Available:".Localize()+" "+u+"<\/div>"),f&&(p+='<div class="seatStatus">'+"Sold:".Localize()+" "+f+"<\/div>"),v=$(".seat",i),v.data("tooltipcontent",p),v.data("availGrpIndex",availGrpIndex),v.attr("class").indexOf("price")>=0&&($(".sectionTitle",i).click(function(n){var t=$(".seat",$(this).parent());HallMap.buyClick(t[0],availInfo[t.data("availGrpIndex")],null,n.pageY,n)}),v.click(function(n){HallMap.buyClick(v[0],availInfo[$(this).data("availGrpIndex")],null,n.pageY,n)})))}else if(sectionLevelFirst&&(!HallMap.v3||n.type=="rows")){if(n.w&&HallMap.v3&&i.width(n.w),n.h&&HallMap.v3&&i.height(n.h),this.mapScroll.addClass("sectionLevelFirst"),u=0,f=0,o=999999,a=0,availInfo)for(t=0;t<availInfo.length;t++)availInfo[t].sectionRow==n.sectionRow&&availInfo[t].section==n.sectionName&&(u+=availInfo[t].seats.length,availInfo[t].price<o&&(o=availInfo[t].price),availInfo[t].price>a&&(a=availInfo[t].price));if(soldInfo)for(t=0;t<soldInfo.length;t++)soldInfo[t].sectionRow==n.sectionRow&&soldInfo[t].section==n.sectionName&&(f+=soldInfo[t].seats.length);n.totAvail=u;n.totSold=f;this.totAvail+=u;this.totSold+=f;u==0&&i.addClass("notAvailSection");c="available: ".Localize()+u+" ";u>0&&o&&(c=a>o?c+"<br/>"+currencySymbol+o+"-$"+a:c+"<br/>"+currencySymbol+o);f>0&&(c=c+"<br/>"+"Sold: ".Localize()+f);k.append('<div class="clickToEnlarge">'+c+(u>0?"<br/>Click "+"to enlarge & buy".Localize()+"<\/div>":""))}else ot=this.renderRows(i),HallMap.sectionLevelActualSize&&HallMap.v3&&n.type=="rows"&&(n.w=i.width(),n.h=i.height()),HallMap.v3&&n.w&&n.type=="table"&&i.width(n.w),HallMap.v3&&n.h&&n.type=="table"&&i.height(n.h);n.type=="rows"&&$(".sectionName",k).attr("title",n.sectionName+","+this.getInfo(n.totSeats,n.totAvail,n.totSold,sectionLevelFirst,o,a));w=(i.data("rotation")||0)/180*Math.PI;g=n.x+i.width()*Math.abs(Math.cos(w))+i.height()*Math.abs(Math.sin(w));g>s&&(s=g);i.data("originalWidth",i.width());b=(i.css("left")||"").toLowerCase().replace("px","");isNaN(b)&&(b=i.position().left);i.data("originalLeft",b);nt=n.y+i.height()*Math.abs(Math.cos(w))+i.width()*Math.abs(Math.sin(w));nt>h&&(h=nt)}l.css("width",s+30).css("height",h+30);l.data("width",s+30).data("height",h+30)}this.renderGuide(r.closest("#mapScroll"),this.getInfo(this.totSeats,this.totAvail,this.totSold).replace(/,/g,"<br/>"));(this.totSeats<=2e3||hallSeatChart.settings&&hallSeatChart.settings.sectionLevelFirst)&&r.closest("#mapScroll").addClass("showSoldSeats");$(".sectionName",r).tooltip({content:function(){var n=$(this);return n.attr("title").replace(/,/g,"<br/>")},position:{my:"left+30 top",at:"left bottom"}});this.renderInfo(r.closest("#mapScroll"),this.totSeats,this.totAvail,this.totSold);r.data("orgWidth",s);r.data("orgHeight",h);r.css("width",s*hallSeatChart.settings.zoom+30).css("height",h*hallSeatChart.settings.zoom+30);r.show();$("#cCancel").click(this.cancelClick);$(".closeBtn").click(this.close);HallMap.rotation||this.container.draggable({handler:".sectionRow",axis:"x",containment:this.mapScroll});this.container.css("visibility","visible");window.hallMapEditorMode||HallMap.setRotation(HallMap.rotation)},setZoom:function(n){var i=HallMap.container,t="scale("+n+")";i.css("-moz-transform",t).css("-webkit-transform",t).css("-o-transform",t).css("-ms-transform",t).css("transform",t);t="scale("+1/n+")";this.tooltip&&this.tooltip.css("-moz-transform",t).css("-webkit-transform",t).css("-o-transform",t).css("-ms-transform",t).css("transform",t);HallMap.zoomFactor=n;i.data("orgWidth")&&i.css("width",1*n*i.data("orgWidth")+30).css("height",1*n*i.data("orgHeight")+30);HallMap.setRotation(HallMap.rotation)},setRotation:function(n){var i=$(".sectionRow",HallMap.container),t="rotate("+n+"deg)";if(n==90||n==270){var r=i.data("width"),u=i.data("height"),f=n==270?-1:1;t=t+" translate("+f*(r-u)/2+"px,"+f*(r-u)/2+"px)";r>u&&HallMap.container.css("height",r*HallMap.zoomFactor)}else HallMap.container.css("height",i.data("height")*HallMap.zoomFactor);i.css("-moz-transform",t).css("-webkit-transform",t).css("-o-transform",t).css("-ms-transform",t).css("transform",t);HallMap.rotation=n},calcSectionWidth:function(n){var f=n,y=$($("div",n)[0]),s=n.attr("data-sec"),h=n.closest(".sectionRow").attr("data-secr"),p=hallSeatChart.secRows[h].sections[s],c=f.attr("data-seats")||0,l=f.attr("data-padding")||0,a=0,e,o,t,r,i,v,u;if(!c)for(l=0,e=0,o=hallSeatChart.secRows[h].sections[s].rows.length-1;o>=0;o--){for(t=hallSeatChart.secRows[h].sections[s].rows[o],t.count=Math.abs(t.from-t.to)/Math.abs(t.step)+1,t.count-=Object.keys(t.hidden||{}).length,t.paddings=0,r=Object.keys(t.paddingLeft||{}),i=0;i<r.length;i++)t.paddings+=t.paddingLeft[r[i]];for(r=Object.keys(t.paddingRight||{}),i=0;i<r.length;i++)t.paddings+=t.paddingRight[r[i]];v=t.count*(this.seatSize+this.seatSpacing+2)+(t.count==0?0:this.seatSpacing)+10+t.paddings;v>e&&(c=t.count,l=t.paddings,e=v)}return u=e,u<40&&(u=40),sectionLevelFirst&&(u=u*.25),a+=u,f.css("width",u).attr("data-seats",c).attr("data-paddings",l),f.data("sectionWidth",a),a},renderRows:function(n){var y=n,s=$($("div",n)[0]),h=n.attr("data-sec"),c=n.closest(".sectionRow").attr("data-secr"),r=hallSeatChart.secRows[c].sections[h],a=n.data("sectionWidth")||HallMap.calcSectionWidth(n),e,o,f,u,t;for(HallMap.v3&&hallMapEditorMode&&r.type!="table"&&r.type!="Seat_Group"&&s.append('<div class="row cAddRow">'+"Add row".Localize()+"<\/div>"),e=hallSeatChart.secRows[c].sections[h].rows.length-1;e>=0;e--){var v=r.totAvail+r.totSold,i=hallSeatChart.secRows[c].sections[h].rows[e],l=$(['<div class="row clearfix" data-r="',e,'"><span class="rowName">',i.name,'<\/span><div class="seatContainer clearfix align',r.align,'"><\/div><\/div>'].join(""));if(s.append(l),o=$(".seatContainer:last",s),r.type!="table"&&r.type!="Seat_Group"){if(f=[],i.seatOrder=="OddEven"){for(u=i.to,u%2==0&&u--,t=u;t>=i.from;t=t-2)this.addSeat(f,t,i,r);for(u=i.from,u%2==1&&u++,t=u;t<=i.to;t=t+2)this.addSeat(f,t,i,r)}else if(i.seatOrder=="EvenOdd"){for(u=i.to,u%2==1&&u--,t=u;t>=i.from;t=t-2)this.addSeat(f,t,i,r);for(u=i.from,u%2==0&&u++,t=u;t<=i.to;t=t+2)this.addSeat(f,t,i,r)}else for(t=i.from;i.to>=i.from?t<=i.to:t>=i.to;t=t+i.step)this.addSeat(f,t,i,r);r.align=="right"&&(f=f.reverse());o.html(f.join(""));v!=r.totAvail+r.totSold||i.hasReserved||l.addClass("empty")}else r.type=="table"?this.addTable(o,i,r):r.type=="Seat_Group"&&this.addSeatGroup(o,i,r)}return a},getInfo:function(n,t,i,r){if(typeof RemainingTicketsCount!="undefined"&&RemainingTicketsCount<t||!showHallInfo&&!showAvailInfo&&!showSoldInfo)return"";r=r||!1;var u="";return showHallInfo&&!r&&n>0&&(u=u+" Capacity: ".Localize()+n),showAvailInfo&&(u=t>0||!r?u+(u==""?"":", ")+"Available: ".Localize()+t:u+(u==""?"":", ")+"No tickets available in this section.".Localize()),showSoldInfo&&(u=u+(u==""?"":", ")+"Sold: ".Localize()+i),u},renderInfo:function(n,t,i,r,u,f,e){var o=this.getInfo(t,i,r,u,f,e);$(".info",n).remove();o&&n.append('<div class="info">'+o+"<\/div>")},renderGuide:function(n,t){var r,i,u;if(availInfo&&availInfo.length!=0){for(r=$('<div class="guide clearfix"><\/div>'),n.append(r),i=0;i<pricesInfo.length;i++)for(r.append('<div class="clearfix"><div class="seat price'+(pricesInfo[i].colorIndex<0?i:pricesInfo[i].colorIndex)+'"><\/div><span class="seatTitle"> '+currencySymbol+pricesInfo[i].price+(pricesInfo[i].fees==""?"":" <sub> +"+pricesInfo[i].fees+"<\/sub>")+(pricesInfo[i].title?" - "+pricesInfo[i].title:" ")+(pricesInfo[i].desc?" ("+pricesInfo[i].desc+")":"")+"<\/span><\/div>"),u=0;u<(pricesInfo[i].levels?pricesInfo[i].levels.length:0);u++)r.append('<div class="clearfix"><div class="seat priceLevel price'+(pricesInfo[i].colorIndex<0?i:pricesInfo[i].colorIndex)+'"><\/div><span class="seatTitle"> '+currencySymbol+pricesInfo[i].levels[u].price+(pricesInfo[i].levels[u].fees==""?"":" <sub> +"+pricesInfo[i].levels[u].fees+"<\/sub>")+(pricesInfo[i].levels[u].title?" - ":" ")+pricesInfo[i].levels[u].title+(pricesInfo[i].levels[u].desc?"("+pricesInfo[i].levels[u].desc+")":"")+"<\/span><\/div>");r.append('<div class="clearfix"><div class="seat"><\/div><span class="seatTitle">'+"Not available".Localize()+"<\/span><\/div>");soldInfo&&(r.append('<div class="clearfix"><div class="seat sold"><\/div><span class="seatTitle">'+"Sold".Localize()+"<\/span><\/div>"),r.append('<div class="clearfix"><div class="seat block1"><\/div><span class="seatTitle">'+"Blocked".Localize()+"<\/span><\/div>"));reservedInfo&&r.append('<div class="clearfix"><div class="seat reserved"><\/div><span class="seatTitle">'+"In your shopping cart".Localize()+"<\/span><\/div>");r.append('<div class="clearfix"><div class="seat handicap"><\/div><span class="seatTitle">'+"Accessible (Wheelchair or companion)".Localize()+"<\/span><\/div>");r.append('<div class="guideStats">'+t+"<\/div>")}},indexInPriceInfo:function(n,t){for(var i=0;i<n.length;i++)if(n[i].price==t)return i;return-1},indexInPriceInfoIds:function(n,t){for(var i=0;i<n.length;i++)if(n[i].id==t)return i;return-1},indexInArray:function(n,t){for(var i=0;i<n.length;i++)if(n[i]==t)return i;return-1},seatSoldGrpIndex:function(n,t,i){if(!soldInfo)return-1;for(var r=0;r<soldInfo.length;r++)if(soldInfo[r].sectionRow==n.sectionRow&&soldInfo[r].section==n.sectionName&&soldInfo[r].row==t.name&&this.indexInArray(soldInfo[r].seats,i)>=0)return r;return-1},seatReservedGrpIndex:function(n,t,i){if(!reservedInfo)return-1;for(var r=0;r<reservedInfo.length;r++)if(reservedInfo[r].sectionRow==n.sectionRow&&reservedInfo[r].section==n.sectionName&&reservedInfo[r].row==t.name&&this.indexInArray(reservedInfo[r].seats,i)>=0)return r;return-1},seatGrpIndex:function(n,t,i){if(!availInfo)return-1;for(var r=0;r<availInfo.length;r++)if(availInfo[r].sectionRow==n.sectionRow&&availInfo[r].section==n.sectionName&&availInfo[r].row==t.name&&this.indexInArray(availInfo[r].seats,i)>=0)return r;return-1},seatClassName:function(n,t,i){var o;if(!availInfo)return"";if(n<0&&t<0&&i<0)return"na";var u="_",f=!1,e=0,r=-1;return n>=0?(u=availInfo[n].price,f=availInfo[n].handicap,e=availInfo[n].block,r=availInfo[n].colorIndex):t>=0&&(u=soldInfo[t].price),r<0&&(o=this.indexInPriceInfo(pricesInfo,u),o>=0&&pricesInfo[this.indexInPriceInfo(pricesInfo,u)]&&(r=pricesInfo[this.indexInPriceInfo(pricesInfo,u)].colorIndex),r<0&&(r=100)),String.format("price{0}{1}{2}{3} block{4}",r,n<0&&i<0?" sold":"",i>=0?" reserved":"",f?" handicap ":"",e)},addSeat:function(n,t,i,r){var u=this.seatGrpIndex(r,i,t),e=this.seatSoldGrpIndex(r,i,t),o=this.seatReservedGrpIndex(r,i,t),f="",s;(i.paddingLeft&&i.paddingLeft[t]||i.paddingRight&&i.paddingRight[t]||i.hidden&&i.hidden[t]||i.seatPosition&&i.seatPosition[t])&&(f=' style="',i.paddingLeft&&i.paddingLeft[t]&&(f+="margin-left:"+i.paddingLeft[t]+"px;"),i.paddingRight&&i.paddingRight[t]&&(f+="margin-right:"+i.paddingRight[t]+"px;"),i.hidden&&i.hidden[t]&&(f+="display:none;",r.totSeats--,this.totSeats--),i.seatPosition&&i.seatPosition[t]&&(f+="left:"+i.seatPosition[t].x+"px;top:"+i.seatPosition[t].y+"px;"),f+='" ');s=['<div class="seat ',"",this.seatClassName(u,e,o,t),'" ',u>=0?'data-p="'+availInfo[u].price+'" ':"",u>=0&&availInfo[u].handicap?'data-handicap="1" ':"",u>=0&&availInfo[u].charge!="-"?'data-c="'+availInfo[u].charge+'" ':"",e>=0?'data-s="'+e+'" ':"",f,">",t,"<\/div>"];n.push(s.join(""));r.totSeats++;this.totSeats++;u>=0&&(r.totAvail++,this.totAvail++);e>=0&&(r.totSold++,this.totSold++);o>=0&&(i.hasReserved=!0)},addTable:function(n,t,i){for(var r=-1,c=-1,v=0,f=0,l=0,b=0,k=0,y="",p=-1,w,a,d,e,h,o,s,u=t.from;t.to>=t.from?u<=t.to:u>=t.to;u=u+t.step)w=this.seatGrpIndex(i,t,u),w>=0&&f++,r==-1&&(r=w),a=this.seatSoldGrpIndex(i,t,u),a>=0&&(l++,p=a),c==-1&&(c=a),d=this.seatReservedGrpIndex(i,t,u),d>=0&&b++,v++,k++;if(e=$('<div class="seat '+this.seatClassName(r,c)+(" table"+k+"seats")+(b?" reserved":"")+'" ><span class="seatNumber">'+t.name+(f>0?"<br/>"+f:"")+"<\/span><\/div>"),p>=0)for(h=soldInfo[p],o=0;o<h.seats.length;o++)y=y+h.seats[o]+": "+h.buyers[o]+", Invoice: "+h.invoices[o]+"<br/>";s='<div class="label">'+"Table:".Localize()+'<\/div><div class="seatRowName">'+i.sectionName+"<\/div>";r>=0&&(s+='<div class="label">'+"Price:".Localize()+'<\/div><div class="seatPrice">'+currencySymbol+availInfo[r].price+(r>=0&&availInfo[r].charge!="-"?"<sub> + "+availInfo[r].charge+"<\/sub>":"")+"<\/div>");r>=0&&availInfo[r].handicap&&(s+='<div class="label">'+"Accessible".Localize()+"<\/div>");s+='<div class="seatStatus">Available: '+f+"<\/div>";soldInfo&&(s+='<div class="seatStatus">'+"Sold: ".Localize()+l+'<\/div><div class="" style="text-align:left;clear:both;">'+y+"<\/div>");e.data("tooltipcontent",s);n.append(e);e.attr("class").indexOf("price")>=0&&e.click(function(n){r>=0&&availInfo[r]&&HallMap.buyClick(e[0],availInfo[r],null,n.pageY,n)});i.totSeats+=v;this.totSeats+=v;r>=0&&(i.totAvail+=f,this.totAvail+=f);c>=0&&(i.totSold+=l,this.totSold+=l)},addSeatGroup:function(n,t,i){var s=0,h=0,c=0,l=[],r,u,a;typeof t.seatPosition=="undefined"&&(t.seatPosition={});var o=-15,f=30,e=30;for(r=t.from;t.to>=t.from?r<=t.to:r>=t.to;r=r+t.step)u=t.seatPosition[r],u||(u=t.seatPosition[r]={y:0,x:o+15}),u.y+12>e&&(e=u.y+12),u.x+12>f&&(f=u.x+12),o=o+15,this.addSeat(l,r,t,i);typeof i.shape=="undefined"&&(i.shape={w:30,h:30,y:15,x:0});i.shape.w+i.shape.x>f&&(f=i.shape.w+i.shape.x);i.shape.h+i.shape.y>e&&(e=i.shape.h+i.shape.y);a=$('<div style="width:'+(i.shape.w||50)+"px;height:"+(i.shape.h||50)+"px;left:"+(i.shape.x||0)+"px;top:"+(i.shape.y||0)+'px;" class="seatGroupShape  '+i.typeDetail+'" ><span class="shapeInner1"><\/span><span class="shapeInner2"><\/span><span class="sectionTitle">'+i.sectionName+"<\/span><\/div>");n.append(l.join(""));n.prepend(a);n.closest(".section").width(f+5);n.closest(".section").height(e+5);n.width(f+5);n.height(e+5);i.totSeats+=s;this.totSeats+=s;!1&&(i.totAvail+=h,this.totAvail+=h);!1&&(i.totSold+=c,this.totSold+=c)},hoverOut:function(){HallMap.tooltip.hide()},hoverIn:function(){},mouseover:function(n){var t,i,u,o,s,h,c,f,l,r,e,a;if(HallMap.prevHover!==n.target){if(HallMap.prevHover=n.target,t=$(n.target),HallMap.tooltip.hide(),i="",u=[0,0],t.hasClass("sectionTitle")&&t.parent().hasClass("GA")&&(t=$(".seat",t.parent())),t.hasClass("seat")){if(o=t.parents(".row").attr("data-r"),!o)return;t.data("tooltipcontent")?i=t.data("tooltipcontent"):(s=t.parents(".section").attr("data-sec"),h=t.parents(".sectionRow").attr("data-secr"),i=[],t.parents(".section").hasClass("Seat_Group")?i.push('<div style="text-align:center;font-weight:bold;">',hallSeatChart.secRows[h].sections[s].sectionName,"<\/div>"):i.push('<div class="label">'+"Row:".Localize()+'<\/div><div class="seatRowName">',hallSeatChart.secRows[h].sections[s].rows[o].name,"<\/div>"),i.push('<div class="label">'+"Seat:".Localize()+'<\/div><div class="seatNumber">',t.html(),"<\/div>"),t.attr("data-p")&&i.push(['<div class="label">'+"Price:".Localize()+'<\/div><div class="seatPrice">'+currencySymbol,t.attr("data-p"),t.attr("data-c")?"<sub> + "+t.attr("data-c")+"<\/sub>":"","<\/div>"].join("")),t.attr("data-handicap")&&i.push(['<div class="label">'+"Accessible".Localize()+"<\/div>"].join("")),c="",t.hasClass("sold")&&(f=1*t.attr("data-s"),l=HallMap.indexInArray(soldInfo[f].seats,t.html()),c=soldInfo[f].buyers[l]+", "+"Invoice: ".Localize()+soldInfo[f].invoices[l]),i.push(['<div class="seatStatus">',t.hasClass("na")?"Not Available".Localize():t.hasClass("sold")?"Sold to: ".Localize()+c:t.hasClass("block1")?"Blocked".Localize():"Available".Localize(),"<\/div>"].join("")),i=i.join(""))}else if(t.hasClass("sectionLevel")&&(!t.hasClass("notAvailSection")||soldInfo)&&!HallMap.mapScroll.hasClass("maximized"))i='<div class="clickToEnlarge">'+$(".clickToEnlarge",t).html()+"<\/div>",u=[40,0];else return;HallMap.tooltip.html(i);r=t.offset();e=HallMap.container.offset();e&&(r.left-=e.left,r.top-=e.top);a=1/HallMap.zoomFactor-1;HallMap.tooltip.css("left",(r.left+u[1])/HallMap.zoomFactor+18+HallMap.tooltip.width()*a/2);HallMap.tooltip.css("top",(r.top+0*u[0])/HallMap.zoomFactor+t.height()+HallMap.tooltip.height()*a/2);t.hasClass("na")?HallMap.tooltip.addClass("na"):HallMap.tooltip.removeClass("na");t.hasClass("sold")?HallMap.tooltip.addClass("sold"):HallMap.tooltip.removeClass("sold");t.hasClass("block1")?HallMap.tooltip.addClass("blocked"):HallMap.tooltip.removeClass("blocked");HallMap.tooltip.show()}},click:function(n){var t,i,s,u;if(!availInfo)return-1;if(t=$(n.target),t.hasClass("seatContainer")&&(t=t.closest(".row")),!t.hasClass("seat")&&!t.hasClass("row")){if(i=t.closest(".sectionLevel"),i.length>0&&(!i.hasClass("notAvailSection")||soldInfo)&&!i.hasClass("detailView")){if($(".row",i).length==0){i.hide();var y=i,a=$("div",i)[0],e=i.attr("data-sec"),o=i.closest(".sectionRow").attr("data-secr"),r=hallSeatChart.secRows[o].sections[e];r.totSeats=r.totAvail=r.totSold=0;HallMap.renderRows($(i[0]));HallMap.renderInfo($(a),r.totSeats,r.totAvail,r.totSold,!1,null,null);i.show()}HallMap.zoom();HallMap.prevZoomFactor=HallMap.zoomFactor;HallMap.setZoom(1);s=i.data("sectionWidth")*4+50;i.animate({width:s,left:$(window).width()/2-s/2},400,"swing",function(){i.addClass("detailView")})}return}if(!t.hasClass("na")&&!t.hasClass("sold")&&(!t.hasClass("row")||!t.hasClass("empty"))){var v=t.hasClass("row")?t.attr("data-r"):t.parents(".row").attr("data-r"),e=t.parents(".section").attr("data-sec"),o=t.parents(".sectionRow").attr("data-secr"),r=hallSeatChart.secRows[o].sections[e],h=r.rows[v],f=t.hasClass("seat")?t.html():null,c=null,l=0;for(u=0;u<availInfo.length;u++)if(availInfo[u].sectionRow==r.sectionRow&&availInfo[u].section==r.sectionName&&availInfo[u].row==h.name&&(!f||HallMap.indexInArray(availInfo[u].seats,f)>=0)&&(c=availInfo[u],l++,f))break;l==1?HallMap.buyClick(t[0],c,r.sellOrder||"ltr",0,n):t.hasClass("seat")&&t.hasClass("reserved")&&HallMap.ClickToUnreserve(r.sectionName,h.name,f);return}},zoom:function(){if(HallMap.mapScroll.toggleClass("maximized"),HallMap.mapScroll.hasClass("maximized"))$("body").css("overflow","hidden"),HallMap.resize(),$(".googleAd").hide(),$("#pressEsc").show().delay(1e4).fadeOut(1e3);else{$("body").css("overflow","");HallMap.mapScroll.css("height","");HallMap.mapScroll.css("width","");HallMap.scroll();$("#pressEsc").hide();var n=$(".sectionLevel.detailView");n.removeClass("detailView").css("display","").css("minWidth","").animate({width:n.data("originalWidth"),left:n.data("originalLeft")},400,"swing",function(){$("body").css("overflow","auto");$(".googleAd").show();HallMap.setZoom(HallMap.prevZoomFactor)})}},scroll:function(){},keypress:function(n){HallMap.mapScroll.hasClass("maximized")&&n.keyCode==27&&HallMap.zoom()},resize:function(){HallMap.mapScroll.hasClass("maximized")&&HallMap.mapScroll.css("height",$(window).height()).css("width",$(window).width())},cancelClick:function(){HallMap.activeSection!=null&&HallMap.activeSection.hide();HallMap.reserveOverlay.hide();HallMap.activeSection||HallMap.pageCover.hide()},getCountOptions:function(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},ClickToUnreserve:function(n,t,i){for(var e=$(".cUnreserveTicket"),u,f,r=0;r<e.length;r++)if(u=$(e[r]),f=u.parents("tr"),u.attr("data-eventid")==EventId&&$(".cSCSection",f).text().indexOf(n)>=0&&$(".cSCRow",f).text().indexOf(t)>=0&&$(".cSCSeat",f).text().indexOf(i,4)>=0){u.click();return}},buyClick:function(n,t,i,r,u){var f=HallMap,s,d,h,g,e,y,o,ot,b,v,it,rt;if(availInfo&&interactive){if(f.cSection.html(t.section),f.cRow.html(t.row),f.cPrice.html(String.format(currencySymbol+"{0}",t.price)),f.cGrpId.val(t.id),f.cGrpPrice.val(t.price),s=f.indexInPriceInfoIds(pricesInfo,t.eventSectionId),s<0&&(s=f.indexInPriceInfo(pricesInfo,t.price)),d=$(n).parents(".section"),h=d.hasClass("GA")?"ga":d.hasClass("table")?"table":d.hasClass("Seat_Group")?"Seat_Group":"rows",clickToBuy=h=="rows"&&exactSeatSelection&&!ShowSeatPreferencePopupForAdmins||h=="Seat_Group",clickToBuyShowPopUp=clickToBuy&&pricesInfo[s].levels&&pricesInfo[s].levels.length,f.cCount.html(""),g=pricesInfo[s].levels&&pricesInfo[s].levels.length,f.cCount.html(f.getCountOptions(t.avail,g,pricesInfo[s].min?pricesInfo[s]:null)),$(".reserveBody ",f.reserveOverlay).removeClass("pickSingle"),clickToBuyShowPopUp&&$(n).hasClass("seat")){for(e=pricesInfo[s],y="<p><b>"+"Click on one of the ticket types below to add to your cart:".Localize()+'<\/b><\/p><span class="cAddOne" title="'+e.desc+'"><i class="fa fa-circle-o fa-hover"><\/i>&nbsp;&nbsp;'+(e.min<=1?"":e.min+" * ")+currencySymbol+e.price+(e.fees==""?"":" <sub> +"+e.fees+"<\/sub>")+(e.title?" - ":" ")+e.title+"<\/span><br/>",o=0;o<e.levels.length;o++)y=y+'<span class="INeed">'+"Or".Localize()+'<\/span><select class="cTicketsNeeded_'+(o+1)+'">'+f.getCountOptions(t.avail,g,pricesInfo[s].levels?pricesInfo[s].levels[o]:null)+'<\/select><span class="cAddOne"  title="'+e.levels[o].desc+'"><i class="fa fa-circle-o  fa-hover"><\/i>&nbsp;&nbsp;'+(e.levels[o].min<=1?"":e.levels[o].min+" * ")+currencySymbol+e.levels[o].price+(e.levels[o].fees==""?"":" <sub> +"+e.levels[o].fees+"<\/sub>")+(e.levels[o].title?" - ":" ")+e.levels[o].title+"<\/span><br/>";$(".cPriceLevelRequest",f.reserveOverlay).html(y);$(".cPriceLevelRequest",f.reserveOverlay).show();$(".reserveBody ",f.reserveOverlay).addClass("pickSingle");$(".cPriceLevelRequest span",f.reserveOverlay).tooltip({content:function(){var n=$(this);return n.attr("title")}});$(".pickSingle .cAddOne",f.reserveOverlay).click(function(){var t=$(this),n=t.prev("select");n.length||(n=$("#cCount",f.reserveOverlay));$("option:nth-child(2)",n).prop("selected",!0);$("#cHallMapAddToCart",f.reserveOverlay).click()})}else if(pricesInfo[s].levels){for(e=pricesInfo[s],y='<span title="'+e.desc+'">'+currencySymbol+e.price+(e.fees==""?"":" <sub> +"+e.fees+"<\/sub>")+(e.title?" - ":" ")+e.title+"<\/span><br/>",o=0;o<e.levels.length;o++)y=y+'<span class="INeed">'+"and".Localize()+'<\/span><select class="cTicketsNeeded_'+(o+1)+'">'+f.getCountOptions(t.avail,g,pricesInfo[s].levels?pricesInfo[s].levels[o]:null)+'<\/select><span title="'+e.levels[o].desc+'">'+currencySymbol+e.levels[o].price+(e.levels[o].fees==""?"":" <sub> +"+e.levels[o].fees+"<\/sub>")+(e.levels[o].title?" - ":" ")+e.levels[o].title+"<\/span><br/>";$(".cPriceLevelRequest",f.reserveOverlay).html(y);$(".cPriceLevelRequest",f.reserveOverlay).show();$(".cPriceLevelRequest span",f.reserveOverlay).tooltip({content:function(){var n=$(this);return n.attr("title")}})}else $(".cPriceLevelRequest",f.reserveOverlay).hide();f.cPreference.html("");var p=!1,w=!1,nt="left";if(h=="rows"||h=="Seat_Group"){var c=$(u.target).closest(".row"),ut=$(".sectionName",$(u.target).closest(".section")),tt=u.pageX-c.offset().left,k=$(".seat:not(.na)",c),l=$(k[0]).offset().left-c.offset().left,a=$(k[k.length-1]).offset().left-c.offset().left,ft=$(k[0]).offset().top-c.offset().top,et=$(k[k.length-1]).offset().top-c.offset().top;Math.abs(l-a)<Math.abs(ft-et)?(l=ft,a=et,tt=u.pageY-c.offset().top,p=!0,w=c.offset().left>ut.offset().left):w=c.offset().top<ut.offset().top;a<l&&(ot=a,a=l,l=ot);a=a+$(".seat:not(.na)",c).width();tt-=l;a-=l;l=0;nt=tt<(l+a)/3?w?"right":"left":tt>2*(l+a)/3?w?"left":"right":"center"}b=w?p?"▼ "+"Bottom".Localize():" ► "+"Right".Localize():p?"▲ "+"Top".Localize():"◄ "+"Left".Localize();v=$('<option value="'+(i=="rtl"?2:0)+'"'+(!clickToBuy&&nt=="left"?' selected="selected" ':"")+">"+String.format(" {0} of the row".Localize(),b)+"<\/option>");f.cPreference.append(v);v=$('<option value="1" '+(!clickToBuy&&nt=="center"?' selected="selected" ':"")+" >"+"Center of the row".Localize()+"<\/option>");f.cPreference.append(v);b=w?p?"▲ "+"Top".Localize():"◄ "+"Left".Localize():p?"▼ "+"Bottom".Localize():" ► "+"Right".Localize();v=$('<option value="'+(i=="rtl"?0:2)+'"'+(!clickToBuy&&nt=="right"?' selected="selected" ':"")+">"+String.format(" {0} of the row".Localize(),b)+"<\/option>");f.cPreference.append(v);(exactSeatSelection||clickToBuy)&&$(n).hasClass("seat")&&(it=$(n).prev(".seat"),rt=it.length==0||it.attr("class")!=$(n).attr("class"),b=w?p?"▼ "+"Bottom".Localize():" ► "+"Right".Localize():p?"▲ "+"Top".Localize():"◄ "+"Left".Localize(),v=$('<option value="'+(i=="rtl"?4:3)+'"'+(clickToBuy&&!rt?' selected="selected" ':"")+" >"+String.format(" {0} of the row".Localize(),b)+"<\/option>"),f.cPreference.append(v),b=w?p?"▲ "+"Top".Localize():"◄ "+"Left".Localize():p?"▼ "+"Bottom".Localize():" ► "+"Right".Localize(),v=$('<option value="'+(i=="rtl"?3:4)+'"'+(clickToBuy&&rt?' selected="selected" ':"")+'">'+String.format(" {0} of the row".Localize(),b)+"<\/option>"),f.cPreference.append(v),f.cSelectedSeat.val($(n).text()));f.activeSection&&f.activeSection.length>0&&f.activeSection.css("z-index","99900");$(".cSeatPreferenceContainer",f.reserveOverlay)[h=="rows"?"show":"hide"]();$(".cSectionTypeName",f.reserveOverlay).text(h=="ga"?"Section".Localize():h=="table"?"Table".Localize():"Row".Localize());$("#cRowLabel,#cRow",f.reserveOverlay)[h=="rows"?"show":"hide"]();$("#cSectionLabel",f.reserveOverlay).text(h=="table"?"Table:".Localize():"Section:".Localize());clickToBuy&&$(n).hasClass("reserved")?f.ClickToUnreserve(t.section,h=="Seat_Group"?"":t.row,$(n).text()):clickToBuy&&!clickToBuyShowPopUp&&$(n).hasClass("seat")?$("#cHallMapAddToCart").click():(HallMap.pageCover.show(),f.reserveOverlay.css("top",r||$(n).offset().top-100).css("position","absolute").css("left",($(window).width()-f.reserveOverlay.width())/2).css("margin-left",0),f.reserveOverlay.show())}},sectionClick:function(n){if($this=$(n.target),HallMap.preventSectionClick==!0){HallMap.preventSectionClick=!1;return}HallMap.activeSection&&HallMap.activeSection.removeClass("active");$this.addClass("active");var t=$(window).width()-160;HallMap.activeSection=$this;HallMap.activeSection.title="Click to buy tickets in this row".Localize();HallMap.pageCover.css("display","block");$this.animate({left:25,width:t},500,null)},closeClick:function(){HallMap.activeSection!=null&&(HallMap.pageCover.hide(),HallMap.preventSectionClick=!0,HallMap.activeSection.removeClass("active").css("left","").css("width",""),HallMap.activeSection=null)}},HallMap.init(),HallMap.Render(),window.hallMapEditorLoaded?HallMapEditor.initialize():window.hallMapRendered=!0)})