function HistogramController(data,hwidth,hide_bars,opts){this.create(data,hwidth,hide_bars,opts);};HistogramController.prototype={create:function(data,hwidth,hide_bars,opts){var buckets=data.pluck('table');var options=this.options={buckets:buckets};this.histogram_id='#'+opts.id;this.rawId=opts.id;$(this.histogram_id).append('<div class="canvas">');$(this.histogram_id+' .canvas').css({width:hwidth+"px",height:"30px"});if(hide_bars){$(this.histogram_id).css({top:'-12px'})
$(this.histogram_id+' .canvas').css({height:"34px"});}
if(!data.length)return;var bucketWidth=this.draw(buckets,data,hwidth,hide_bars);this.addLabels(buckets,bucketWidth,hwidth,opts);this.initToolTips();},draw:function(buckets,data,hwidth,hide_bars){var self=this;var sidePadding=6;var x=0+sidePadding,bucketCount=buckets.length,columnPadding=2,bucketWidth=(hwidth-x-sidePadding-(columnPadding*(bucketCount-1)))/bucketCount,maxCount=buckets.pluck('count').max(),gapSize=buckets[1].min;var i=0;buckets.each(function(bucket){var h=18*bucket.count/maxCount;bucket.x=x;if(hide_bars!=true){var e=document.createElement('div');var padding=h==0?0:4;var cssObj={left:x+'px',width:bucketWidth+'px',top:35-(h+padding)+'px',height:(h+padding)+'px'};if(fsTop.colors){cssObj.backgroundColor='#'+fsTop.colors[i];}
$(e).addClass('bar').css(cssObj);$(e).attr('id',self.rawId+'_'+bucket.min+'_'+(bucket.min+gapSize)+'_'+bucket.count);$(self.histogram_id).append(e);i++;}
x+=bucketWidth+columnPadding;});$(this.histogram_id).append('<div class="hbTip">$<span class="hbTipLow"></span> - $<span class="hbTipHigh"></span></div>');},addLabels:function(buckets,bucketWidth,hwidth,opts){var self=this;$(this.histogram_id).css({position:'relative'});var i=0;min=buckets.pluck('min').min();max=buckets.pluck('min').max();if(buckets.length>1){max=max+buckets[1].min-buckets[0].min;}
else{max=min*2;}
HistogramSlider.create({min:min,max:max,minPrice:opts.minPrice,maxPrice:opts.maxPrice,stepping:1,onchange:function(x0,x1){$(self.histogram_id).trigger('sliderValues',[x0,x1]);},onslide:function(x0,x1){$(self.histogram_id).trigger('onSlide',[x0,x1]);},width:hwidth,histogram_id:self.histogram_id});},initToolTips:function(){var self=this;$(this.histogram_id+' .bar').bind('mouseenter',function(){var hbTip=$(self.histogram_id+' > .hbTip');var splitted_id=this.id.replace(self.rawId+'_','').split('_');;var priceLow=splitted_id[0];var priceHigh=splitted_id[1];var offsetTop=Math.max(this.offsetTop-hbTip.height()-4,9);var offsetLeft=Math.min(75,($(this).width()/2+this.offsetLeft)-(hbTip.width()/2));$(self.histogram_id+' .hbTipLow').html(priceLow);$(self.histogram_id+' .hbTipHigh').html(priceHigh);hbTip.css({top:offsetTop,left:offsetLeft});hbTip.show();});$(this.histogram_id).bind('mouseleave',function(){$(self.histogram_id+'> .hbTip').hide();});}}
var HistogramSlider={create:function(options){var hwidth=options.width;$(options.histogram_id).append('<div class="ui-slider-2 histogram-slider"></div>');var slider=$(options.histogram_id).children('.histogram-slider');slider.css({width:hwidth+"px"});slider.slider({min:options.min,max:options.max,range:true,values:[options.minPrice,options.maxPrice],change:function(e,ui){options.onchange(ui.values[0],ui.values[1]);if(!e.originalEvent){options.onslide(ui.values[0],ui.values[1]);}},slide:function(e,ui){options.onslide(ui.values[0],ui.values[1]);}});}}
var Slider={create:function(options){var self=this;this.options=options;var slider=$('#'+this.options.slider_id);slider.css({width:this.options.width});slider.slider({stepping:self.options.stepping,min:self.options.min,max:self.options.max+self.options.max*.1,handles:[{start:options.minValue},{start:options.maxValue}],range:true,change:function(e,ui){var x0=Math.round(slider.slider('value',0)),x1=Math.round(slider.slider('value',1));slider.trigger('sliderValues',[x0,(x1>self.options.max?Infinity:x1)]);},slide:function(e,ui){if(ui.handle.attr('id')=='slider_handle_left'){$('#'+self.options.from_id).val('$'+String(ui.value));}else
{$('#'+self.options.to_id).val((ui.value>self.options.max?'Max':'$'+String(ui.value)));}}});this.label(this.options.slider_id,this.options.min,this.options.max,this.options.width);},label:function(slider_id,min,max,width){var left_label=document.createElement('div');var right_label=document.createElement('div');$(left_label).addClass('price_label').html('$'+String(min)).css({position:'absolute',left:'0px',top:'5px'});$(right_label).addClass('price_label').html('$'+String(max)+'+').css({position:'absolute',left:width+'px',top:'5px'});var slider=$('#'+slider_id);slider.append(left_label);slider.append(right_label);$(right_label).css({left:width-$(right_label).width()+'px'});}}
var ATOverlay=function(marker,className,offset,html,opts){this.marker=marker;this.html=html;this.className=className;this.offset=offset;this.opts=opts;}
ATOverlay.prototype=typeof(GOverlay)=='undefined'?Object:new GOverlay();ATOverlay.prototype.initialize=function(map){var div=document.createElement("div");div.className=this.className;div.innerHTML=this.html;var markerPos=map.fromLatLngToDivPixel(this.marker.getPoint());div.style.top=(markerPos.y+this.offset.y)+'px';div.style.left=(markerPos.x+this.offset.x)+'px';this.map=map;this.div=div;this.div.style.visibility='hidden';map.getPane(G_MAP_FLOAT_PANE).appendChild(div);var ratio=1/2;if(this.opts){ratio=this.opts.ratio?this.opts.ratio:ratio;}
this.ne={x:markerPos.x+(div.offsetWidth*(1-ratio))+10,y:markerPos.y-div.offsetHeight};this.sw={x:markerPos.x-(div.offsetWidth*ratio),y:markerPos.y};this.nePoint=new GPoint(this.ne.x+5,this.ne.y-65);this.swPoint=new GPoint(this.sw.x-5,this.sw.y+5);div.style.top=this.ne.y+this.offset.y+'px';this.div.style.visibility='visible';}
ATOverlay.prototype.remove=function(){this.div.parentNode.removeChild(this.div);}
ATOverlay.prototype.redraw=function(force){}
ATOverlay.prototype.getNE=function(){return this.nePoint;}
ATOverlay.prototype.getSW=function(){return this.swPoint;}
ATMarker.nextMarkerId=0;ATMarker.currentOverlay=null;ATMarker.openSummary=null;ATMarker.sMarks=new Array();ATMarker.noCache=false;ATMarker.summaryOffset={ne:{x:-255,y:50},se:{x:-255,y:10},sw:{x:10,y:10},nw:{x:10,y:50}};ATMarker.clearOverlays=function(){ATMarker.closeDetails();ATMarker.closeSummary();for(var i=0;i<ATMarker.sMarks.length;i++){ATMarker.sMarks[i].clearContent();}};ATMarker.closeDetails=function(){if(ATMarker.currentOverlay)
ATMarker.currentOverlay.hideDetails();};ATMarker.closeSummary=function(){if(ATMarker.openSummary)
ATMarker.openSummary.hideSummary();};ATMarker.stopEventBubble=function(ev){var is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));if(is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}
return false;};ATMarker.prototype=typeof(GMarker)=='undefined'?Object:new GMarker(new GLatLng(1,1));function ATMarker(map,latlng,icon){this.map=map;this.latlng=latlng;this.icon=icon;this.internalId=ATMarker.nextMarkerId++;this.detailsContentCB=null;this.summaryContentCB=null;this.waitingContentCB=null;this.reviewsContentCB=null;this.openCB=null;this.closeCB=null;this.superClass=GMarker;this.superClass(latlng,icon);if(!this.bound){GEvent.bindDom(this,"mouseover",this,this.showSummary);GEvent.bindDom(this,"mouseout",this,this.hideSummary);GEvent.bindDom(this,"click",this,this.handleClick);GEvent.bindDom(this,"dblclick",this,this.handleDblClick);this.bound=true;}
if(!ATMarker.zoomListener){var self=this;ATMarker.zoomListener=GEvent.bind(this.map,"zoomend",this,function(z1,z2){if(z1!=z2)
ATMarker.closeDetails();});}
ATMarker.sMarks.push(this);};ATMarker.prototype.setDetailsContent=function(cb){this.detailsContentCB=cb;};ATMarker.prototype.setSummaryContent=function(cb){this.summaryContentCB=cb;};ATMarker.prototype.setWaitingContent=function(cb){this.waitingContentCB=cb;};ATMarker.prototype.setReviewsContent=function(cb){this.reviewsContentCB=cb;};ATMarker.prototype.setOpenCB=function(cb){this.openCB=cb;};ATMarker.prototype.setCloseCB=function(cb){this.closeCB=cb;};ATMarker.prototype.clearContent=function(){if(this.detailsOverlay){delete this.detailsOverlay;this.detailsOverlay=null;}
if(this.summaryOverlay){delete this.summaryOverlay;this.summaryOverlay=null;}
if(this.reviewsOverlay){delete this.reviewsOverlay;this.reviewsOverlay=null;}};ATMarker.prototype.hideSummary=function(){if(ATMarker.openSummary&&ATMarker.openSummary==this&&ATMarker.openSummary.summaryOverlay){if(this.closeCB)
this.closeCB(ATMarker.openSummary.data,'summary');this.map.removeOverlay(ATMarker.openSummary.summaryOverlay);ATMarker.openSummary=null;}};ATMarker.prototype.showSummary=function(){var hideOnly=ATMarker.openSummary==this;if(ATMarker.openSummary){ATMarker.openSummary.hideSummary();}
if(hideOnly||this.detailsVisible)
return;if(this.openCB)
this.openCB(this.data,'summary');var center=this.map.getCenter();var point=this.getLatLng();var top=(center.lat()-point.lat())<=0;var left=(center.lng()-point.lng())>=0;if(!this.summary){this.summary={};}
var vfsReady=SeatsPageController.ugcMgr.isVfsReady();if(!this.summaryData){this.summaryData="";if(this.summaryContentCB){var tixInfo=this.summaryContentCB(this.data);this.summaryData="<div class='marker-det-base'>"+tixInfo+"</div>";}}
if(top&&left){if(!this.summary.nwOverlay||this.noCache){this.summary.nwOverlay=new ATOverlay(this,"marker-det-cont",ATMarker.summaryOffset.nw,this.summaryData)}
this.summaryOverlay=this.summary.nwOverlay;}else if(top&&!left){if(!this.summary.neOverlay||this.noCache){this.summary.neOverlay=new ATOverlay(this,"marker-det-cont",ATMarker.summaryOffset.ne,this.summaryData)}
this.summaryOverlay=this.summary.neOverlay;}else if(!top&&!left){if(!this.summary.seOverlay||this.noCache){this.summary.seOverlay=new ATOverlay(this,"marker-det-cont",ATMarker.summaryOffset.se,this.summaryData)}
this.summaryOverlay=this.summary.seOverlay;}else if(!top&&left){if(!this.summary.swOverlay||this.noCache){this.summary.swOverlay=new ATOverlay(this,"marker-det-cont",ATMarker.summaryOffset.sw,this.summaryData)}
this.summaryOverlay=this.summary.swOverlay;}
if(!vfsReady){this.summaryData=null;}
ATMarker.openSummary=this;this.map.addOverlay(this.summaryOverlay);};ATMarker.prototype.hideDetails=function(){if(ATMarker.currentOverlay&&ATMarker.currentOverlay==this){if(this.closeCB)
this.closeCB(ATMarker.currentOverlay.data,'summary');if(ATMarker.currentOverlay.detailsOverlay)
this.map.removeOverlay(ATMarker.currentOverlay.detailsOverlay);if(ATMarker.currentOverlay.waitingOverlay)
this.map.removeOverlay(ATMarker.currentOverlay.waitingOverlay);if(ATMarker.currentOverlay.reviewsOverlay)
this.map.removeOverlay(ATMarker.currentOverlay.reviewsOverlay);ATMarker.currentOverlay=null;this.detailsVisible=false;}};ATMarker.prototype.handleDblClick=function(latlng){this.map.setCenter(latlng);this.map.zoomIn();};ATMarker.prototype.handleClick=function(){this.hideSummary();var hideOnly=ATMarker.currentOverlay==this;if(ATMarker.currentOverlay){ATMarker.currentOverlay.hideDetails();}
if(this.reset){this.clearContent();this.reset=false;}
if(hideOnly)
return;if(!this.data.node.isLoaded()){var self=this;this.showWaiting();this.data.model.loadNodeData(this.data.node,function(){self.hideSummary();if(ATMarker.currentOverlay){ATMarker.currentOverlay.hideDetails();}
self.showDetails();});}else{this.showDetails();}};ATMarker.prototype.hideReviews=function(){if(ATMarker.currentOverlay){ATMarker.currentOverlay.hideDetails();}
if(this.reset){this.clearContent();this.reset=false;}
if(!this.data.node.isLoaded()){var self=this;this.showWaiting();this.data.model.loadNodeData(this.data.node,function(){if(ATMarker.currentOverlay){ATMarker.currentOverlay.hideDetails();}
self.showDetails();});}else{this.showDetails();}};ATMarker.prototype.handleReviewsClick=function(){var revOverlay=this.reviewsOverlay;if(this.reset||!revOverlay){var tixInfo="";var revInfo="";var isEmpty=false;if(this.detailsContentCB){if((tixInfo=this.detailsContentCB(this.data))==null){tixInfo="<div class='map-det-sorry'><div class='tooltip'>"+"<div class='tooltip-top'>Sorry. No ticket sets<br/>match your refinement options.</div>"+"<div class='tooltip-btm-short'></div></div></div>";isEmpty=true;}
tixInfo=tixInfo.replace('scrollwrapper','scrollwrapper-tall');}
var self=this;if(this.reviewsContentCB){revInfo=this.reviewsContentCB(this.data,function(revs){self.cachedRevs=revs;$(".ugc-review-body-holder").html(revs);});}
var html="<div onmousedown='ATMarker.stopEventBubble(event)' class='marker-det-base-wide' style='width: 612px'>"+
tixInfo+revInfo+"</div>";var offset=isEmpty?{x:-100,y:-30}:{x:-135,y:-30};revOverlay=new ATOverlay(this,"marker-det-cont",offset,html,{ratio:1/4});}
if(ATMarker.currentOverlay)
ATMarker.currentOverlay.hideDetails();if(this.reset){this.clearContent();this.reset=false;}
this.reviewsOverlay=revOverlay;if(this.openCB)
this.openCB(this.data,'reviews');ATMarker.currentOverlay=this;this.map.addOverlay(this.reviewsOverlay);if(this.cachedRevs){$(".ugc-review-body-holder").html(this.cachedRevs);}
this.panTo_(this.reviewsOverlay);this.detailsVisible=true;$(".sec-rev-msg").hide();$(".map-det-top > a").hide();this.panTo_(this.reviewsOverlay);};ATMarker.prototype.showDetails=function(){if(this.openCB)
this.openCB(this.data,'details');if(!this.detailsOverlay){var tixInfo="";if(this.detailsContentCB){tixInfo=this.detailsContentCB(this.data);}
var html="<div onmousedown='ATMarker.stopEventBubble(event)' class='marker-det-base'>"+tixInfo+"</div>";this.detailsOverlay=new ATOverlay(this,"marker-det-cont",{x:-135,y:-30},html);}
ATMarker.currentOverlay=this;this.map.addOverlay(this.detailsOverlay);this.panTo_(this.detailsOverlay);this.detailsVisible=true;var self=this;$(".sec-rr-link").click(function(){self.handleReviewsClick();});};ATMarker.prototype.showWaiting=function(){if(!this.waitingOverlay){var waiting="";if(this.waitingContentCB)
waiting=this.waitingContentCB(this.data);var html="<div onmousedown='ATMarker.stopEventBubble(event)' class='marker-det-base'>"+waiting+"</div>";var offset={x:-135,y:-30};this.waitingOverlay=new ATOverlay(this,"marker-det-cont",offset,html);}
ATMarker.currentOverlay=this;this.map.addOverlay(this.waitingOverlay);$(".sec-rev-msg").hide();this.panTo_(this.waitingOverlay);this.detailsVisible=true;};ATMarker.prototype.panTo_=function(overlay){var canvNE=this.map.getBounds().getNorthEast();var zoomHeight=10;var popDivCoords=overlay.getNE();popDivCoords.y-=zoomHeight;var popNE=this.map.fromDivPixelToLatLng(popDivCoords);var lat=Math.min(canvNE.lat()-popNE.lat(),0);var lng=Math.min(canvNE.lng()-popNE.lng(),0);if(lng==0){var canvSW=this.map.getBounds().getSouthWest();var popDivCoords=overlay.getSW();var filterWidth=30;popDivCoords.x-=filterWidth;var popSW=this.map.fromDivPixelToLatLng(popDivCoords);lng=Math.max(canvSW.lng()-popSW.lng(),0);}
if(lat!=0||lng!=0){var center=this.map.getCenter();this.map.panTo(new GLatLng(center.lat()-lat,center.lng()-lng));}}
fsTop.debugEnabled=false;function debug(str){if(fsTop.debugEnabled){var name='debug';var elem=document.getElementById(name);if(elem){elem.innerHTML+="<br/>"+str;elem.scrollTop=100000;}}}
function examine(o){for(var k in o){if(typeof(o[k])!='function'){debug(k+': '+o[k]+' ('+typeof(o[k])+')');}}}
function pluralLabel(cnt,single,plural){if(cnt==1)
return single;return plural;}
function TicketSetFilter(opts){cnt=Math.max(0,Math.min(opts.cnt,10));min=opts.min;max=opts.max;if(!opts.min||opts.min<=0)min=0;if(!opts.max||opts.max>=999999)max=Infinity;this.priceRange={min:min,max:max};this.quantity=cnt;this.providers=new StringSet();this.providers.addList(opts.providers);this.sections=new StringSet();this.sections.addList(opts.sections);this.areas=new StringSet();this.areas.addList(opts.areas);this.originalParams={cnt:cnt,min:min,max:max};}
TicketSetFilter.prototype={addListener:function(callback){$(this).bind('change',callback)},changed:function(){$(this).trigger('change')},save:function(){this.savedPriceRange={min:this.priceRange.min,max:this.priceRange.max};this.savedQuantity=this.quantity;this.savedProviders=new StringSet();this.savedProviders.addAll(this.providers);this.savedSections=new StringSet();this.savedSections.addAll(this.sections);this.savedAreas=new StringSet();this.savedAreas.addAll(this.areas);},restore:function(){this.priceRange.min=this.savedPriceRange.min;this.priceRange.max=this.savedPriceRange.max;this.quantity=this.savedQuantity;this.providers=new StringSet();this.providers.addAll(this.savedProviders);this.sections=new StringSet();this.sections.addAll(this.savedSections);this.areas=new StringSet();this.areas.addAll(this.savedAreas);},reset:function(){this.priceRange={min:0,max:Infinity};this.quantity=0;this.providers.clear();this.sections.clear();this.areas.clear();this.changed();},isEmpty:function(){return this.priceRange.min==0&&this.priceRange.max==Infinity&&this.quantity==0&&this.providers.count==0&&this.sections.count==0&&this.areas.count==0;},makeKey:function(){return this.priceRange.min+"_"+this.priceRange.max+"_"+
this.quantity+"_"+this.providers.toArray().join('.')+"_"+
this.sections.toArray().join('.')+"_"+
this.areas.toArray().join('.');},makeParams:function(useIds){var params="";if(this.priceRange.min!=0)
params+="_fmin="+this.priceRange.min+"&";if(this.priceRange.max!=Infinity)
params+="_fmax="+this.priceRange.max+"&";if(this.quantity>0)
params+="_fqty="+this.quantity+"&";if(this.providers.count>0)
params+="_fbrk="+this.providers.toArray().join(',')+"&";if(this.sections.count>0){if(useIds){params+="_fsids="+this.sections.toArray().join(',')+"&";}else{params+="_fsec="+this.sections.toArray().join(',')+"&";}}
if(this.areas.count>0){if(useIds){params+="_faids="+this.areas.toArray().join(',')+"&";}else{params+="_fars="+this.areas.toArray().join(',')+"&";}}
return params;},makeIndexParams:function(){var params="";if(this.priceRange.min!=0)
params+="seat_stat[min_price]="+this.priceRange.min+"&";if(this.priceRange.max!=Infinity)
params+="seat_stat[max_price]="+this.priceRange.max+"&";if(this.quantity>0)
params+="seat_stat[seat_count]="+this.quantity+"&";if(this.providers.count>0)
params+="brks[]="+this.providers.toArray().join('&brks[]=')+"&";if(this.sections.count>0)
params+="secs[]="+this.sections.toArray().join('&secs[]=')+"&";if(this.areas.count>0)
params+="areas[]="+this.areas.toArray().join('&areas[]=')+"&";return params;},getPriceRange:function(){return this.priceRange;},clearPriceRange:function(){this.setPriceRange(0,Infinity);},setPriceRange:function(min,max){this.priceRange={min:min,max:max};this.changed();},getQuantity:function(){return this.quantity;},setQuantity:function(qty){this.quantity=qty;this.changed();},clearProviders:function(){this.providers.clear();this.changed();},addProvider:function(p){this.providers.add(p);this.changed();},removeProvider:function(p){this.providers.remove(p);this.changed();},clearSections:function(){this.sections.clear();this.changed();},addSection:function(p){this.sections.add(p);this.changed();},removeSection:function(p){this.sections.remove(p);this.changed();},clearAreas:function(){this.areas.clear();this.changed();},addArea:function(p){this.areas.add(p);this.changed();},removeArea:function(p){this.areas.remove(p);this.changed();},getProviders:function(){return this.providers;},getSections:function(){return this.sections;},getAreas:function(){return this.areas;},set:function(propertyName,value){this[propertyName]=value;this.changed();},containsTicketSet:function(set){var priceRange=set.priceRange;var providers=set.providers;var sections=set.sections;var area=set.area;var splits=set.splits;var deals=set.deals;var inPriceRange=false;if(deals){for(var i=0,size=deals.length;i<size;++i){inPriceRange=(deals[i].displayPrice>=this.priceRange.min&&deals[i].displayPrice<=this.priceRange.max)
if(inPriceRange)
break;}}else{inPriceRange=priceRange.min<=this.priceRange.max&&priceRange.max>=this.priceRange.min;}
var match=(this.quantity==0||splits.contains(this.quantity))&&inPriceRange&&((this.areas.count==0&&this.sections.count==0)||(this.areas.count>0&&this.areas.contains(area))||(this.sections.count>0&&this.setMatch(sections,this.sections)))&&this.setMatch(providers,this.providers);return match==true;},setMatch:function(avail,set){if(set.count>0){if(avail&&avail.count>0){return avail.containsAny(set);}
return false;}
return true;},toString:function(){return"{priceRange:{min:"+this.priceRange.min+",max:"+this.priceRange.max+"},"+"quantity:"+this.quantity+",providers:["+this.providers+"],"+"areas:["+this.areas+"],sections:["+this.sections+"]}";}};var Pingout={fakePingout:null,call:function(ts,dealId,qty,ctx,event,chName,cb){var poctx=event?event.serScores():"";var self=this;$.ajax({async:true,url:'/checkout/ajax_verify_availability',type:'get',dataType:'json',data:{nolo:true,poctx:poctx,ticket_set_id:dealId,quantity:qty,price:ts.getSalePrice(dealId),ch:chName},success:function(data_,status){var data=data_;if(self.fakePingout){data=self.getFakePingoutData();}else{PageUet.rec("ev=podata:"+data.status);}
cb(data);},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);cb({status:'ERROR'})}});},getFakePingoutData:function(){var status=this.fakePingout;switch(status){case'SOLD_OUT':return{status:'SOLD_OUT'};case'PRICE_CHANGED':return{status:'PRICE_CHANGED',newPrice:10.50};case'PRICE_CHANGED_UP':return{status:'PRICE_CHANGED',newPrice:9999.50};case'QUANTITY_CHANGED':return{status:'QUANTITY_CHANGED',newSplit:[1,2,3,4]};case'PRICE_AND_QUANTITY_CHANGED':return{status:'PRICE_AND_QUANTITY_CHANGED',newPrice:99.30,newSplit:[1,2,3,4]}
case'BAD_BROKER_PARAMETERS':return{status:'BAD_BROKER_PARAMETERS',input:{brokerId:100}};case'ERROR':return{status:'ERROR'};}
return{status:'CONTINUE'};}};var Survey={call:function(params){$.ajax({url:'/seats/record_survey',type:'get',dataType:'json',data:params,success:function(data_,status){},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);}});}};var SmartAlert={submitAlert:function(events,filter,location,email,authToken){var data='type=seat_query&';for(var i=0;i<events.length;i++){data+=('event_ids[]='+events[i].id+'&');}
data+='email='+email+'&authenticity_token='+authToken+'&'+filter.makeParams(SeatsPageController.useIds);$.ajax({url:location,dataType:'json',type:'POST',data:data,success:function(data,status){$('#alertProgress').hide();if(data.status=='NOT_LOGGED_IN'){alert('Authenication failed');}else{$('#alertSuccess').show();}},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);}});},reactivateAlert:function(alertId){$('#seats-alert-empty').html('<span>Reactivating alert...</span><img src="/images/loading-32-onwhite.gif" width="16"/>');$.ajax({url:'/alerts/reactivate/'+alertId,dataType:'json',type:'POST',data:{dummy:1},success:function(data,status){if(data.status=='SUCCESS'){$('#seats-alert-empty').html("Your FanSnap Alert has been reactivated. We'll send you an email when tickets become available for this event.");}},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);}});}};function Geometry(polygons,marker){this.polygons=polygons;if(polygons&&polygons.length>0){markerPoly=polygons[0];if(marker){markerPoly=marker;}
this.marker=this.centroid(markerPoly);}};Geometry.prototype={centroid:function(poly){var x=0;var y=0;if(poly){var n=poly.length;for(var i=0;i<n;i++){x+=poly[i].x;y+=poly[i].y;}
return{x:(x/n),y:(y/n)};}
else return{x:0,y:0};}};ListFilter.prototype={findChecked:function(){var checkBoxes=$('div#'+this.divId+' input.'+this.inputClass+':checkbox');for(var i=0;i<checkBoxes.length;i++){var mainValue=checkBoxes[i].value;if(checkBoxes[i].checked){this.inputValues.add(mainValue);}
if(this.childInputClass){var checkedChildren=$(checkBoxes[i]).nextAll('ul').find('input:checkbox:checked');for(var j=0;j<checkedChildren.length;j++){this.childInputValues[mainValue].values.add(checkedChildren[j].value);}}}},doTrigger:function(){if(this.inputValues.count==this.totalCheckBoxes){this.callback.call(this,null);}else{if(this.childInputClass){var childrenValues=new StringSet();for(var k in this.childInputValues){if(this.childInputValues[k].values.count>0&&(!this.useIds||this.childInputValues[k].count>this.childInputValues[k].values.count)){childrenValues.addAll(this.childInputValues[k].values);}}
this.callback.call(this,this.inputValues,childrenValues);}else{this.callback.call(this,this.inputValues);}}},reset:function(){$('div#'+this.divId+' input').attr('checked','checked');this.findChecked();},clear:function(){$('div#'+this.divId+' input').attr('checked','');this.clearInternal();},clearInternal:function(){this.inputValues.clear();for(var k in this.childInputValues){this.childInputValues[k].values.clear();}},resetToUI:function(){this.clearInternal();this.findChecked();},bindEvents:function(){var self=this;$('li.moreFiltersProviders').click(function(e){$('#brokerFilterModal').jqmShow();});$('li.moreFiltersAreasec').click(function(e){$('#arsecFilterModal').jqmShow();});$('div#'+this.divId).click(function(e){if(e.target.nodeName=='SPAN'&&e.target.className.match('expandable')){$(e.target).siblings('ul').toggle();$(e.target).toggleClass('expanded');}else if(e.target.nodeName=='A'&&e.target.className=='selectNone'){self.clear();return false;}
else if(e.target.nodeName=='A'&&e.target.className=='selectAll'){$('div#'+self.divId+' input').attr('checked','checked');self.findChecked();self.doTrigger();return false;}else if(e.target.nodeName=='INPUT'){if(e.target.checked){if(e.target.className==self.inputClass){self.inputValues.add(e.target.value);if(self.childInputClass){var childCheckBoxes=$(e.target).siblings('ul').find('input');for(var i=0;i<childCheckBoxes.length;i++){childCheckBoxes[i].checked=true;self.childInputValues[e.target.value].values.add(childCheckBoxes[i].value);}}}else if(e.target.className==self.childInputClass){var parentCheckBox=$(e.target).parent().parent().siblings('input:checkbox');self.childInputValues[parentCheckBox.val()].values.add(e.target.value);if(self.childInputValues[parentCheckBox.val()].count>0&&self.childInputValues[parentCheckBox.val()].values.count==self.childInputValues[parentCheckBox.val()].count){parentCheckBox.attr('checked','checked');self.inputValues.add(parentCheckBox.val());}}}else
{if(e.target.className==self.inputClass){self.inputValues.remove(e.target.value);if(self.childInputClass){$(e.target).siblings('ul').find('input').attr('checked','');self.childInputValues[e.target.value].values.clear();}}else if(e.target.className==self.childInputClass){var parentCheckBox=$(e.target).parent().parent().siblings('input:checkbox');self.childInputValues[parentCheckBox.val()].values.remove(e.target.value);parentCheckBox.attr('checked','');self.inputValues.remove(parentCheckBox.val());}}
self.doTrigger();}});}};function ListBuilder(colors,seriesType){this.colors=colors;this.seriesType=seriesType;};ListBuilder.prototype={getOffers:function(ticketId,offers,template,srcCtx){var total=offers.length;offers=offers.sort(function(a,b){if(a.id==ticketId){return-1;}else if(b.id==ticketId){return 1;}else{return a.displayPrice-b.displayPrice;}});var offersTxt="";var addedOffers=0;for(var i=0;i<total;i++){if(offers[i].deleted)
continue;var obj={broker:unescape(offers[i].broker),price:offers[i].displayPrice,ticketId:ticketId,srcCtx:srcCtx,num:(i+1),total:total,dealId:i==0?"null":offers[i].id};if(addedOffers==3){offersTxt+="<a href='javascript:void(0)' ";offersTxt+="onclick='try{$(this).parent().siblings(\".deal-links-container-more\").show();$(this).hide()}catch(e){}' ";offersTxt+="class='more-deals-link'>&nbsp;</a>";offersTxt+="</div><div class='deal-links-container-more'>";}
offersTxt+=Template.apply(template,obj);addedOffers++;}
return offersTxt;},getTicketSet:function(tix,templates,srcCtx){var offers=tix.getComparables();var total=offers.length;var offersTxt=tix.getAttribute('deleted')?"":this.getOffers(tix.getId(),offers,templates.offer,srcCtx);var brokerId=tix.getBrokerId();var bi=tix.getBucketId().min;var cid=this.colors[bi];var notes=tix.getAttribute('notes')||'';var seatList=tix.getAttribute('seats');var inShortList=tix.getAttribute('inShortList');var event=tix.getAttribute('event');var shareId=event.id+":2:"+tix.getAttribute('key2');var bestVal=tix.getAttribute('bv');var ps=tix.getAttribute('ps');var dbg=!fsTop.debugEnabled?"":"<br/>"+offers.length+" | "+tix+" | "+bi;var secName=tix.getAttribute('sectionName');secName=secName||secName=='N/A'?secName:'not specified';var rowName=tix.getAttribute('rowName');rowName=!rowName||rowName.toLowerCase()=='unmapped'?'not specified':rowName;var obj={srcCtx:srcCtx,dateTime:this.getShortDateString(event),section:secName,escSection:escape(secName),row:rowName,broker:unescape(tix.getBroker()),brokerId:brokerId,notes:notes+dbg,seats:tix.getQuantity(),seatList:seatList,price:tix.getDisplayPrice(),splitsText:JSHybridView.getSplitsText(tix.getSplits()),cid:cid,bid:bi,ticketId:tix.getId(),salePrice:tix.getSalePrice().toFixed(2),cssTag:inShortList?"-highlighted":"",shareId:shareId,bvTag:bestVal||ps?"on":"off",handlingFee:(tix.getHandlingFee()||0).toFixed(2),comps:"<div class='deal-links-container'>"+offersTxt+"</div>",totalDeals:total};return Template.apply(templates.ticketSet,obj);},getShortDateString:function(event){if(!event)
return null;if(this.seriesType=='none')
return"";else if(this.seriesType=='series')
return event.date+' '+event.time;else
return event.time;}};function StringSet(){this.keys={};this.count=0;}
StringSet.prototype={add:function(key){if(!this.keys[key]){this.keys[key]=true;this.count++;}},addList:function(list){if(list){for(var i=0;i<list.length;i++){this.add(list[i]);}}},addHash:function(hash){if(hash){for(var k in hash){this.add(k);}}},addAll:function(other){if(other){for(var k in other.keys){this.add(k);}}},contains:function(k){return this.keys[k];},containsAny:function(stringSet){for(var k in stringSet.keys){if(this.contains(k)){return true;}}
return false;},remove:function(key){if(this.keys[key]){delete this.keys[key];this.count--;}},clear:function(){this.keys={};this.count=0;},toString:function(){var a=this.toArray();var str=a.join(",");return str;},toArray:function(){var array=new Array();for(var i in this.keys){array.push(i);}
return array;}};Markable.counter=0;function Markable(type){this._id=Markable.counter++;this.parent=null;this.geometry=null;this.nodes=new Array();this.type=type;this.markableData={};this.attr={};this.loaded=0;this.flagged=0;this.bucketId={min:-1,max:-1};};Markable.prototype.setId=function(id_){this.markableData.id=id_;};Markable.prototype.setGeomId=function(geomId_){this.markableData.geomId=geomId_;};Markable.prototype.setParent=function(parent){this.parent=parent;};Markable.prototype.setName=function(name_){this.markableData.name=name_;};Markable.prototype.setGeometry=function(geom){this.geometry=geom;};Markable.prototype.setPriceRange=function(range){this.attr.priceRange=range;};Markable.prototype.setQuantity=function(qty){this.attr.qty=qty;};Markable.prototype.incLoaded=function(qty){this.loaded+=qty;};Markable.prototype.setSplits=function(split_str){if(split_str){var a=split_str.split(',');if(!this.attr.splits)this.attr.splits=new StringSet();for(var i=0;i<a.length;i++){this.attr.splits.add(a[i]);}}else{this.attr.splits.add(this.attr.qty);}};Markable.prototype.setBucketId=function(range){this.bucketId=range;};Markable.prototype.setAttribute=function(name,value){this.attr[name]=value;};Markable.prototype.setAttributes=function(attributes){this.attr=attributes;};Markable.prototype.addNode=function(markable){this.nodes.push(markable);};Markable.prototype.addSplits=function(s){this.attr.splits.addAll(s);};Markable.prototype.flagNode=function(){this.flagged++;var p=this.parent;if(p)
p.flagNode();};Markable.prototype.unflagNode=function(){this.flagged--;var p=this.parent;if(p)
p.unflagNode();};Markable.prototype.getAreaId=function(){if(this.type=='row'){return this.getParent().getParent().getGeomId();}else if(this.type=='section'){return this.getParent().getGeomId();}else if(this.type=='area'){return this.getGeomId();}}
Markable.prototype.getParent=function(){return this.parent;};Markable.prototype.getType=function(){return this.type;};Markable.prototype.getId=function(){return this.markableData.id;};Markable.prototype.getGeomId=function(){return this.markableData.geomId;};Markable.prototype.getName=function(){return this.markableData.name;};Markable.prototype.getGeometry=function(){return this.geometry;};Markable.prototype.getPriceRange=function(){return this.attr.priceRange;};Markable.prototype.getQuantity=function(){return this.attr.qty;};Markable.prototype.getTicketSetsCount=function(){return this.attr.tixSetCnt;};Markable.prototype.getComparableCount=function(){return this.attr.compCnt;};Markable.prototype.getSplits=function(){return this.attr.splits;};Markable.prototype.getBucketId=function(){return this.bucketId;};Markable.prototype.getAttribute=function(name){return this.attr[name];};Markable.prototype.getChildren=function(){return this.nodes;};Markable.prototype.getNodes=function(){return this.nodes;};Markable.prototype.getFlaggedCount=function(){return this.flagged;};Markable.prototype.getLoaded=function(){return MarkableUtil.countLoaded(this);};Markable.prototype.isLoaded=function(){var areTixLoaded=(this.getLoaded()==this.getComparableCount());if(areTixLoaded){var section=null;if(this.type=='row'){section=this.getParent();}else if(this.type=='section'){section=this;}else{return true;}
var sectionName=section.getName();var sectionId=section.getGeomId();var ugc=SeatsPageController.ugcMgr;if(ugc.isLoaded(sectionId)||ugc.isLoaded(sectionName)){return true;}else{return false;}}else{return false;}};Markable.prototype.isFlagged=function(){return this.flagged>0;};Markable.prototype.findChildByName=function(n){for(var i=0;i<this.nodes.length;i++){if(this.nodes[i].getName()==n)
return this.nodes[i];}
return null;};Markable.prototype.getChildIndexByContentKey=function(n){for(var i=0;i<this.nodes.length;i++){if(this.nodes[i].getAttribute('key2')==n){return i;}}
return-1;};Markable.prototype.setChildByIndex=function(n,i){this.nodes[i]=n;};Markable.prototype.toString=function(){var str="parent type: "+(this.parent?this.parent.type:"null")+"<br/>";str+="children: "+this.getChildren().length+"<br/>";str+="type: "+this.getType()+"<br/>";str+="id: "+this.getId()+"<br/>";str+="name: "+this.getName()+"<br/>";if(this.geometry){str+="geom.polygons: "+this.geometry.polygons+"<br/>";str+="geom.marker: "+this.geometry.marker+"<br/>";}
str+="bucketId: "+this.bucketId.min+" - "+this.bucketId.max+"<br/>";str+="flagged: "+this.flagged+"<br/>";str+="---- attrs<br/>";for(var a in this.attr){if(a=="priceRange"){str+=a+": ["+this.attr[a].min+","+this.attr[a].max+"]<br/>";}else{str+=a+": "+this.attr[a]+"<br/>";if(a=="deals"){str+="---- begin deals<br/>";for(var deals in this.attr.deals){str+="---- id: "+deals+"<br/>";for(var key in this.attr.deals[deals]){str+=key+": "+this.attr.deals[deals][key]+"<br/>";}}
str+="---- end deals<br/>";}}}
return str;};function ComparableMarkable(typeOverride){Markable.call(this,typeOverride);};ComparableMarkable.prototype=new Markable();ComparableMarkable.prototype.constructor=ComparableMarkable;ComparableMarkable.prototype.getMainTicket=function(){return this.attr.deals[this.markableData.id];};ComparableMarkable.prototype.getAreaId=function(){return this.attr.aId;}
ComparableMarkable.prototype.getBrokerList=function(){return this.attr.brokerList;};ComparableMarkable.prototype.getBroker=function(id){return(id?this.attr.deals[id].broker:this.getMainTicket().broker);};ComparableMarkable.prototype.getDisplayPrice=function(id){return(id?this.attr.deals[id].displayPrice:this.getMainTicket().displayPrice);};ComparableMarkable.prototype.getSalePrice=function(id){return(id?this.attr.deals[id].salePrice:this.getMainTicket().salePrice);};ComparableMarkable.prototype.getHandlingFee=function(id){return(id?this.attr.deals[id].handlingFee:this.getMainTicket().handlingFee);};ComparableMarkable.prototype.getBrokerId=function(id){return(id?this.attr.deals[id].brokerId:this.getMainTicket().brokerId);};ComparableMarkable.prototype.getComparables=function(){var comps=[];for(var key in this.attr.deals){comps.push(this.attr.deals[key]);}
return comps;};ComparableMarkable.prototype.getComparableCount=function(){return 1;};function RequestQueue(setLimit,secLimit){this.setLimit=setLimit;this.secLimit=secLimit;this.queue=new Array();this.keys={};};RequestQueue.prototype={addSection:function(sec){if(sec){var last=this.queue.length>0?this.queue[this.queue.length-1]:null;if(last&&(last.cnt+sec.getTicketSetsCount()>this.setLimit||last.sec.length>=this.secLimit)){last=null;}
if(last==null){var secList=new Array();secList.push(sec);this.queue.push({id:this.queue.length,cnt:sec.getTicketSetsCount(),sec:secList,name:sec.getName(),downloader:null});last=this.queue[this.queue.length-1];}else{last.cnt+=sec.getTicketSetsCount();last.sec.push(sec);last.name+=","+sec.getName();}
this.keys[sec.getName()]=last;}},findEntry:function(name){return this.keys[name];},dump:function(){for(var i=0;i<this.queue.length;i++){this.dumpEntry(this.queue[i]);}
debug("-------");for(var k in this.keys){var r=this.keys[k];debug(k+" (id:"+r.id+")");}},dumpEntry:function(r){var sec=r.sec;debug(r.id+": cnt="+r.cnt+";sec.length="+sec.length+";name="+r.name);for(var s=0;s<sec.length;s++){debug(".... "+sec[s].getName()+" ("+sec[s].getQuantity()+")");}}};InlineUtil.bvAgeString=function(ts){var tsDiff=parseInt(ts/60000);if(tsDiff<60)
return tsDiff+pluralLabel(tsDiff,"min ago","mins ago");tsDiff=parseInt(tsDiff/60);if(tsDiff<24)
return tsDiff+pluralLabel(tsDiff,"hr ago","hrs ago");tsDiff=parseInt(tsDiff/24);if(tsDiff==1)
return"1 day ago";return"2+ days ago";};InlineUtil.toggleShortList=function(ticketId,elem){var show=SeatsPageController.toggleShortList(ticketId);var className=show?'add-to-list-highlighted':'add-to-list';if(elem){elem.className=className;}
if(!elem||elem.id==("fav_list_"+ticketId)){var e=document.getElementById("fav_"+ticketId);if(e)e.className=className;}
if(!elem||elem.id==("fav_"+ticketId)){var e=document.getElementById("fav_list_"+ticketId);if(e)e.className=className;}
if(show){$('.'+className).children('span').text('remove from shortlist');}else{$('.'+className).children('span').text('click to add to shortlist');}
return false;};InlineUtil.toggleShortList2=function(ticketId,elem){var show=SeatsPageController.toggleShortList(ticketId);var text=show?'Remove from My List':'Add to My List';if(elem){$(elem).text(text);}
if(!elem||elem.id==("fav_list_"+ticketId)){var e=document.getElementById("fav_"+ticketId);if(e)$(e).text(text);}
if(!elem||elem.id==("fav_"+ticketId)){var e=document.getElementById("fav_list_"+ticketId);if(e)$(e).text(text);}
return false;};InlineUtil.ticketSetFBShare=function(shareId,elem){var sId=3;sId+="&tss_="+shareId;FBPackage.loadFbJs(function(){$.get('/sharing/rsa',{dest:'fbs-ts'});FB.Connect.requireSession(function(){FBPackage.Sharing.showShareDialog(sId);});});};InlineUtil.selectBestValueDeal=function(ind,type,pos){PageUet.rec("ev="+type+"sel;"+pos);var view=SeatsPageController.view;view.hideBestValues();var bv=null;bv=SeatsPageController.model[type];if(bv&&ind<bv.length){if(bv[ind].s.getType()=='row'&&view.viewSpecs[view.zoomLevel].type!='rows'){for(var i=view.zoomLevel-1;i>=0;--i){if(view.viewSpecs[i].type=='rows'){view.map.setCenter(bv[ind].s.marker.latlng);view.map.setZoom(23-i);break;}}}else if(bv[ind].s.getType()=='section'&&view.viewSpecs[view.zoomLevel].type!='sections'){for(var i=view.zoomLevel+1;i<5;++i){if(view.viewSpecs[i].type=='sections'){view.map.setCenter(bv[ind].s.marker.latlng);view.map.setZoom(23-i);break;}}}
bv[ind].s.marker.handleClick();}};var MarkableUtil=new Object();MarkableUtil.createTicketSet=function(comp,parent,typeOverride){var compNode=typeOverride?new ComparableMarkable(typeOverride):new ComparableMarkable('comparable');compNode.markableData=comp.markableData;compNode.attr=comp.attr;var rowNode=parent?parent:null;if(rowNode){compNode.setGeometry(rowNode.getGeometry());compNode.setParent(rowNode);}
var bid=SeatsData.bucketId(compNode.getDisplayPrice());compNode.setBucketId({min:bid,max:bid});compNode.attr.splits=new StringSet();compNode.setSplits(comp.attr.split);var sectionList=new StringSet();sectionList.add((SeatsPageController.useIds?compNode.getAttribute('sId'):compNode.getAttribute('sectionName')));compNode.attr.sectionList=sectionList;var brokers=compNode.attr.brokerList.push?compNode.attr.brokerList:compNode.attr.brokerList.split(',');compNode.attr.brokerList=new StringSet();for(var i=0,size=brokers.length;i<size;++i){compNode.attr.brokerList.add(brokers[i]);}
return compNode;};MarkableUtil.countLoaded=function(node){if(node.getType()=='comparable')
return 1;if(node.getType()=='row')
return node.getChildren().length;var loaded=0;var children=node.getChildren();for(var i=0;i<children.length;i++){loaded+=MarkableUtil.countLoaded(children[i]);}
return loaded;};var BrowserUtil={}
BrowserUtil.getSize=function(){if(typeof(window.innerWidth)=='number'){return{w:window.innerWidth,h:window.innerHeight};}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){return{w:document.documentElement.clientWidth,h:document.documentElement.clientHeight};}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){return{w:document.body.clientWidth,h:document.body.clientHeight};}
return{w:-1,h:-1};};var _config={colors:['ffff33','ffcc00','ff9933','ff6633','ff3333','cc3333','993333','663333'],downloadMode:'partial',useIds:false,maxSetRequest:150,maxSecRequest:20,maxDetailSets:50,perpage:200,showDeals:false,minLoadingDelay:3000,confirmSeats:true,pixelTrackingUrl:null,ugcEnabled:true,writeReviewsEnabled:true,uploadPhotosEnabled:true,view:{props:{fbConnectEnabled:false,surveyEnabled:false,atmEnabled:true,zoomRange:{min:1,max:4},drawPolygonsEnabled:true,shadowEnabled:false,bvModalContent:'bv',polygonStrokeStyle:{hover:{color:"#33cc33"},select:{color:"#3274d1"}},bv:{enabled:true,style:'section',scoreFunc:"(a-m)/a",minScoreFunc:"0",minCount:3,maxShow:6,modal:{enabled:false,showOnInit:true,reqSeats:2}},ps:{enabled:true,maxShow:3},window:{minWidth:952,minHeight:768},images:{loading:'/images/loading-32-onwhite.gif'}},brokerTemplates:{},configs:{circle:{single:{basic:{image:'/images/markers/circle-multipoint-#{minColor}-#{maxColor}-17px.png',hidden:'/images/markers/circle-multipoint-inactive-17px.png'},flagged:{image:'/images/markers/short-listpoint-17px.png',hidden:'/images/markers/short-listpoint-17px.png'},best:{image:'/images/markers/best-valuepoint-17px.png',hidden:'/images/markers/circle-multipoint-inactive-17px.png'},shadow:{image:"/images/markers/marker-shadow.png",size:{w:38,h:29}},size:{w:17,h:25},anchor:{x:8,y:23}},multi:{basic:{image:'/images/markers/circle-multipoint-#{minColor}-#{maxColor}-17px.png',hidden:'/images/markers/circle-multipoint-inactive-17px.png'},flagged:{image:'/images/markers/short-listpoint-17px.png',hidden:'/images/markers/short-listpoint-17px.png'},best:{image:'/images/markers/best-valuepoint-17px.png',hidden:'/images/markers/circle-multipoint-inactive-17px.png'},shadow:{image:"/images/markers/marker-shadow.png",size:{w:38,h:19}},size:{w:17,h:25},anchor:{x:8,y:23}}}},defaultZoom:5-Math.max(Math.floor(Math.min(BrowserUtil.getSize().w/710,BrowserUtil.getSize().h/550)),1),spec:[{level:0,type:'rows',config:'circle'},{level:4,type:'sections',config:'circle'},{level:5,type:'sections',config:'circle'}]}};fsTop.dumpConfig=function(){var str='';for(var k in _config){srt+=k+' -> '+_config[k];}alert(str)}
function broker_popup(url){window.open(url,"_blank","resizable=no,status=no,scrollbars=no,location=no,menubar=no,titlebar=no,width=470,height=250,top=100,left=100");return false;}
function faq_popup(url){window.open(url,"_blank","resizable=no,status=no,scrollbars=yes,location=no,menubar=no,titlebar=no,width=550,height=400,top=100,left=100");return false;}
function bvInfoPopup(url){window.open(url,"_blank","resizable=no,status=no,scrollbars=no,location=no,menubar=no,titlebar=no,width=500,height=300,top=100,left=100");return false;}
function AreaFilter(opts){this.domId=opts.domId;this.filter=opts.filter;this.eventId=opts.eventId;this.fetchData();}
AreaFilter.prototype={fetchData:function(){var self=this;$.ajax({url:'/geometries/configuration',data:'eid='+this.eventId,success:function(data,status){$('#'+self.domId).html(data);self.setUI();self.bindListeners();},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);}});},updateFilter:function(){this.filter.clearAreas();this.filter.clearSections();var areaInputs=$('#'+this.domId+' input.modal_flt_area');if(areaInputs.length!=$('#'+this.domId+' input.modal_flt_area:checked').length){for(var i=0;i<areaInputs.length;i++){if(areaInputs[i].checked){this.filter.addArea(areaInputs[i].value);}else{var sectionsInputs=$(areaInputs[i]).siblings('ul').find('input:checked');for(var j=0;j<sectionsInputs.length;j++){this.filter.addSection(sectionsInputs[j].value);}}}}},setUI:function(){var areasFilter=this.filter.getAreas();var sectionsFilter=this.filter.getSections();if(areasFilter.count==0&&sectionsFilter.count==0){$('#'+this.domId+' input').attr('checked','');}else{$('#'+this.domId+' input').attr('checked','');var areasInput=$('#'+this.domId+' > ul > li > input');for(var i=0;i<areasInput.length;i++){if(areasFilter.contains(areasInput[i].value)){areasInput[i].checked=true;$(areasInput[i]).siblings('ul').find('input').attr('checked','checked');}}
for(var k in sectionsFilter.keys){$('#'+this.domId+' input.modal_flt_sec[value='+k+']').attr('checked','checked');}}},bindListeners:function(){var self=this;$('div#'+this.domId).click(function(e){var domTarget=e.target;if(domTarget.className.match('expandable')){if(!domTarget.className.match('expanded')){domTarget.innerHTML='Hide Sections';$(domTarget).siblings('ul').show();$(domTarget).addClass('expanded');}else if(domTarget.className.match('expanded')){domTarget.innerHTML='Show Sections';$(domTarget).siblings('ul').hide();$(domTarget).removeClass('expanded');}}else if(e.target.nodeName=='INPUT'){if(e.target.checked){if(e.target.className=='modal_flt_area'){$(e.target).siblings('ul').find('input').attr('checked','checked');}else if(e.target.className=='modal_flt_sec'){if($(e.target).parent().parent().find('input:checkbox:checked').length==$(e.target).parent().parent().find('input:checkbox').length){$(e.target).parent().parent().siblings('input:checkbox').attr('checked','checked');}}}else{if(e.target.className=='modal_flt_area'){$(e.target).siblings('ul').find('input').attr('checked','');}else if(e.target.className=='modal_flt_sec'){$(e.target).parent().parent().siblings('input:checkbox').attr('checked','');}}}});}};function InactivityPopup(opts){this.timeoutLength=opts.timeoutLength;this.unfocusLength=opts.unfocusLength;this.resetHooks=opts.resetHooks;this.timeoutId=null;this.unfocusId=null;this.disabled=false;this.initialize();};InactivityPopup.prototype={initialize:function(){this.logClose=true;var self=this;$('#inactivityModal').jqm({closeClass:'closeFilterModal',modal:true,trigger:false,onHide:function(hash){hash.w.hide();hash.o.remove();if(self.logClose){PageUet.rec("iaaxn=cls");}
fsTop.channel.setPersistentCookie('es',parseInt((new Date()).getTime()/1000));}});this.setTimer();$('form#inactivity_modal_form').submit(function(){PageUet.rec("iaaxn=sbmt");self.logClose=false;var emailAddress=$(this).find('#email-address').val();var mlAid=$(this).find('#ml_aid').val();if(self.validateEmail(emailAddress)){$.ajax({url:'/email_subscriptions',type:'POST',data:{email:emailAddress,ml_aid:mlAid,ch:fsTop.channel.name},success:function(data,status){self.hidePopup();fsTop.channel.setAllCookies(data.cookies);},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);self.hidePopup();}});}else{$('#email-error').show();}
return false;});this.bindUnfocus();},bindUnfocus:function(){var self=this;var onblurFunction=function(){if(self.disabled){self.unbindUnfocus();return;}
self.unfocusId=setTimeout(function(){self.showPopup();},self.unfocusLength);};window.onblur=function(){onblurFunction();};},setTimer:function(){var self=this;this.timeoutId=setTimeout(function(){self.showPopup();},this.timeoutLength);this.bindUnfocus();},showPopup:function(){if($('body > .jqmOverlay').length){return;}
this.clearTimer();$('#inactivityModal').jqmShow();PageUet.rec("iapop=true");this.disabled=true;},hidePopup:function(){$('#email-error').hide();$('#inactivityModal').jqmHide();},resetTimer:function(type){if(this.resetHooks.indexOf(type)!=-1){this.clearTimer();}},clearTimer:function(){clearTimeout(this.timeoutId);clearTimeout(this.unfocusId);this.unbindUnfocus();},unbindUnfocus:function(){if($.browser.msie){document.onfocusout=null;}else{window.onblur=null;}},validateEmail:function(email){var emailPattern=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return emailPattern.test(email);}};function FsTiming(){};FsTiming.logTiming=function(value,timingHash){var timingString="timing="+value+';{';for(var key in timingHash){timingString=timingString+key+':'+timingHash[key]+',';}
timingString=timingString.substring(0,timingString.length-1);timingString+='}';PageUet.rec(timingString);};function ClickHelper(){};ClickHelper.recordClick=function(click){var tsid=click.ts.getId();var ctx=click.ctx;PageUet.rec("ev=click:"+tsid);PageUet.rec("ev=clickctx:"+ctx);if(typeof(urchinTracker)!="undefined")
urchinTracker('/clickout');};ClickHelper.trackAffiliate=function(click,affiliateMerchantId){if(affiliateMerchantId&&fsi__.vstId){var orderId=click.ts.getId()+':'+fsi__.vstId+':'+parseInt((new Date()).getTime()/1000);var affiliateUrl="http://track.linksynergy.com/ep?mid="+affiliateMerchantId+"&ord="+orderId+"&skulist="+click.ts.getId()+"&qlist=1&amtlist=1&cur=USD";document.getElementById('affiliatePixel').src=affiliateUrl;}};function GreedyTicketSetManager(mgr,perpage,channel,apiVersion,appParams){this.appParams=appParams;this.apiVersion=apiVersion;this.channel=channel;this.markerMgr=mgr;var mList=new Array();var mPageCache=new Array();this.perPage=perpage;this.page=1;this.sortBy={f:'price',d:'asc'};this.totalSeats=0;this.listFilter=null;this.bvDownloaded=false;this.psDownloaded=false;this.bvKeys=new StringSet();this.psKeys=new StringSet();this.filterLoadCount=0;this.sortLoadCount=0;this.markerLoadCount=0;this.initialTicketsCall=true;this.dirty=false;this.initialize=function(data){this.totalCount=data.total;this.totalVisible=this.totalCount;this.totalPages=Math.ceil(this.totalCount/this.perPage);};this.setPerPage=function(pp){this.perPage=pp;};this.setPage=function(p){this.page=p;};this.setSortBy=function(f,d){if(f!=this.sortBy.f||d!=this.sortBy.d)
this.dirty=true;this.sortBy={f:f,d:d};};this.getView=function(){var cache=mPageCache[this.getKey()];if(cache){this.totalVisible=cache.visible;this.totalSeats=cache.total;this.totalPages=cache.pages;this.markerStatuses=cache.markerStatuses;return cache.sets;}
return new Array();};this.sort=function(cb){if(!this.dirty)
return;if(!cb)
cb=function(){};var self=this;var key=this.getKey();var cache=mPageCache[key];if(cache==null){this.sortLoadCount+=1;this.downloadSets("sort",function(e){if(!e.error){mPageCache[key]=e;}
self.dirty=false;cb();});}else{cb();}};this.filter=function(filter,cb){if(!cb)
cb=function(){};if(filter.isEmpty())
this.listFilter=null;else
this.listFilter=filter;var self=this;var key=this.getKey();var cache=mPageCache[key];if(cache==null){if(!this.initialTicketsCall){this.filterLoadCount+=1}
this.downloadSets("filter",function(e){if(!self.initialTicketsCall){PageUet.rec("flt=results:"+e.total)}
if(!e.error){mPageCache[key]=e;}
self.dirty=false;self.initialTicketsCall=false;cb();});}else{cb();}};this.downloadSets=function(action,cb){var self=this;var params="order="+this.sortBy.f+"&dir="+this.sortBy.d;if(this.perPage<Infinity)params+="&perpage="+this.perPage;params+="&page="+this.page+"&";this.markerMgr.events.each(function(e){params+="event_ids[]="+e.id+"&";});if(this.listFilter!=null)
params+=this.listFilter.makeParams(SeatsPageController.useIds);if(!this.bvDownloaded){params+=this.getBestValParams();this.bvDownloaded=true;}
if(!this.psDownloaded&&this.markerMgr.psConfig.enabled){params+=this.getPremiumSeatParams();this.psDownloaded=true;}
params+=("&ch="+this.channel.name);params+=("&v="+this.apiVersion);params+=("&mrkrs=true");params+="&rts="+(new Date()).getTime();params+=this.appParams;var startTime=(new Date).getTime();$.ajax({url:'/seats/ajax/get_tickets_data',data:params,dataType:'json',success:function(data,status){var totalTime=(new Date).getTime()-startTime;if(data.timing){var value='';if(self.initialTicketsCall){value='init-tix';PageUet.rec("numtix="+data.totalSeats);}else if(self.page>1){value='p-tix';}else if(action=='filter'){value='flt-tix-'+self.filterLoadCount;}else if(action=='sort'){value='srt-tix-'+self.sortLoadCount;}
data.timing["totalTime"]=totalTime;FsTiming.logTiming(value,data.timing);}
if(data.bestVals)
self.loadBestValues(data.bestVals,data.bestValDetails);if(data.psContentKeys)
self.loadPremiumSeats(data.psContentKeys,data.psDetails);var sets=self.loadSets(data.sets);if(data.ugc_data.sections){SeatsPageController.ugcMgr.loadUgc(data.ugc_data.sections);SeatsPageController.ugcMgr.markLoaded(data.ugc_data.sections);}
if(cb)cb({sets:sets,total:data.totalSeats,visible:data.total,pages:Math.ceil(data.total/self.perPage),markerStatuses:data.markerStatuses,error:false});},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)cb({sets:new Array(),total:0,visible:0,pages:0,error:true});}});};this.downloadSections=function(list,cb,triggerEvent){var self=this;var params="";this.markerMgr.events.each(function(e){params+="event_ids[]="+e.id+"&";});if(SeatsPageController.useIds){params+="_fsids="+list+"&";}else{params+="_fsec="+list+"&";}
params+=("ch="+this.channel.name+'&');params+=("&v="+this.apiVersion);params+=this.appParams;if(!this.bvDownloaded){params+=this.getBestValParams();this.bvDownloaded=true;}
if(!this.psDownloaded&&this.markerMgr.psConfig.enabled){params+=this.getPremiumSeatParams();this.psDownloaded=true;}
var startTime=(new Date).getTime();$.ajax({url:'/seats/ajax/get_tickets_data',data:params,dataType:'json',success:function(data,status){var totalTime=(new Date).getTime()-startTime;if(data.timing){var value="mrk-tix-"+self.markerLoadCount;data.timing["totalTime"]=totalTime;FsTiming.logTiming(value,data.timing);}
if(data.bestVals)
self.loadBestValues(data.bestVals,data.bestValDetails);if(data.psContentKeys)
self.loadPremiumSeats(data.psContentKeys,data.psDetails);var sets=self.loadSets(data.sets);if(cb)cb(sets);if(triggerEvent)$(triggerEvent).trigger('done');},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)cb(new Array());if(triggerEvent)$(triggerEvent).trigger('done');}});};this.cacheTicketSet=function(raw){var event=this.markerMgr.getEvent(raw.attr.eventId);var q={s:raw.attr.aka?raw.attr.aka:raw.attr.sectionName,r:raw.attr.rowName,sId:raw.attr.sId};var row=this.markerMgr.findNode(q);var setNode=MarkableUtil.createTicketSet(raw,row);setNode.setAttribute('event',event);if(this.bvKeys.contains(setNode.getAttribute('key2'))){setNode.setAttribute('bv',true);if(row){row.setAttribute('bvTix',setNode);row.getParent().setAttribute('bvTix',setNode);}}
if(this.psKeys.contains(setNode.getAttribute('key2'))){setNode.setAttribute('ps',true);if(row){row.setAttribute('psTix',setNode);row.getParent().setAttribute('psTix',setNode);}}
if(row){var nodeIndex=row.getChildIndexByContentKey(setNode.getAttribute('key2'));if(nodeIndex>=0){row.setChildByIndex(setNode,nodeIndex);}else{row.addNode(setNode);}}
return setNode;};this.loadSets=function(raw){var sets=new Array();for(var i=0,size=raw.length;i<size;i++){setNode=this.cacheTicketSet(raw[i]);this.markerMgr.index.sets[setNode.getId()]=setNode;sets.push(setNode);}
return sets;};this.loadPremiumSeats=function(ps,raw){if(ps){this.psKeys.addList(ps);}
if(raw){for(var i=0,size=raw.length;i<size;i++){setNode=this.cacheTicketSet(raw[i]);this.markerMgr.index.ps.push(setNode);}}};this.loadBestValues=function(bv,raw){if(bv){this.bvKeys.addList(bv);}
if(raw){for(var i=0,size=raw.length;i<size;i++){setNode=this.cacheTicketSet(raw[i]);this.markerMgr.index.bv.push(setNode);}}};this.getPremiumSeatParams=function(){var param="";var ps=this.markerMgr.ps;if(ps){for(var i=0,sz=ps.length;i<sz;++i){var prc=ps[i].m;var node=ps[i].s;if(param.length>0)
param+="|";param+=node.getGeomId()+":"+node.getType()+":"+prc;}
if(param.length>0)
param="&_ps="+escape(param);}
return param;};this.getBestValParams=function(){var param="";var bv=this.markerMgr.bv;if(bv){for(var i=0;i<bv.length;i++){var sec=bv[i].s;var min=bv[i].m;if(sec.getAttribute('bv')){if(param.length>0)param+="|";param+=sec.getName()+":"+min;}}
if(param.length>0)
param="_bv="+escape(param);}
return param;};this.getKey=function(){var key=this.sortBy.f+"_"+this.sortBy.d+"_"+this.page;if(this.listFilter!=null){key+="_"+this.listFilter.makeKey();}
return key;};};function UgcManager(v,cs){var venue=v;var categories=cs;var reviews={};this.ugc={};this.loadedSections=new StringSet();var getNodeKey=function(node){if(node==null||!node.getParent)
return'all';return(getNodeKey(node.getParent())+"-"+node.getName()).toLowerCase();};this.isVfsReady=function(){return this.ugc.vfs?true:false;};this.downloadVfs=function(cb){var self=this;var params='vid='+venue.getId()+"&";if(categories){params+="cat="+categories.join(",")+"&";}
$.ajax({url:'/seats/ajax/get_vfs_data',data:params,dataType:'json',success:function(data,status){self.ugc.vfs=data;if(cb)cb();},error:function(data,status){self.ugc.vfs={};var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)cb();}});};this.getVfsPhoto=function(node,photoType){var photoUrl=null;if(!this.ugc.vfs){return photoUrl;}
if(node.getType()=='section'){var sec=node.getName();for(var row in this.ugc.vfs[sec]){photoUrl=this.ugc.vfs[sec][row][0][photoType];break;}}else if(node.getType()=='row'){var sec=node.getParent().getName();var row=node.getName();if(this.ugc.vfs[sec]&&this.ugc.vfs[sec][row]){photoUrl=this.ugc.vfs[sec][row][0][photoType];}else if(this.ugc.vfs[sec]&&this.ugc.vfs[sec]["default"]){photoUrl=this.ugc.vfs[sec]["default"][0][photoType];}}else if(node.getType()=='comparable'){var sec=node.getAttribute('sectionName');var row=node.getAttribute('rowName');if(this.ugc.vfs[sec]&&this.ugc.vfs[sec][row]){photoUrl=this.ugc.vfs[sec][row][0][photoType];}else if(this.ugc.vfs[sec]&&this.ugc.vfs[sec]["default"]){photoUrl=this.ugc.vfs[sec]["default"][0][photoType];}}
return photoUrl;};this.downloadSectionsUgc=function(list,cb,triggerEvent){var self=this;var params='vid='+venue.getId()+"&";if(categories)params+="cat="+categories.join(",")+"&";params+="secs="+list+"&";var sections=list.split(',');$.ajax({url:'/seats/ajax/get_ugc_data',data:params,dataType:'json',success:function(data,status){self.loadUgc(data.sections);self.markLoaded(sections);if(cb)cb();if(triggerEvent)$(triggerEvent).trigger('done');},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)cb(new Array());if(triggerEvent)$(triggerEvent).trigger('done');}});};this.loadUgc=function(data){for(var key in data){this.ugc[key]=data[key];}};this.markLoaded=function(sections){this.loadedSections.addList(sections);};this.isLoaded=function(section){return this.loadedSections.contains(section);};var fetchReviews=function(node,cb){var params='vid='+venue.getId()+"&";if(categories)params+="cat="+categories.join(",")+"&";if(node){if(node.getType()=='section')
params+="sec="+node.getName()+"&";else if(node.getType()=='row'&&node.getParent())
params+="sec="+node.getParent().getName()+"&";}
$.ajax({url:'/reviews.json',data:params,dataType:'json',success:function(raw,status){if(!raw||!raw.hits){if(cb)cb(new Array());return;}
var data=raw.hits;for(var i=0;i<data.length;i++){data[i].imageBase=raw.imageBase;data[i]=new UgcReview(data[i],self);}
if(cb)cb(data);},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)cb(new Array());}});return new Array();};this.getEntityReview=function(node,cb){var key='all';if(node){key=getNodeKey(node);}
if(reviews[key]){cb(reviews[key]);return;}
fetchReviews(node,function(r){reviews[key]=r;cb(r);});};this.findReview=function(id){for(var k in reviews){revs=reviews[k];for(var i=0;i<revs.length;i++){if(revs[i].getId()==id)
return revs[i];}}
return null;};};function UgcReview(raw,mgr){var data=raw;var created=new Date(data.created);var obj=null;var ugcMgr=mgr;var userStatus={td:false,tu:false,ia:false};this.getId=function(){return data.id;}
this.getPhotoURL=function(){if(data.user&&data.user.photo){var photo=data.user.photo;if(photo.indexOf("fansnap://")==0){return photo.replace("fansnap:/",data.imageBase);}else if(photo.indexOf("facebook://")){return photo.replace(photo,"");}}
return"/images/profile-square-default.jpg";};this.getTempObj=function(){if(!obj)
obj=data;obj.revId=obj.id;obj.ustu=userStatus.tu;obj.ustd=userStatus.td;obj.usia=userStatus.ia;obj.usefulText=obj.useful+(obj.useful>1?' fans':' fan');obj.hideUseful=(obj.useful==0?'display-none':'');if(data.details){var seatHolder=[];obj.category=data.details.category;if(data.details.area){seatHolder.push('Area: '+data.details.area);}
if(data.details.section){seatHolder.push('Section: '+data.details.section);}
if(data.details.row){seatHolder.push('Row: '+data.details.row);}
if(data.details.seat){seatHolder.push('Seat: '+data.details.seat);}
obj.seating=seatHolder.join(' ');}
if(data.user){obj.fanname=data.user.fanname;obj.profilePhoto=this.getPhotoURL();obj.userReviewCount=data.user.reviewCount;}
return obj;};this.submitFeedback=function(id,type,cb){if(type=='tu'){if(userStatus.tu||userStatus.td)
return false;data.useful++;userStatus.tu=true;}else if(type=='td'){if(userStatus.td||userStatus.tu)
return false;userStatus.td=true;}else if(type=='ia'){if(userStatus.ia)
return false;userStatus.ia=true;}
var scoreType=null;if(userStatus.tu)
scoreType="thumb_up";else if(userStatus.td)
scoreType="thumb_down";else if(userStatus.ia)
scoreType="inappropriate";if(scoreType!=null){var params={ugc_id:id,score_type:type,ugc_type:'Review'};$.ajax({url:'/update_score',type:'POST',data:params,dataType:'json',success:function(data,status){if(cb)
cb({status:data.status});},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);if(cb)
cb({status:"ERROR"});}});return true;}
return false;};};function DataDownloaderManager(ugcMgr_,tsMgr_,requestQueue_,options){var ugcMgr=ugcMgr_;var tsMgr=tsMgr_;var requestQueue=requestQueue_;var ugcEnabled=options.ugcEnabled;this.downloadData=function(sections,sectionIds,cb){if(sections){var rqItem=requestQueue.findEntry(sections[0]);if(!rqItem.downloader){options={callback:cb,ugcEnabled:ugcEnabled};rqItem.downloader=new DataDownloader(ugcMgr,tsMgr,options);}else{rqItem.downloader.ugcDone=false;rqItem.downloader.tixDone=false;}
var downloader=rqItem.downloader;downloader.addListener('done',function(){var toId=setTimeout(function(){if(downloader.ugcDone&&downloader.tixDone){cb();}},300)
if(downloader.ugcDone&&downloader.tixDone){cb();clearTimeout(toId);}});downloader.setSectionData(sections,sectionIds);downloader.downloadData(downloader);}};};function DataDownloader(ugcMgr_,tsMgr_,options){var ugcMgr=ugcMgr_;var tsMgr=tsMgr_;var sections=options.sections;var sectionIds=options.sectionIds;var callback=options.callback;var ugcEnabled=options.ugcEnabled;var trigger=null;this.ugcDone=false;this.tixDone=false;var self=this;this.downloadData=function(trigger_){trigger=trigger_;downloadTickets();downloadUgc();};var downloadTickets=function(){var sectionData=null;if(sectionIds&&sectionIds.length>0){sectionData=sectionIds.join(',');}else{sectionData=sections.join(',');}
tsMgr.markerLoadCount+=1;tsMgr.downloadSections(sectionData,function(){self.tixDone=true;},trigger);};var downloadUgc=function(){if(ugcEnabled){ugcMgr.downloadSectionsUgc(sections.join(','),function(){self.ugcDone=true;},trigger);}else{self.ugcDone=true;$(trigger).trigger('done');}};this.setSectionData=function(sections_,sectionIds_){sections=sections_;sectionIds=sectionIds_;};};DataDownloader.prototype={addListener:function(event,callback){$(this).bind(event,callback);}};function EventData(event){this.id=event.id;this.name=event.name;this.date=event.date;this.time=event.time;this.dateTimeString=event.dateTimeString;this.rawTime=new Date(event.rawDateTime);this.timestamp=event.rawDateTime;this.scores=event.scores;if(this.date)
this.date=this.date.replace(' ','&nbsp;');if(this.time)
this.time=this.time.replace(' ','&nbsp;');};EventData.prototype.serScores=function(){if(this.scores){return"rank="+this.scores.rank+";"+"crawlScore="+this.scores.crawlScore+";"+"pop1="+this.scores.score1+";"+"pop2="+this.scores.score2+";"+"pop3="+this.scores.score3+";";}
return"";};function SeatsData(data,options){this.useBinary=options.useBinary;this.groupComparable=options.groupComparable;this.useDbSummaries=options.useDbSummaries;this.useDbSummariesThreshold=options.useDbSummariesThreshold;this.useCacheHistogram=options.useCacheHistogram;this.ugcEnabled=options.ugcEnabled;this.excludeBrokers=options.excludeBrokers;this.litePingoutBrokers=options.litePingoutBrokers;this.newWindowPingout=options.newWindowPingout;this.useDbComparables=options.useDbComparables;this.channel=data.channel;this.useIds=options.useIds;this.apiVersion=options.apiVersion;this.rawData=data;this.options=options;this.mapType=data.data.mapType;this.venue=new Markable("venue");this.events=new Array();this.eventsMap=new Array();this.unmapped={a:null,s:null,r:null}
this.downloadMode='partial';this.bvConfig=options.view.props.bv;this.psConfig=options.view.props.ps;this.shareParams=data.tss;this.sharedOffers=null;this.allowBrokerPPC=options.allowBrokerPPC;this.brokerFilterLogoEnabled=options.brokerFilterLogoEnabled;this.requestQueue=new RequestQueue(options.maxSetRequest,options.maxSecRequest);this.tsm=new GreedyTicketSetManager(this,this.options.perpage,this.channel,this.apiVersion,this.makeAppParams());this.seriesType="none";this.index={areas:{},sections:{},rows:{},sets:{},seats:{},bv:[],ps:[]};var configPath=data.data.venue_cgi_name+"/"+data.data.configuration_cgi_name;this.venue.setName(data.data.venue_name);this.venue.setId(data.data.venue_id);this.venue.setAttribute('splits',new StringSet());this.venue.setAttribute('configPath',configPath);this.venue.setAttribute('viewsURL',data.data.viewsURL);this.venue.setAttribute('tilesURL',data.data.tilesURL);this.venue.setAttribute('center',data.data.center);this.venue.setAttribute('tileOffSet',data.data.tileOffSet);this.venue.setAttribute('city',data.data.venue_city);this.venue.setAttribute('state',data.data.venue_state);this.venue.setAttribute('location',data.data.venue_location);var dd=new StringSet();for(var ev=0;ev<data.data.events.length;ev++){var eventNode=new EventData(data.data.events[ev]);this.events.push(eventNode);dd.add(eventNode.date);}
this.seriesType=dd.count>1?"series":(this.events.length>1?"day":"none");this.async=data.data.async;};SeatsData.prototype={addListener:function(event,callback){$(this).bind(event,callback);},downloadReady:function(){$(this).trigger('downloaded');},dataReady:function(){$(this).trigger('initialized');},makeAppParams:function(){var params='&use_binary='+this.useBinary;params+='&group_comparable='+this.groupComparable;params+='&use_db_summaries='+this.useDbSummaries;params+='&use_db_summaries_threshold='+this.useDbSummariesThreshold;params+='&use_cache_histogram='+this.useCacheHistogram;params+='&ugc_enabled='+this.ugcEnabled;params+='&exclude_brokers='+this.excludeBrokers;params+='&use_db_comparables='+this.useDbComparables;return params;},initialize:function(filter){if(this.async){var params="";var self=this;this.events.each(function(e){params+="event_ids[]="+e.id+"&";});if(this.shareParams){params+="tss_=";this.shareParams.each(function(s){params+=s.e+":"+s.m+":"+s.k+",";});params+="&";}
params+="mode="+self.downloadMode;params+='&v='+self.apiVersion;params+='&use_ids='+self.useIds;params+='&abppc='+self.allowBrokerPPC;params+='&bfl='+self.brokerFilterLogoEnabled;params+='&ps='+self.psConfig.enabled;params+=self.makeAppParams();if(this.channel.forceParam&&this.channel.code){params+='&ch='+this.channel.name;}
params+="&map_type="+self.mapType;params+="&get_geom="+(self.mapType=='interactive');params+="&rts="+(new Date()).getTime();params+='&'+filter.makeIndexParams();var startTime=(new Date).getTime();$.ajax({url:'/seats/ajax/get_summary_data',data:params,dataType:'json',success:function(data,status){var totalTime=(new Date).getTime()-startTime;if(data.timing){data.timing["totalTime"]=totalTime;FsTiming.logTiming("smry",data.timing);}
self.downloadReady();self.rawData.data.areas=data.area_data;self.refinementData=data.refineData;self.reviewSummary=data.ugc_data;self.brokers=data.broker_data;self.keyGen=data.keyGen;self.maxPrice=data.maxPrice;self.premiumSections=data.premiumSections;SeatsData.priceHistogramBuckets=data.priceHistogramBuckets;try{self.setSeatsData(data.area_data);self.setSharedItems(data.shared,data.keyGen);}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);debug("SeatsData.initialize(async): "+e);}
self.dataReady();},error:function(data,status){var trace=printStackTrace().join(',');LoggerUtil.logAjaxError(data,status,trace);self.downloadReady();self.dataReady();}});}else{try{this.setSeatsData(this.data.area_data);}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);debug("SeatsData.initialize(sync): "+e);}
this.downloadReady();this.dataReady();}},setSharedItems:function(data,kg){if(!data)
return;this.sharedOffers=new Array();for(var i=0,size=data.length;i<size;++i){var set=data[i];var event=this.getEvent(set.attr.eventId);if(!event)
continue;var q={s:set.attr.sectionName,r:set.attr.rowName};var parent=this.findNode(q);var setNode=MarkableUtil.createTicketSet(set,parent);this.sharedOffers.push(setNode);setNode.setAttribute('event',event);setNode.setAttribute('shared',true);}},setSeatsData:function(data){if(!data){return;}
for(var key in data.venue.attr){this.venue.attr[key]=data.venue.attr[key];}
for(var ev=0;ev<this.events.length;ev++){var evkey="e"+this.events[ev].id;this.eventsMap[evkey]=this.events[ev];}
for(var i=0,size=data.areas.length;i<size;++i){var unmapArea=false;var area=data.areas[i];var areaNode=this.index.areas[area.markableData.geomId];if(!areaNode){areaNode=SeatsData.createNode(this.venue,'area',area);this.index.areas[area.markableData.geomId]=areaNode;if(areaNode.getName()=='Unmapped'){this.unmapped.a=areaNode;unmapArea=true;}
areaNode.setAttribute("isUnmapped",area.attr.unmapped||unmapArea?true:false);areaNode.setAttribute('areaName',areaNode.getName());}}
for(var i=0,size=data.sections.length;i<size;++i){var unmapSec=false;var section=data.sections[i];var secNode=this.index.sections[section.markableData.geomId];if(!secNode){var parentNode=this.index.areas[section.markableData.parentGeomId];secNode=SeatsData.createNode(parentNode,'section',section);this.index.sections[section.markableData.geomId]=secNode;if(parentNode.getName()=='Unmapped'&&secNode.getName()=='Unmapped'){this.unmapped.s=secNode;unmapSec=true;}
secNode.setAttribute("isUnmapped",section.attr.unmapped||unmapSec?true:false);secNode.setAttribute('areaName',parentNode.getName());this.requestQueue.addSection(secNode);}}
for(var i=0,size=data.rows.length;i<size;++i){var row=data.rows[i];var rowNode=this.index.rows[row.markableData.geomId];if(!rowNode){var parentNode=this.index.sections[row.markableData.parentGeomId];var grandparentNode=parentNode.parent;rowNode=SeatsData.createNode(parentNode,'row',row);this.index.rows[row.markableData.geomId]=rowNode;if(rowNode.getName()=='Unmapped'){if(parentNode.getName()=='Unmapped')this.unmapped.r=rowNode;parentNode.setAttribute('unmappedNode',rowNode);rowNode.setAttribute("isUnmapped",true);}else{rowNode.setAttribute("isUnmapped",false);}
if(row.attr.lastRow){parentNode.setAttribute('lastRowNode',rowNode);rowNode.setAttribute('isLastRow',true);}
rowNode.setAttribute('areaName',grandparentNode.getName());}}
this.bvConfig.style=='area'?this.calcScores2():this.calcScores();if(this.psConfig.enabled&&this.premiumSections&&this.useIds){this.calcPsScores();}
this.tsm.initialize({sets:this.index.sets,total:this.venue.getQuantity()});},evalProp:function(p,a,m){if(p){try{return eval(p);}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);}}
return 0;},calcPsScores:function(){var srRank=[];var total=0;var cnt=0;var max=0;for(var srId in this.premiumSections.sections){var node=this.index[this.premiumSections.sections[srId]+"s"][srId];if(node){total+=node.getAttribute('sum');if(this.apiVersion==2){cnt+=node.getComparableCount();}else{cnt+=node.getTicketSetsCount();}
max=[max,node.getPriceRange().max].max();srRank.push({m:node.getPriceRange().min,s:node});}}
srRank.sort(function(a,b){return a.m-b.m});var avg=total/cnt;var maxShow=this.psConfig.maxShow?this.psConfig.maxShow:1;this.ps=srRank.slice(0,maxShow);for(var i=0,sz=this.ps.length;i<sz;++i){this.ps[i].x=max;this.ps[i].a=avg;var psNode=this.ps[i].s;psNode.setAttribute('ps',true);if(psNode.getType()=='section'){var rows=psNode.getChildren();for(var r=0,rsz=rows.length;r<rsz;++r){if(rows[r].getPriceRange().min==this.ps[i].m)
rows[r].setAttribute('ps',true);}}else if(psNode.getType()=='row'){psNode.getParent().setAttribute('ps',true);}}},calcScores2:function(){this.bv=new Array();for(var key in this.index.areas){var area=this.index.areas[key];if(area.getName()==null||area.getName().toLowerCase().indexOf('unmapped')!=-1)
continue;var arSum=area.getAttribute('sum');var cnt=null;if(this.apiVersion==2){cnt=area.getComparableCount();}else{cnt=area.getTicketSetsCount();}
var secs=area.getChildren();var bvSec=null;for(var i=0;i<secs.length;i++){if(!bvSec||secs[i].getPriceRange().min<bvSec.getPriceRange().min)
bvSec=secs[i];}
if(arSum>0&&cnt>=this.bvConfig.minCount){var avg=arSum/cnt;var min=area.getPriceRange().min;var max=area.getPriceRange().max;var score=this.evalProp(this.bvConfig.scoreFunc,avg,min);var minScore=this.evalProp(this.bvConfig.minScoreFunc,avg,min);if(score>=this.evalProp(this.bvConfig.minScoreFunc,avg,min)){this.bv.push({s:bvSec,v:score,m:min,a:avg,x:max});}}}
this.pickBestValueNodes();},calcScores:function(){this.bv=new Array();for(var key in this.index.sections){var sec=this.index.sections[key];if(sec.getId()==null||sec.getId().indexOf('unmapped')!=-1)
continue;var sum=sec.getAttribute('sum');var cnt=sec.getTicketSetsCount();if(sum&&cnt>=this.bvConfig.minCount){var avg=sum/cnt;var min=sec.getPriceRange().min;var score=this.evalProp(this.bvConfig.scoreFunc,avg,min);var minScore=this.evalProp(this.bvConfig.minScoreFunc,avg,min);if(score>=this.evalProp(this.bvConfig.minScoreFunc,avg,min)){this.bv.push({s:sec,v:score,m:min});}}}
this.pickBestValueNodes();},pickBestValueNodes:function(){if(!this.bvConfig.enabled){this.bv=[];return;}
if(this.bv.length>0){this.bv.sort(function(a,b){return b.v-a.v;});}
this.bv=this.bv.slice(0,this.bvConfig.maxShow);for(var i=0;i<this.bv.length;i++){var sec=this.bv[i].s;var val=this.bv[i].v;var min=sec.getPriceRange().min;sec.setAttribute('bv',true);sec.setAttribute('score',val);var rows=sec.getChildren();for(var r=0;r<rows.length;r++){if(rows[r].getPriceRange().min==min){rows[r].setAttribute('bv',true);var tix=rows[r].getChildren();for(var t=0;t<tix.length;t++){if(tix[t].getPriceRange().min==min){sec.setAttribute('bvTix',tix[t]);rows[r].setAttribute('bvTix',tix[t]);tix[t].setAttribute('bv',true);break;}}
break;}}}
if(this.bv.length>0){this.bv.sort(function(a,b){return a.m-b.m;});}},getVenue:function(){return this.venue;},getEvent:function(id){return this.eventsMap['e'+id];},getNodes:function(type){nodes=new Array();for(key in this.index[type]){nodes.push(this.index[type][key]);}
return nodes;},getTicketSet:function(id){var ts=this.index.sets[id];if(ts)return ts;if(this.sharedOffers){for(var i=0;i<this.sharedOffers.length;i++){if(this.sharedOffers[i].getId()==id)
return this.sharedOffers[i];}}
return null;},findArea:function(n){var areas=this.index.areas;for(var key in areas){if(areas[key].getName()==n)
return areas[key];}
return null;},findSection:function(n){var sections=this.index.sections;for(var key in sections){if(sections[key].getName()==n)
return sections[key];}
return null;},findNode:function(q){var sec=null;var row=null;if(q.sId&&this.useIds){sec=this.index.sections[q.sId];}
else if(q.s){var sections=this.index.sections;for(var key in sections){if(sections[key].getName()==q.s){sec=sections[key];break;}}}
if(q.r&&sec){row=sec.findChildByName(q.r);row=row?row:(sec.getAttribute('unmappedNode')?sec.getAttribute('unmappedNode'):sec.getAttribute('lastRowNode'));}else if(sec){row=(sec.getAttribute('unmappedNode')?sec.getAttribute('unmappedNode'):sec.getAttribute('lastRowNode'));}
return row?row:this.unmapped.r;},loadNodeData:function(node,cb){var secName=node.getName();if(node.getType()=='row')
secName=node.getParent().getName();var dnList=this.requestQueue.findEntry(secName);if(dnList&&dnList.name){var sectionNames=[];var sectionIds=[];if(this.useIds){for(var i=0;i<dnList.sec.length;i++){sectionIds.push(dnList.sec[i].getGeomId());sectionNames.push(dnList.sec[i].getName());}}else{sectionNames=dnList.name.split(',');}
SeatsPageController.ddm.downloadData(sectionNames,sectionIds,cb);}}};SeatsData.createNode=function(parent,type,raw){var node=new Markable(type);node.markableData=raw.markableData;node.attr=raw.attr;node.geometry=new Geometry(node.markableData.polygons,node.markableData.marker);if(node.attr.priceRange){var bidMin=SeatsData.bucketId(node.attr.priceRange.min);var bidMax=SeatsData.bucketId(node.attr.priceRange.max);node.setBucketId({min:bidMin,max:bidMax});}
if(raw.attr&&raw.attr.splits){var s=new StringSet();s.addAll(raw.attr.splits);node.attr.splits=s;}else{node.attr.splits=new StringSet();}
if(raw.attr&&raw.attr.brokerList){var s=new StringSet();s.addAll(raw.attr.brokerList);node.attr.brokerList=s;}else{node.attr.brokerList=new StringSet();}
if(raw.attr&&raw.attr.sectionList){var s=new StringSet();s.addAll(raw.attr.sectionList);node.attr.sectionList=s;}else{node.attr.sectionList=new StringSet();}
if(parent&&parent.addNode){parent.addNode(node);node.setParent(parent);}
return node;};SeatsData.bucketId=function(price){var id=SeatsData.priceHistogramBuckets.length-1;for(var i=0;i<SeatsData.priceHistogramBuckets.length;i++){if(price<SeatsData.priceHistogramBuckets[i].table.min){id=i-1;break;}}
return id;};function ShortList(){this.tickets=new Array();this.events={};};ShortList.prototype={addSets:function(eventId,tickets){this.events[eventId]=tickets;this.tickets=this.tickets.concat(tickets);},addTicket:function(tix){var eventId=tix.getAttribute('event').id;if(!this.events[eventId])
this.events[eventId]=new Array();this.events[eventId].push(tix);this.tickets.push(tix);},removeTicket:function(tix){var eventId=tix.getAttribute('event').id;if(this.events[eventId]){for(var i=0;i<this.events[eventId].length;i++){if(this.events[eventId][i].getId()==tix.getId()){this.events[eventId].splice(i,1);break;}}}
for(var i=0;i<this.tickets.length;i++){if(this.tickets[i].getId()==tix.getId()){this.tickets.splice(i,1);break;}}},makeIndexParams:function(){var p=new Array();for(var k in this.events){var e=this.events[k];for(var i=0;i<e.length;i++){p.push(k+":2:"+e[i].getAttribute('key2'));}}
if(p.length>0)
return"tss_="+p.join(",")+"&";else
return"";}};function PingoutView(viewContext){this.filter=viewContext.filter;this.venue=viewContext.venue;this.brokers=viewContext.brokers;this.channel=viewContext.channel;this.ugcMgr=viewContext.ugcMgr;this.clickHandler=viewContext.clickHandler;this.fakePingout=null;$('div#pingoutModal').jqm({modal:false,overlay:1,trigger:false,closeClass:'closePingoutModal',onHide:function(h){h.w.hide();h.o.remove();if(typeof(SeatsPageController)!="undefined"){var view=SeatsPageController.view;if(view.inactivityPopup&&!view.inactivityPopup.disabled)
view.inactivityPopup.setTimer();}},onShow:function(h){if(typeof(SeatsPageController)!="undefined"){var view=SeatsPageController.view;if(view.inactivityPopup&&!view.inactivityPopup.disabled)
view.inactivityPopup.clearTimer();}
h.w.show();}});this.popupComps={info:fsTop.jsTemplate.pingout.info,infoVfs:fsTop.jsTemplate.pingout.infoVfs,notice:{redirect:fsTop.jsTemplate.pingout.notice.redirect,process:fsTop.jsTemplate.pingout.notice.process,success:fsTop.jsTemplate.pingout.notice.success,soldout:fsTop.jsTemplate.pingout.notice.soldout,price:fsTop.jsTemplate.pingout.notice.price,qty:fsTop.jsTemplate.pingout.notice.qty,priceqty:fsTop.jsTemplate.pingout.notice.priceqty},buttons:fsTop.jsTemplate.pingout.buttons,ppc:fsTop.jsTemplate.pingout.ppc}};PingoutView.prototype.poClick=function(){var qty=$('#pingout-dropdown').val();if(qty!=''){$('#clickout-qty').val(qty);this.currClick.quantity=qty;if(this.isLitePingout){this.currClick.redirect=true;var redirectUrl='/checkout/clickout/'+this.dealId+'?ctx='+escape(this.currClick.ctx)+'&quantity='+qty+'&ch='+fsTop.channel.name;setTimeout(function(){window.location=redirectUrl;},3000);}else{$('#purchaseConfirmForm').submit();this.close();}
this.clickHandler(this.currClick);return false;}else if(qty==''){$('#add-drop-cont').toggle();return false;}};PingoutView.prototype.clearModal=function(){var parts={info:null,notice:null,buttons:null,ppc:null}
this.updateView(parts);};PingoutView.prototype.initialize=function(isLitePingout,dealId){this.isLitePingout=isLitePingout;this.dealId=dealId;this.clearModal();};PingoutView.prototype.startValidation=function(ticketSet,dealId,ctx){if(ticketSet){var parts={info:this.getInfoPopup(ticketSet),notice:this.popupComps.notice.process}
this.updateView(parts,ticketSet,dealId,ctx);$('div#pingoutModal').jqmShow();}};PingoutView.prototype.getInfoPopup=function(ticketSet){var photoUrl=this.ugcMgr.getVfsPhoto(ticketSet,'po');var currentPop=null;if(photoUrl){currentPop=this.popupComps.infoVfs;}else{currentPop=this.popupComps.info;}
return currentPop;}
PingoutView.prototype.displayConfirmation=function(ticketSet,dealId,ctx,po){var notice=null;switch(po.status){case'SOLD_OUT':notice=this.popupComps.notice.soldout;break;case'QUANTITY_CHANGED':notice=this.popupComps.notice.qty;break;case'PRICE_CHANGED':notice=this.popupComps.notice.price;break;case'PRICE_AND_QUANTITY_CHANGED':notice=this.popupComps.notice.priceqty;}
var broker=this.brokers[ticketSet.getBrokerId(dealId)];var ppcEnabled=broker&&broker.ppc;var parts={info:this.getInfoPopup(ticketSet),notice:notice,buttons:po.status=='SOLD_OUT'?null:this.popupComps.buttons,ppc:ppcEnabled?fsTop.jsTemplate.pingout.ppc:null}
this.currClick={ts:ticketSet,ctx:ctx};if(this.isLitePingout){if(po.status=='CONTINUE'||po.status=='ERROR'){parts.notice=Template.apply(this.popupComps.notice.redirect,{brokerName:unescape(this.currClick.ts.getBroker(this.dealId))});this.updateView(parts,ticketSet,dealId,ctx,po);PageUet.rec('lp=true');this.poClick();return;}else{this.isLitePingout=false;}}
this.updateView(parts,ticketSet,dealId,ctx,po);};PingoutView.prototype.close=function(){$('div#pingoutModal').jqmHide();};PingoutView.prototype.updateView=function(parts,ts,dealId,ctx,po){var obj=this.getBuildObject(ts,dealId,ctx,po);if(parts.info&&!this.isLitePingout){var info=Template.apply(parts.info,obj);$('#po-info').html(info).show();}else{$('#po-info').hide();}
if(parts.notice){var notice=Template.apply(parts.notice,obj);$('#po-notice').html(notice).show();}else{$('#po-notice').hide();}
var instructions="";if(parts.buttons){instructions+=Template.apply(parts.buttons,obj);}
if(parts.ppc&&!this.isLitePingout){instructions+=Template.apply(parts.ppc,obj);}
if(this.isLitePingout){$('#pingoutModal .fsAuthModalClose').hide();$('#pingoutModal .po-excludes-ship').hide();$('#pingoutModal .addtocart-go-back').hide();$('#po-instructions').hide().html(instructions);}else{$('#po-instructions').show().html(instructions);$('#pingoutModal .fsAuthModalClose').show();$('#pingoutModal .po-excludes-ship').show();$('#pingoutModal .addtocart-go-back').show();}};PingoutView.prototype.getBuildObject=function(ts,dealId,ctx,po){if(!ts){return{};}
var event=ts.getAttribute('event');var thisBroker=unescape(ts.getBroker(dealId));var notes=ts.getAttribute('notes');var brokerId=ts.getBrokerId(dealId);var ppcNum=this.brokers[brokerId].ppc_num;var handlingFee=(ts.getHandlingFee(dealId)||0);var basePrice=ts.getSalePrice(dealId).toFixed(2);var total=po&&po.newPrice?Math.ceil(po.newPrice+handlingFee):ts.getDisplayPrice(dealId);var details={ticketSetId:dealId,eventName:event.name,venue:this.venue.getName(),location:this.venue.getAttribute('location'),eventDate:event.date+' @ '+event.time,section:ts.getAttribute('sectionName'),row:ts.getAttribute('rowName'),notes:notes?notes:'',qty:this.filter.getQuantity(),totalPrice:total,oldPrice:basePrice,salePrice:(po&&po.newPrice?po.newPrice.toFixed(2):basePrice),handlingFee:handlingFee.toFixed(2),roundedHandlingFee:Math.ceil(handlingFee),broker:thisBroker,img:'logos/provider-large-'+brokerId+'.gif',dropdown:po?this.getDropdown(ts,ctx,po):'',ppcNum:ppcNum,incDec:(po&&po.newPrice?((po.newPrice>basePrice)?'The seller just increased the price of those tickets':'What great luck! \The price of those tickets has just dropped'):null),ctx:ctx,imgPath:this.ugcMgr.getVfsPhoto(ts,'po')};return details;};PingoutView.addCartSelect=function(cnts,selectedQty,channelSuffix){var dd="<select id='pingout-dropdown' name='pingout-dropdown'>";for(var i=0;i<cnts.length;i++){var tixMsg=cnts[i]==1?" ticket":" tickets";var selectedText=cnts[i]==selectedQty?" selected":"";dd+="<option"+selectedText+" value='"+cnts[i]+"'>"+cnts[i]+tixMsg+"</option>";}
dd+="</select>"
return dd;};PingoutView.prototype.getDropdown=function(ts,ctx,po){var channelSuffix=this.channel.getSuffix();var quantities=po&&po.newSplit?po.newSplit:ts.getSplits().toArray();try{quantities=quantities.sort(function(a,b){return(parseInt(a)-parseInt(b));});}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);}
var dropdown="";dropdown+=PingoutView.addCartSelect(quantities,this.filter.getQuantity(),channelSuffix);return dropdown;};function SurveyView(cb){$('div#surveyModal').jqm({modal:false,trigger:false,overlay:1,closeClass:'closeSurveyModal',onHide:function(h){h.w.hide();h.o.remove();if(typeof(SeatsPageController)!="undefined"){var view=SeatsPageController.view;if(view.inactivityPopup&&!view.inactivityPopup.disabled)
view.inactivityPopup.setTimer();}},onShow:function(h){if(typeof(SeatsPageController)!="undefined"){var view=SeatsPageController.view;if(view.inactivityPopup&&!view.inactivityPopup.disabled)
view.inactivityPopup.clearTimer();}
h.w.show();}});var self=this;$('#surveyModalContent').click(function(e){if(e.target.id=='survey-yes'){document.location='/post-purchase/'+self.ticketSet.getId();if(cb)cb('yes');return false;}else if(e.target.id=='survey-no'){self.updateView(false,true);self.purchased='no';var ifs=$('.inc-if');for(var i=0;i<ifs.length;i++){var id=ifs[i].id;if(id.indexOf("slif-surveyh")==0){try{top.resizeInclusion(id);}catch(e){}}}
if(cb)cb('no');return false;}else if(e.target.id=='survery-submit'||e.target.id=='survery-submit-yes'){var params=self.buildParams();if(params){Survey.call(params);self.close();if(cb)cb('submit');}}else if(e.target.id=='survey-cancel'){self.close();if(cb)cb('cancel');}});};SurveyView.prototype.buildParams=function(){var cbsStr="";if(this.purchased=='no'){var cbs=$('input[name=survey-cb]');for(var i=0;i<cbs.length;i++){if(cbs[i].checked)
cbsStr+=cbs[i].value+"|";}}
var other=$('#other-reason_text').val();if(this.purchased=='yes'||cbsStr.length>0||other.length>0){var email_field=this.purchased=='yes'?$('#survey-email-yes'):$('#survey-email');var opt_in_field=this.purchased=='yes'?$('#email-opt-in-yes'):$('#email-opt-in');return{tsid:this.ticketSet.getId(),ctx:this.ctx,brk:this.ticketSet.getAttribute('brokerId'),pur:this.purchased=='yes',reason:cbsStr,email:email_field.val(),opt_in:opt_in_field.attr('checked'),other:other}}else{return null;}};SurveyView.prototype.updateView=function(yes,no){yes?($('#survey-yes-msg').show()&&$('.survey-msg-top').hide()):($('#survey-yes-msg').hide()&&$('.survey-msg-top').show());no?($('#survey-no-msg').show()&&$('.survey-msg-top').hide()):($('#survey-no-msg').hide()&&$('.survey-msg-top').show());};SurveyView.prototype.show=function(click,displaySurvey,displayPopupGuard,channel_name,isLitePingout){this.resetForm();this.ticketSet=click.ts;this.ctx=click.ctx;this.dealId=click.dealId;this.broker=this.ticketSet.getBroker(this.dealId);this.ticketSetId=this.dealId?this.dealId:this.ticketSet.getId();this.quantity=click.quantity;this.updateView(false,false);isLitePingout=isLitePingout?true:false;if(displayPopupGuard){$('.new-window-provider').html(unescape(this.broker));var linkLocation='';if(SeatsPageController.model.newWindowPingout){linkLocation=SeatsPageController.generatePingoutUrl(this.ticketSetId,this.ctx,this.dealId,isLitePingout);}else{linkLocation='/checkout/clickout/'+this.ticketSetId+'?ctx='+escape(this.ctx)+'&ch='+channel_name+'&quantity='+this.quantity;}
$('#new-window-link').attr('href',linkLocation);$('#new-window').show();$('#survey-content').hide();var self=this;setTimeout(function(){$(window).focus(function(){if(displaySurvey){$('#new-window').hide();$('#survey-content').show();}else{$('div#surveyModal').jqmHide();}
$(window).unbind('focus');});$('#survey-provider').html(unescape(self.broker));$('#survey-provider-small').html(unescape(self.broker));var results=SeatsPageController.view.generateBvContent();if(results.cnt>0&&results.html){$('.hasBvTixText').show();$('#survey-bv-content').html(results.html);}else{$('.hasBvTixText').hide();}},1000);}else{$('#new-window').hide();}
$('div#surveyModal').jqmShow();window.scrollBy(0,-1000000);};SurveyView.prototype.resetForm=function(){var cbs=$('input[name=survey-cb]');var cbsStr="";for(var i=0;i<cbs.length;i++){cbs[i].checked=false;}
$('#other-reason_text').val('');$('#email-opt-in').attr('checked','checked');};SurveyView.prototype.close=function(){$('div#surveyModal').jqmHide();};function SeatsView(){}
SeatsView.prototype={addListener:function(event,callback){$(this).bind(event,callback);},viewReady:function(){$(this).trigger('initialized');},priceRangeChanged:function(min,max,excludes){if(this.inactivityPopup){this.inactivityPopup.resetTimer('priceFilter');}
this.killFantip('ps1');$(this).trigger('priceRange',[min,max,excludes]);},seatCountChanged:function(cnt){if(this.inactivityPopup){this.inactivityPopup.resetTimer('quantityFilter');}
this.killFantip('fl1');$(this).trigger('seatCount',cnt);},zoomChanged:function(oldz,newz){if(this.inactivityPopup){this.inactivityPopup.resetTimer('mapZoom');}
$(this).trigger('zoom',[oldz,newz]);},providerFilterChanged:function(providers){if(this.inactivityPopup){this.inactivityPopup.resetTimer('providerFilter');}
this.killFantip('fl1');$(this).trigger('providerSet',providers);PageUet.rec("flt=broker_filter");},sectionFilterChanged:function(sections){if(this.inactivityPopup){this.inactivityPopup.resetTimer('sectionFilter');}
this.killFantip('fl1');$(this).trigger('sectionSet',sections);PageUet.rec("flt=section_filter");},areaFilterChanged:function(areas){if(this.inactivityPopup){this.inactivityPopup.resetTimer('areaFilter');}
this.killFantip('fl1');$(this).trigger('areaSet',areas);PageUet.rec("flt=area_filter");}};JSHybridView.prototype=new SeatsView;JSHybridView.prototype.constructor=JSHybridView;function JSHybridView(model,alertData,channel,options){this.inactivityPopupOptions=options.view.inactivityPopupOptions;this.useIds=options.useIds;this.model=model;this.events=model.events;this.venue=model.getVenue();this.tickets=null;this.tilesURL=this.venue.getAttribute('tilesURL');this.viewsURL=this.venue.getAttribute('viewsURL');this.center=this.venue.getAttribute('center');if(this.center){this.center.longitude=this.center.longitude+.0003;};this.tileOffSet=this.venue.getAttribute('tileOffSet');this.pixelOffSet=null;this.options=options;this.bvConfig=options.view.props.bv;this.psConfig=options.view.props.ps;this.colors=options.colors;this.gMarkers=new Array();this.iconCache=new Array();this.zoomLevel=options.view.defaultZoom;this.zoomRange=options.view.props.zoomRange;this.stats={};this.initViewSpecs();this.useNewFilterMethod=options.useNewFilterMethod;this.atmEnabled=options.view.props.atmEnabled;this.drawPolygons=options.view.props.drawPolygonsEnabled;this.shadowEnabled=options.view.props.shadowEnabled;this.surveyEnabled=options.view.props.surveyEnabled;this.shortListEnabled=options.view.props.shortListEnabled;this.popupGuardEnabled=options.view.props.popupGuardEnabled;this.polygonStrokeStyle=options.view.props.polygonStrokeStyle;this.showDeals=options.showDeals;this.brokerTemplates=options.view.brokerTemplates;JSHybridView.loadingImage=options.view.props.images.loading;this.pixelTrackingUrl=options.pixelTrackingUrl;this.affiliateMerchantId=options.affiliateMerchantId;this.mapType=model.mapType;this.seriesType=model.seriesType;this.minWidth=options.view.props.window.minWidth;$('#doc3,#doc4').css('min-width',this.minWidth+'px')
this.minHeight=options.view.props.window.minHeight;this.channel=channel;this.showEmptyAlertMessage=alertData&&alertData.total>0;this.listBuilder=new ListBuilder(this.colors,this.seriesType);PageUet.rec("init="+(new Date().getTime()));var self=this;if(this.staticMap()){var staticMapElement=$('img#staticmap');this.staticMapSize={width:staticMapElement.width(),height:staticMapElement.height()};}
if(this.interactiveMap()||this.staticMap()){this.resizeMap();}
if(this.interactiveMap()){this.initMap();this.map.savePosition();$('#pan-reset').click(function(){self.map.returnToSavedPosition();});$('#pan-top').click(function(){self.map.panDirection(0,1);});$('#pan-right').click(function(){self.map.panDirection(1,0);});$('#pan-btm').click(function(){self.map.panDirection(0,-1);});$('#pan-left').click(function(){self.map.panDirection(-1,0);});}
if(this.staticMap()||this.interactiveMap()){$(window).bind('resize',function(){self.resizeMap();});}
if(this.shortListEnabled){this.initTabs();}
this.initFantips();PageUet.rec(this.getUetCfgStr());}
JSHybridView.prototype.initialize=function(model,params,hasSharedItems){this.hasSharedItems=hasSharedItems;this.brokers=model.brokers;this.maxHistPrice=0;try{var hist=SeatsData.priceHistogramBuckets;this.maxHistPrice=hist[1].table.min+hist[hist.length-1].table.min;}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);}
this.filter=params;PageUet.rec("initflt="+this.filter.toString());this.tlmgr=model.tsm;this.stats.totalSets=this.venue.getTicketSetsCount();this.stats.visibleSets=this.venue.getTicketSetsCount();this.stats.totalTickets=this.venue.getQuantity();this.confirmSeats=(this.options.confirmSeats&&(this.filter.quantity==0));this.renderFilters(model.refinementData);if(this.interactiveMap()){this.preloadMarkers(model,params);}
var self=this;this.pingoutView=new PingoutView({filter:this.filter,venue:this.venue,brokers:this.brokers,channel:this.channel,ugcMgr:SeatsPageController.ugcMgr,clickHandler:function(click){self.clickHandler(click);}});if(this.surveyEnabled||this.popupGuardEnabled){this.surveyView=new SurveyView(function(action){PageUet.rec("ev=survey-"+action);});}
if(this.bvConfig.modal.enabled){this.initBestValueModal();var uetEv="ev=bvon";$('.bv-button').show();if(this.bvConfig.modal.showOnInit){if(this.inactivityPopupOptions){this.inactivityPopup=new InactivityPopup(this.inactivityPopupOptions);}
uetEv+="-init";this.toggleBestValues();}
PageUet.rec(uetEv);}
this.filterList(params,function(){if(self.interactiveMap()){self.filterMap(self.filter);}
$('#list-loader').hide();self.logLoadTime();if(self.bvConfig.modal.enabled){var bvResults=self.generateBvContent();$('#bvModalContent').html(bvResults.html);$('.bv-header-waiting').hide();if(!bvResults.cnt){self.toggleBestValues();$('div.bv-button').hide();}
$('.bv-header-loaded').show();$('.bv-header-holder').click(function(){$('.bv-body-holder').slideToggle();});$('.bv-body-holder').slideToggle();}
if(!self.inactivityPopup&&self.inactivityPopupOptions){self.inactivityPopup=new InactivityPopup(self.inactivityPopupOptions);}
self.pageLoaded=true;if(_fsSpToId)
clearTimeout(_fsSpToId);$('#page-not-loading').hide();});this.totalReviews=this.model.reviewSummary&&this.model.reviewSummary.reviews?this.model.reviewSummary.reviews:0;this.totalMedia=this.model.reviewSummary&&this.model.reviewSummary.media?this.model.reviewSummary.media:0;this.photoViewer=fsTop.photoViewer;this.bindControls();this.viewReady();};JSHybridView.prototype.clickHandler=function(click){if(this.inactivityPopup){this.inactivityPopup.resetTimer('clickout');}
this.clickTracker(click);if(this.surveyView&&!click.redirect){this.showSurvey(click);}};JSHybridView.prototype.showSurvey=function(click,isLitePingout){if(typeof(FBPackage)!='undefined'){FBPackage.Invitation.setEventId(click.ts.getAttribute('event').id);}
this.surveyView.show(click,this.surveyEnabled,this.popupGuardEnabled,this.channel.name,isLitePingout);};JSHybridView.prototype.getUetCfgStr=function(){var sz=BrowserUtil.getSize();var cfg="_cfg=";cfg+="evtype:"+this.seriesType+";";cfg+="deals:"+this.showDeals+";";cfg+="poly:"+this.drawPolygons+";";cfg+="seats:"+this.options.confirmSeats+";";cfg+="dim:"+sz.w+"x"+sz.h+";";cfg+="bv:"+this.bvConfig.modal.enabled;return cfg;};JSHybridView.prototype.clickTracker=function(click){ClickHelper.recordClick(click);ClickHelper.trackAffiliate(click,this.affiliateMerchantId);};JSHybridView.prototype.resizeMap=function(){var windowHeight=$(window).height();if($.browser.msie&&$.browser.version.substr(0,3)<"7.0"){var windowWidth=$(window).width();if(windowWidth<this.minWidth){windowWidth=this.minWidth+20;}
$('#doc3,#doc4').width(windowWidth);}
if(windowHeight<this.minHeight){windowHeight=this.minHeight;}
var heightOffset=$.browser.msie?45:37;var hasFooter=$('#footer').length>0;var hasEventHeader=$('#header-seatmap').length>0;if(hasFooter){heightOffset+=84;}
if(hasEventHeader){heightOffset+=23;}
$('#map-wrapper').height(windowHeight-heightOffset);$('#results').height("100%");$('#tabContainer').height("100%");var tabsHeight=(this.shortListEnabled?0:27);$('#scroll-wrapper').height($('#tabContainer').height()-58+tabsHeight+"px");$('#seats-list-wrapper').height($('#tabContainer').height()-58+tabsHeight+"px");$('#seats-list-wrapper-ads').height($('#tabContainer').height()-208+tabsHeight+"px");if(this.map){this.map.checkResize();if(this.mapCenter){this.map.panTo(self.mapCenter);}}
if(this.staticMap()){if($('#staticMapHolder').width()<this.staticMapSize.width&&$('#staticMapHolder').height()>this.staticMapSize.height*($('#staticMapHolder').width()/this.staticMapSize.width)){$('#staticmap').width('');$('#staticmap').height('');$('#staticmap').width($('#staticMapHolder').width());}else if($('#staticMapHolder').height()<this.staticMapSize.height){$('#staticmap').width('');$('#staticmap').height('');$('#staticmap').height($('#staticMapHolder').height());}else{$('#staticmap').width('');$('#staticmap').height('');}}};JSHybridView.prototype.initFantips=function(){var fantips=this.options.fantips;if(fantips){var self=this;for(var i=0;i<fantips.length;i++){if(fantips[i]=='sl2'){$('#fantip-sl2').jqm({overlay:0,onShow:function(h){if(!this.fantipSeenSL2){h.w.css({top:$('#s-tab').offset().top+20,left:$('#s-tab').offset().left-90}).show();}},onHide:function(h){h.w.hide();this.fantipSeenSL2=true;self.killFantip('sl2');},closeClass:'fantip-close'});}else{$('#fantip-'+fantips[i]+'-close').click(function(){var tip_id=this.id.replace('-close','').replace('fantip-','');self.killFantip(tip_id);});}}}};JSHybridView.prototype.killFantip=function(id){var current_fts_cookie=$.cookie('fts1');$('#fantip-'+id).remove();if(!current_fts_cookie||!current_fts_cookie.match(id)){var cval=current_fts_cookie?current_fts_cookie+','+id:id;fsTop.channel.setPersistentCookie('fts1',cval);}};JSHybridView.prototype.interactiveMap=function(){return this.mapType=='interactive';}
JSHybridView.prototype.staticMap=function(){return this.mapType=='static';}
JSHybridView.prototype.listView=function(){return this.mapType=='none';}
JSHybridView.prototype.getViewSpecs=function(){return this.viewSpecs;}
JSHybridView.prototype.initViewSpecs=function(){var spec=this.options.view.spec;this.viewSpecs=new Array();for(var i=0;i<spec.length;i++){if(spec[i]){this.viewSpecs[spec[i].level]=spec[i];}}
var last=null;for(var i=0;i<this.viewSpecs.length;i++){if(this.viewSpecs[i])
last=this.viewSpecs[i];else
this.viewSpecs[i]=last;}};JSHybridView.prototype.bindClearFilters=function(){var self=this;function resetInputs(){$('select#seat_count').val(self.filter.getQuantity()==0?'Any':self.filter.getQuantity());var priceRange=self.filter.getPriceRange();$('#priceSlider').slider('value',priceRange.max==Infinity?self.maxHistPrice:priceRange.max);if(fsTop.broker_filter){fsTop.broker_filter.reset();}
if(fsTop.locationList){fsTop.locationList.reset();}
if(fsTop.section_filter){fsTop.section_filter.reset();}}
$('#clearFilters').click(function(){self.filter.reset();resetInputs();PageUet.rec("flt=reset");return false;});};JSHybridView.prototype.bindControls=function(){var self=this;var slider=$('#histogram > .histogram-slider');var minElem=$('input#seat_stat_min_price');var maxElem=$('input#seat_stat_max_price');$('#priceSlider').slider({orientation:"horizontal",range:"min",min:0,max:self.maxHistPrice,value:self.filter.priceRange.max==Infinity?self.maxHistPrice:self.filter.priceRange.max,change:function(event,ui){var val=ui.value
if(val>=self.maxHistPrice){val=Infinity;}
maxElem.val(val>=self.maxHistPrice?'Max':val);self.priceRangeChanged(0,val);PageUet.rec("flt=prs");},slide:function(event,ui){maxElem.val(ui.value);}});maxElem.typeWatch({captureLength:0,highlight:false,callback:function(){var match=this.el.value.match(/\d+/);$('#priceSlider').slider('value',(match&&(parseInt(match[0])<self.maxHistPrice)?parseInt(match[0]):Infinity));}});$('input#seat_stat_min_price, input#seat_stat_max_price').focus(function(){$(this).attr('title',$(this).val());$(this).val('');});$('input#seat_stat_min_price, input#seat_stat_max_price').blur(function(){if($(this).val()==''){$(this).val($(this).attr('title'));}});$('#histogram .bar').click(function(){var id_string=this.id;var splitted_id=id_string.split('_');var slider=$('#histogram > .histogram-slider');var minPrice=parseInt(splitted_id[1]);var maxPrice=parseInt(splitted_id[2]);SeatsPageController.disableFiltering();if(slider.slider('values',1)>maxPrice){slider.slider('values',0,minPrice);slider.slider('values',1,maxPrice);}else{slider.slider('values',1,maxPrice);slider.slider('values',0,minPrice);}
SeatsPageController.enableFiltering();SeatsPageController.processFilter();});$('select#seat_count').change(function(){self.seatCountChanged($(this).val());PageUet.rec("flt=num");});$('select#sort_by').change(function(){var thisElem=this;setTimeout(function(){try{var flds=$(thisElem).val().split("_");self.sortList(flds[0],flds[1]);PageUet.rec("flt=sort_"+flds);}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);debug("list sort: "+e);}},50);});$('a#locationSort, a#priceSort').click(function(e){var field='price';var direction='asc';if(this.id=='locationSort'){field='section';$('a#priceSort').removeClass('filter-down').removeClass('filter-up');}else{$('a#locationSort').removeClass('filter-down').removeClass('filter-up');}
if(!$(this).hasClass('filter-down')){$(this).removeClass('filter-up');$(this).addClass('filter-down');}else{$(this).removeClass('filter-down');$(this).addClass('filter-up');direction='desc';}
setTimeout(function(){try{self.sortList(field,direction);PageUet.rec("flt=sort_"+[field,direction]);}catch(e){var trace=printStackTrace().join(',');SeatsPageController.recordException(e,trace);debug("list sort: "+e);}},50);});if(this.interactiveMap()){GEvent.addListener(this.map,'zoomend',function(oldzoom,newzoom){var max=self.viewSpecs.length-1;newzoom=Math.max(Math.min(23-newzoom,max),0);oldzoom=Math.max(Math.min(23-oldzoom,max),0);self.zoomLevel=newzoom;var spec=self.getViewSpecs();if(spec[oldzoom].type!=spec[newzoom].type||spec[oldzoom].config!=spec[newzoom].config){if(self.markerRanges){for(var i=0;i<self.markerRanges.length;i++){var markerRange=self.markerRanges[i];if(self.zoomLevel>=markerRange.low&&self.zoomLevel<=markerRange.high){self.gMarkers=markerRange.markers;if(self.useNewFilterMethod){self.toggleMarkers(self.gMarkers,self.filter);}else{self.updateMarkers(self.gMarkers,self.filter);}
self.gMarkerManager.refresh();break;}}}}
$('#zoom-level-slider').slider('option','value',5-newzoom);self.zoomChanged(oldzoom,newzoom);PageUet.rec("zoom="+oldzoom+"-"+newzoom);});}
$('form#formFilter').submit(function(){return false;});this.bindClearFilters();this.initSmartAlert();this.initFilterModal();};JSHybridView.prototype.initBestValueModal=function(){var self=this;$('#bvModal').jqm({modal:false,overlay:1,closeClass:'closeBVModal',onHide:function(h){h.w.hide();h.o.remove();if(self.inactivityPopup&&!self.inactivityPopup.disabled)
self.inactivityPopup.setTimer();},onShow:function(h){var bvResults=self.generateBvContent();if(bvResults.html){if(self.inactivityPopup&&!self.inactivityPopup.disabled)
self.inactivityPopup.clearTimer();$('#bvModalContent').html(bvResults.html);h.w.show();}
PageUet.rec("ev=bvshow;"+bvResults.cnt+";"+bvResults.total);}});};JSHybridView.prototype.generateBvContent=function(){var tempHead="<tr class='modal-table-header'><th>Location</th><th class='bv-price-header'>Price</th><th>Avg Price</th><th class='bv-diff-head'>You Save!</th><th>Became Available</th><th class='bv-view-button-holder-h'></th></tr>";var tempRow="<tr class='modal-table-body'><td class='bv-loc-body'><a href='javascript:InlineUtil.selectBestValueDeal(#{ind},\"#{type}\",#{pos});'>#{sec}</a></td><td class='bv-price-body'>$#{price}<span>ea</span></td><td>$#{avg}</td><td class='bv-diff-body'>#{save}%</td><td class='bv-time-body'>#{ago} #{dbg}</td><td  class='bv-view-button-holder-b'><div class='bv-button-hldr'><a href='javascript:InlineUtil.selectBestValueDeal(#{ind},\"#{type}\",#{pos});'>view</a></div></td></tr>";var bv=null;var ps=null;var content=this.options.view.props.bvModalContent;if(content=='bv'){bv=this.model.bv;}else if(content=='ps'){ps=this.model.ps;}else if(content=='both'){bv=this.model.bv;ps=this.model.ps;}
var cnt=0;var total=bv?bv.length:-1;var html=null;var displayTix=[];if(ps){if(!html)
html=tempHead;var o=null;for(var i=0;i<ps.length;i++){var tix=null;var srId=ps[i].s.getGeomId();for(var j=0;j<this.model.index.ps.length;j++){if(this.model.premiumSections.sections[srId]=='section'){if(srId==this.model.index.ps[j].getAttribute('sId')){tix=this.model.index.ps[j];break;}}else if(this.model.premiumSections.sections[srId]=='row'){if(srId==this.model.index.ps[j].getAttribute('rId')){tix=this.model.index.ps[j];break;}}}
if(tix&&(this.bvConfig.modal.reqSeats==-1||tix.getSplits().contains(this.bvConfig.modal.reqSeats))&&tix.getPriceRange().min<parseInt(ps[i].a)){cnt++;var ts=tix.getAttribute('ts');var tsDiff=new Date()-new Date(ts);var ago=InlineUtil.bvAgeString(tsDiff);var dbg="";if(fsTop.debugEnabled){dbg=tix.getSplits().toString()+";"+new Date(ts);}
o={ind:i,sec:this.model.premiumSections.name,price:tix.getPriceRange().min,min:ps[i].m,max:ps[i].x,avg:parseInt(ps[i].a),save:parseInt((ps[i].a-tix.getPriceRange().min)*100/ps[i].a),ago:ago,type:'ps',dbg:dbg};displayTix.push(o);}}}
if(bv){if(!html)
html=tempHead;var o=null;for(var i=0;i<bv.length;i++){var tix=null;var secName=bv[i].s.getName();for(var j=0;j<this.model.index.bv.length;j++){if(secName==this.model.index.bv[j].getAttribute('sectionName')){tix=this.model.index.bv[j];break;}}
if(tix&&(this.bvConfig.modal.reqSeats==-1||tix.getSplits().contains(this.bvConfig.modal.reqSeats))){cnt++;var ts=tix.getAttribute('ts');var tsDiff=new Date()-new Date(ts);var ago=InlineUtil.bvAgeString(tsDiff);var dbg="";if(fsTop.debugEnabled){dbg=tix.getSplits().toString()+";"+new Date(ts);}
o={ind:i,sec:secName,price:tix.getPriceRange().min,min:bv[i].m,max:bv[i].x,avg:parseInt(bv[i].a),save:parseInt((bv[i].a-tix.getPriceRange().min)*100/bv[i].a),ago:ago,type:'bv',dbg:dbg};displayTix.push(o);}}}
displayTix.sort(function(a,b){return a.price-b.price});for(var j=0,sz=displayTix.length;j<sz;++j){displayTix[j].pos=j;html+=Template.apply(tempRow,displayTix[j]);}
if(html){html="<table width='100%' style='padding: 4px'>"+html+"</table>";}
bvResults={html:html,cnt:cnt,total:total};return bvResults;}
JSHybridView.prototype.initFilterModal=function(){var minElem=$('input#modal_seat_stat_min_price');var maxElem=$('input#modal_seat_stat_max_price');$('#modal_histogram').bind('onSlide',function(_,min,max){var maxValue=max;var minValue=min;if(max>=self.maxHistPrice){var match=maxElem.val().match(/\d+/);if(match&&parseInt(match[0])>max){maxValue=parseInt(match[0]);}else{maxElem.val('Max');maxValue=Infinity;}}else{maxElem.val(max);}
if(min+1>=self.maxHistPrice){var match=minElem.val().match(/\d+/);if(match&&parseInt(match[0])>=maxValue){minElem.val(maxValue-1);}}else{minElem.val(min);}});minElem.typeWatch({captureLength:0,highlight:false,callback:function(){var match=this.el.value.match(/\d+/);$('#modal_histogram > .histogram-slider').slider('values',0,(match?parseInt(match[0]):0));}});maxElem.typeWatch({captureLength:0,highlight:false,callback:function(){var match=this.el.value.match(/\d+/);$('#modal_histogram > .histogram-slider').slider('values',1,(match?parseInt(match[0]):Infinity));}});minElem.focus(function(){$(this).attr('title',$(this).val());$(this).val('');});maxElem.focus(function(){$(this).attr('title',$(this).val());$(this).val('');});minElem.blur(function(){if($(this).val()==''){$(this).val($(this).attr('title'));}});maxElem.blur(function(){if($(this).val()==''){$(this).val($(this).attr('title'));}});$('#modal_histogram .bar').click(function(){var id_string=this.id;var splitted_id=id_string.split('_');var slider=$('#modal_histogram > .histogram-slider');var minPrice=parseInt(splitted_id[2]);var maxPrice=parseInt(splitted_id[3]);if(slider.slider('values',1)>maxPrice){slider.slider('values',0,minPrice);slider.slider('values',1,maxPrice);}else{slider.slider('values',1,maxPrice);slider.slider('values',0,minPrice);}});$('a#selectAllLocationModal').click(function(){$('#locationModalList input').attr('checked','checked');return false;});$('a#clearAllLocationModal').click(function(){$('#locationModalList input').attr('checked','');return false;});this.modalFilterHandler=new TicketFilterHandler("modal",this.filter,this);this.pageFilterHandler=new TicketFilterHandler("",this.filter,this);var self=this;$('#filterModal').jqm({modal:false,overlay:1,trigger:'a.showFilterModal',onShow:function(h){if(self.inactivityPopup&&!self.inactivityPopup.disabled){self.inactivityPopup.resetTimer('filterWizard');}
PageUet.rec("ev=needhelp");h.w.show();self.modalFilterHandler.setControls();if(self.useIds&&!self.areaFilterModal){self.areaFilterModal=new AreaFilter({domId:'locationModalList',filter:self.filter,eventId:self.events[0].id});}},onHide:function(h){h.w.hide();h.o.remove();if(self.inactivityPopup&&!self.inactivityPopup.disabled)
self.inactivityPopup.setTimer();},closeClass:'closeFilterModal'});$('#brokerFilterModal').jqm({modal:false,closeClass:'closeBrokerFilterModal',overlay:1,onHide:function(h){h.w.hide();h.o.remove();},onShow:function(h){h.w.show();}});$('#arsecFilterModal').jqm({modal:false,closeClass:'closeArsecFilterModal',overlay:1,onHide:function(h){h.w.hide();h.o.remove();},onShow:function(h){h.w.show();}});$("#filter_modal_form").submit(function(){PageUet.rec("ev=popfiltsubmit");SeatsPageController.disableFiltering();self.modalFilterHandler.setFilter();self.pageFilterHandler.setControls();if(fsTop.locationList){fsTop.locationList.resetToUI();}
if(fsTop.section_filter){fsTop.section_filter.resetToUI();}
SeatsPageController.enableFiltering();SeatsPageController.processFilter();$('#filterModal').jqmHide();return false;});};JSHybridView.prototype.initSmartAlert=function(){var self=this;$('#smartAlertModal').jqm({trigger:'a#setSmartAlert',closeClass:'closeSmartAlertForm',modal:false,overlay:1,onHide:function(hash){$('#alertSuccess').hide();$('#alertFormDialog').show();hash.w.hide();hash.o.remove();if(self.inactivityPopup&&!self.inactivityPopup.disabled)
self.inactivityPopup.setTimer();},onShow:function(hash){var summary=self.getFilterTextSummary();$('#alertConditions').html(summary);hash.w.show();if(self.inactivityPopup&&!self.inactivityPopup.disabled)
self.inactivityPopup.clearTimer();}});$('form#alertForm').submit(function(){var form=$(this);if(form.find('input#email').val().length<=1){$('#alertNotice').html('Please provide a valid email address');}else{$('#alertFormDialog').hide();$('#alertProgress').show();SeatsPageController.setSmartAlert(form.attr('action'),escape(form.find('input#email').val()),form.find('input[name=authenticity_token]').val());}
return false;});};JSHybridView.prototype.getFilterTextSummary=function(){var summary=[];if(this.filter.priceRange.min!=0&&this.filter.priceRange.max!=Infinity){summary.push('Price from $'+this.filter.priceRange.min+' to $'+
this.filter.priceRange.max);}else if(this.filter.priceRange.min!=0){summary.push('Price from $'+this.filter.priceRange.min+' or higher');}else if(this.filter.priceRange.max!=Infinity){summary.push('Price up to $'+this.filter.priceRange.max);}
if(this.filter.quantity==1){summary.push('With one seat');}else if(this.filter.quantity>0){summary.push('With '+this.filter.quantity+' seats together');}
var locations=[];if(this.useIds){var areaNames=[];var sectionNames=[];var providerNames=[];for(var k in this.filter.areas.keys){var labelValue=$('input.modal_flt_area[value='+k+']').siblings('label').text();if(labelValue){areaNames.push(labelValue);}else{areaNames.push($('input.flt_area[value='+k+']').siblings('.in-map-filter-labels').find('label').text());}}
for(var k in this.filter.sections.keys){var labelValue=$('input.modal_flt_sec[value='+k+']').siblings('label').text();if(labelValue){sectionNames.push(labelValue);}else{sectionNames.push($('input.flt_sec[value='+k+']').siblings('label').text());}}
if(areaNames.length>0){locations=locations.concat(areaNames);}
if(sectionNames.length>0){locations=locations.concat(sectionNames);}}else{if(this.filter.areas.count>0){locations=locations.concat(this.filter.areas.toArray());}else if(this.filter.sections.count>0){locations=locations.concat(this.filter.sections.toArray());}}
if(locations.length>0){summary.push("From these areas/sections: "+"<ul class='sm-alert-sub-list'><li>"+locations.join("</li><li>")+"</li></ul>");}
if(this.filter.providers.count>0){for(var k in this.filter.providers.keys){var labelValue=$('input.flt_brk[value='+k+']').siblings('.in-map-filter-labels').find('label').text();if(labelValue){providerNames.push(labelValue.match(/(.*) \(/)[1]);}}
summary.push('From these providers: '+providerNames.join(', '));}
return"<ul class='sm-alert-list'><li>"+summary.join("</li><li>")+"</li></ul>";};JSHybridView.prototype.renderFilters=function(filterData){if(filterData){if(filterData.locationFilterHtml){$('div#arsecFilterModal .modal-container').html(filterData.locationFilterHtml);}
if(filterData.brokerFilterHtml){$('div#brokerFilterModal .modal-container').html(filterData.brokerFilterHtml);$('li.moreFiltersProviders > h2').text("Providers ("+fsTop.broker_filter.filterItems+")");}
if(filterData.locationModalFilterHtml){$('div#locationModalList').html(filterData.locationModalFilterHtml);}else{$('div#locationModalFilter').remove();}
if(filterData.priceHistogramModalFilterHtml){$('div#priceHistogramModal').html(filterData.priceHistogramModalFilterHtml);$('div#filterModal').css('visibility','visible');}}};JSHybridView.prototype.initTabs=function(){var self=this;$('#tabContainer > ul').tabs({show:function(e,u){if(u.index==1){self.killFantip('sl2');PageUet.rec("ev=slist");}}});};JSHybridView.prototype.toggleBestValues=function(){if($("#bvModal:visible").length==0)
$('#bvModal').jqmShow();else
$('#bvModal').jqmHide();};JSHybridView.prototype.hideBestValues=function(){$('#bvModal').jqmHide();$('#surveyModal').jqmHide();};JSHybridView.prototype.hideLoading=function(delay){var self=this;var hide=function(){PageUet.rec("initend="+(new Date().getTime()));$('input#headliner_name').focus();if(self.hasSharedItems){self.switchListTabs(1);}}
if(delay){setTimeout(hide,delay);}else{hide();}};JSHybridView.prototype.confirmSeatNum=function(cnt){this.confirmSeats=false;this.hideLoading();if(cnt){$('select#seat_count').val(cnt);PageUet.rec("ev=seatconf-"+cnt);this.seatCountChanged(cnt);}else{PageUet.rec("ev=seatconf-none");}};JSHybridView.prototype.preloadMarkers=function(model,filter){this.initConfigRanges();for(var i=this.markerRanges.length-1;i>=0;i--){var cfgSet=this.markerRanges[i];var zoom_low=cfgSet.low;var zoom_high=cfgSet.high;var nodes=model.getNodes(cfgSet.type);this.markerRanges[i].markers=new Array();for(var j=0;j<nodes.length;j++){var m=this.createMarker(nodes[j],zoom_low);this.gMarkerManager.addMarker(m,23-zoom_high,23-zoom_low);this.markerRanges[i].markers.push(m);}
if(this.zoomLevel<=zoom_high&&this.zoomLevel>=zoom_low){this.gMarkers=this.markerRanges[i].markers;if(this.useNewFilterMethod){this.toggleMarkers(this.gMarkers,filter);}else{this.updateMarkers(this.gMarkers,filter);}
this.gMarkerManager.refresh();}}};JSHybridView.prototype.initConfigRanges=function(){var list=this.viewSpecs;this.markerRanges=new Array();for(var i=0;i<list.length;i++){if(i==0){this.markerRanges.push({low:i,high:i,type:list[i].type,config:list[i].config});}else{var lastMarkerRange=this.markerRanges[this.markerRanges.length-1];if(lastMarkerRange.type==list[i].type&&lastMarkerRange.config==list[i].config){lastMarkerRange.high++;}else{this.markerRanges.push({low:i,high:i,type:list[i].type,config:list[i].config});}}}};JSHybridView.prototype.initMap=function(){this.pixelOffSet={x:this.tileOffSet.x*256,y:this.tileOffSet.y*256};var self=this;var copyCollect=new GCopyrightCollection('FanSnap.com');var copy1=new GCopyright(1,new GLatLngBounds(new GLatLng(0,0),new GLatLng(0,0)),18,"&copy;2008 FanSnap");copyCollect.addCopyright(copy1);var url=this.tilesURL.replace("%d","1");var tilelayers=[new GTileLayer(copyCollect,0,23)];var randomTimeStamp=(new Date()).getTime();tilelayers[0].getTileUrl=function(point,zoom){return url+"z"+zoom+"x"+point.x+"y"+point.y+".png?"+randomTimeStamp;};tilelayers[0].isPng=function(){return true;};tilelayers[0].getOpacity=function(){return 1.0;}
var custommap=new GMapType(tilelayers,new GMercatorProjection(24),"FanSnap");this.map=new GMap2(document.getElementById("map"),{backgroundColor:'#FFF'});this.map.enableContinuousZoom();this.map.addMapType(custommap);var mt=this.map.getMapTypes();for(var i=0;i<mt.length;i++){mt[i].getMinimumResolution=function(){return 23-self.zoomRange.max;}
mt[i].getMaximumResolution=function(){return 23-self.zoomRange.min;}}
function TextualZoomControl(){}
TextualZoomControl.prototype=new GControl();TextualZoomControl.prototype.initialize=function(){var zoomIn=document.getElementById("zoom-in");var zoomOut=document.getElementById("zoom-out");var container=document.getElementById("zoom-ctrl");GEvent.addDomListener(zoomIn,"click",function(){if(self.zoomLevel==self.zoomRange.min)
return;PageUet.rec("ev=clickzoomin");self.map.zoomIn();});GEvent.addDomListener(zoomOut,"click",function(){if(self.zoomLevel==self.zoomRange.max)
return;PageUet.rec("ev=clickzoomout");self.map.zoomOut();});self.map.getContainer().appendChild(container);return container;}
TextualZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_RIGHT,new GSize(10,10));}
self.map.addControl(new TextualZoomControl());this.map.setCenter(new GLatLng(this.center.latitude,this.center.longitude),23-this.zoomLevel,custommap);this.projection=this.map.getCurrentMapType().getProjection();this.gMarkerManager=new GMarkerManager(this.map,{maxZoom:23});$('#zoom-level-slider').slider({orientation:'vertical',step:1,min:1,max:4,value:1,change:function(e,ui){self.killFantip('zs1');self.map.setZoom(23-(5-ui.value));PageUet.rec("ev=zoomslide");}});var centerPixel=this.map.fromLatLngToContainerPixel(this.map.getCenter());var swPoint=new GPoint(centerPixel.x-355,centerPixel.y+275);var nePoint=new GPoint(centerPixel.x+355,centerPixel.y-275);var venueBounds=new GLatLngBounds(this.map.fromContainerPixelToLatLng(swPoint),this.map.fromContainerPixelToLatLng(nePoint));var venueSW=venueBounds.getSouthWest();var venueNE=venueBounds.getNorthEast();GEvent.addListener(this.map,"move",function(){checkBounds();});function checkBounds(){if(self.map.getBounds().intersects(venueBounds)){return;}
var mapSW=self.map.getBounds().getSouthWest();var mapNE=self.map.getBounds().getNorthEast();var mapX=self.map.getCenter().lng();var mapY=self.map.getCenter().lat();if(mapNE.lng()<venueSW.lng()){mapX=venueSW.lng()-(mapNE.lng()-mapX);}
if(mapSW.lng()>venueNE.lng()){mapX=venueNE.lng()+(mapX-mapSW.lng());}
if(mapSW.lat()>venueNE.lat()){mapY=venueNE.lat()+(mapY-mapSW.lat());}
if(mapNE.lat()<venueSW.lat()){mapY=venueSW.lat()-(mapNE.lat()-mapY);}
self.map.setCenter(new GLatLng(mapY,mapX));}};JSHybridView.prototype.switchListTabs=function(to){$('#tabContainer > ul').tabs("select",to);};JSHybridView.prototype.viewFanContent=function(type,key,id){if(type=='media'){PageUet.rec("ev=ugc:vp;id="+id);var splittedKeys=key.split('::');var opts={id:id,section:splittedKeys[0]};if(splittedKeys.length==2){opts.row=splittedKeys[1];opts.title=this.venue.getName()+' - Section '+
splittedKeys[0]+' Row '+opts.row+' Photos';}else{opts.title=this.venue.getName()+' - Section '+
splittedKeys[0]+' Photos';}
this.photoViewer.show(opts);}};JSHybridView.prototype.filterView=function(filter,excludes){this.filter=filter;var self=this;if(this.useNewFilterMethod){$('#mapLoaderMod').show();$('#list-filter-loader').show();$('#seats-list-wrapper').hide();this.tlmgr.setPage(1);this.tlmgr.filter(filter,function(){if(self.interactiveMap()&&(!excludes||!excludes.map)){self.filterMap(filter);$('#mapLoaderMod').hide();}
if(!excludes||!excludes.list){self.filterList(filter);$('#list-filter-loader').hide();$('#seats-list-wrapper').show();}});}else{if(this.interactiveMap()&&(!excludes||!excludes.map)){this.filterMap(filter);}
if(!excludes||!excludes.list){this.filterList(filter);}}
this.updateStatsUI();};JSHybridView.prototype.clearPopups=function(){if(this.atmEnabled){ATMarker.clearOverlays();}else{PdMarkerClearToExtList();}};JSHybridView.prototype.toggleMarkers=function(markers,filter){var statuses=this.tlmgr.markerStatuses;for(var i=0,size=markers.length;i<size;++i){var marker=markers[i];var node=marker.markable;var prefix=node.getType()=='section'?'s':'r';var visible=true;if(statuses){visible=statuses[prefix+node.getGeomId()]?true:false;}
node.setAttribute("visible",visible);var bvTix=node.getAttribute('bvTix');if(bvTix!=null){node.setAttribute('bv',filter.containsTicketSet({providers:bvTix.getAttribute('brokerList'),sections:bvTix.getAttribute('sectionList'),area:(this.useIds?node.getAreaId():node.getAttribute('areaName')),priceRange:bvTix.getPriceRange(),splits:bvTix.getSplits(),deals:bvTix.getType=='comparable'?bvTix.getComparables():null}));}
var psTix=node.getAttribute('psTix');if(psTix!=null){node.setAttribute('ps',filter.containsTicketSet({providers:psTix.getAttribute('brokerList'),sections:psTix.getAttribute('sectionList'),area:(this.useIds?node.getAreaId():node.getAttribute('areaName')),priceRange:psTix.getPriceRange(),splits:psTix.getSplits(),deals:psTix.getType=='comparable'?psTix.getComparables():null}));}
this.setMarkerImage(marker,this.getMarkerImage(node,visible));}};JSHybridView.prototype.updateMarkers=function(markers,filter,r_){var range=r_;if(!range)
range={s:0,e:markers.length}
var nopFilter=filter.isEmpty();for(var i=range.s;i<range.e;i++){var marker=markers[i];var node=marker.markable;node.setAttribute('currMarker',marker);var set={providers:node.getAttribute('brokerList'),sections:node.getAttribute('sectionList'),area:(this.useIds?node.getAreaId():node.getAttribute('areaName')),priceRange:node.getPriceRange(),splits:node.getSplits(),deals:node.getType=='comparable'?node.getComparables():null};var visible=nopFilter||filter.containsTicketSet(set);node.setAttribute("visible",visible);var bvTix=node.getAttribute('bvTix');if(bvTix!=null){node.setAttribute('bv',filter.containsTicketSet({providers:bvTix.getAttribute('brokerList'),sections:bvTix.getAttribute('sectionList'),area:(this.useIds?node.getAreaId():node.getAttribute('areaName')),priceRange:bvTix.getPriceRange(),splits:bvTix.getSplits(),deals:bvTix.getType=='comparable'?bvTix.getComparables():null}));}
this.setMarkerImage(marker,this.getMarkerImage(node,visible));}};JSHybridView.prototype.filterMap=function(filter){this.clearPopups();if(this.useNewFilterMethod){this.tlmgr.getView();this.toggleMarkers(this.gMarkers,filter);}else{this.updateMarkers(this.gMarkers,filter);}
this.gMarkerManager.refresh();};JSHybridView.prototype.filterList=function(filter,init){var self=this;this.tlmgr.setPage(1);if(init){this.tlmgr.filter(filter,function(){self.refreshList();init();});}else{if(this.useNewFilterMethod){$('.ticket-sets-pagination').hide();this.refreshList();}else{this.startListProgress('Loading tickets...');this.tlmgr.filter(filter,function(){self.refreshList();});}}};JSHybridView.prototype.refreshList=function(){this.drawList();if(this.tlmgr.totalPages>1){var self=this;$('.ticket-sets-pagination').pagination(this.tlmgr.totalVisible,{items_per_page:self.tlmgr.perPage,num_edge_entries:1,num_display_entries:3,callback:function(page_id,jq){self.paginateList(page_id+1);paginates=$('.ticket-sets-pagination');for(var i=0;i<paginates.length;i++){if(jq[0]!=paginates[i]){paginates[i].redrawLinks(page_id);}}
PageUet.rec("page="+page_id);}});}
this.stopListProgress();};JSHybridView.prototype.logLoadTime=function(){var totalLoadTime=(new Date).getTime()-fsTop.loadStartTime;PageUet.rec("ttlTime="+totalLoadTime);};JSHybridView.prototype.handleFlagged=function(node){if(this.interactiveMap()){var zoom=Math.max(0,Math.min(this.viewSpecs.length-1,this.zoomLevel));var configType=this.viewSpecs[zoom].type;var markable=null;switch(configType){case'rows':markable=node.getParent();break;case'sections':markable=node.getParent().getParent();}
if(markable){if(markable.getFlaggedCount()<=1){var m=markable.marker;var img=this.getMarkerImage(markable,true);m.setImage(img);m.getIcon().image=img;}
if(markable.marker){markable.marker.reset=true;}}}};JSHybridView.prototype.updateStatsUI=function(){var template="<strong>#{visibleTickets} of #{totalTickets} tickets</strong> [#{visibleSets} of #{totalSets} offers]";this.stats.visibleSets=this.tlmgr.totalVisible;this.stats.visibleTickets=this.tlmgr.totalSeats;$("#stats-summary").html(Template.apply(template,this.stats));$("#stats-total-tickets").html(String(this.stats.totalTickets));$("#stats-matching-tickets").html(String(this.stats.visibleTickets));var offersHeading=this.stats.visibleSets;$("#stats-results").html(String(offersHeading));var slOffersHeading=this.stats.shortListCount;$("#sl-stats-summary").html(String(slOffersHeading));if(slOffersHeading>0){$(".ui-tabs-nav").addClass("ui-tabs-highlighted");}else{$(".ui-tabs-nav").removeClass("ui-tabs-highlighted");$("#short-list").html("<p class=\"empty\">You currently have no items<br/> in your Short List.<br /><br />Click on a&nbsp;&nbsp;<img src=\"/images/icons_sl_grey_lg.png\" alt=\"add to list star\" />&nbsp;&nbsp;to add<br/> a ticket set to your Short List.</p>");}};JSHybridView.replaceHtml=function(el,html){var oldEl=typeof el==="string"?document.getElementById(el):el;if(!oldEl){return;}
var newEl=oldEl.cloneNode(false);newEl.innerHTML=html;oldEl.parentNode.replaceChild(newEl,oldEl);return newEl;};JSHybridView.prototype.getDealsDisplay=function(set,max){var out=new Array(max);var deals=set.getChildren();if(deals.length==0)
deals=[set];var cnt=this.showDeals?Math.min(max,deals.length):0;for(var i=0;i<cnt;i++){out[i]={str:unescape(deals[i].getBroker()+" $"+deals[i].getPriceRange().min),id:deals[i].getId()}}
for(var i=cnt;i<max;i++)
out[i]={str:'',id:0};return out;};JSHybridView.prototype.getListContent=function(tickets,srcCtx,getTemplate){if(!getTemplate)
return;var html="";for(var i=0;i<tickets.length;i++){var set=tickets[i];var tmp=getTemplate(set.getBrokerId(),set.getAttribute('deleted'));var t={offer:fsTop.jsTemplate.ticketSet.base.offer,ticketSet:tmp};html+=this.listBuilder.getTicketSet(set,t,srcCtx);}
return html;};JSHybridView.prototype.highlightMarker=function(ticketSet,show){if(!this.interactiveMap()||!ticketSet)
return;var markerType=this.gMarkers[0].markable.getType();var parent=null;if(markerType=='row')
parent=ticketSet.getParent();else if(markerType=='section'&&ticketSet.getParent())
parent=ticketSet.getParent().getParent();if(parent){var marker=parent.marker;if(this.atmEnabled)
show?marker.showSummary():marker.hideSummary();else
show?marker.showTooltip():marker.hideTooltip();}};JSHybridView.prototype.sortList=function(f,d){var self=this;this.startListProgress('Loading your tickets...');this.tlmgr.setPage(1);this.tlmgr.setSortBy(f,d);this.tlmgr.sort(function(){self.drawList();if(self.tlmgr.totalPages>1){$('.ticket-sets-pagination').pagination(self.tlmgr.totalVisible,{items_per_page:self.tlmgr.perPage,num_edge_entries:1,num_display_entries:3,callback:function(page_id,jq){self.paginateList(page_id+1);paginates=$('.ticket-sets-pagination');for(var i=0;i<paginates.length;i++){if(jq[0]!=paginates[i]){paginates[i].redrawLinks(page_id);}}
PageUet.rec("page="+page_id);}});}
self.stopListProgress();});};JSHybridView.prototype.paginateList=function(page){var self=this;this.startListProgress('Loading tickets...');this.tlmgr.setPage(page);this.tlmgr.dirty=true;this.tlmgr.sort(function(){self.drawList();self.stopListProgress();});};JSHybridView.prototype.startListProgress=function(label){$('.ticket-sets-pagination').hide();$('#seats-list-empty').hide();$('#seats-alert-empty').hide();$('#filterModalSuggest').hide();var list=document.getElementById('seats-list');$('list-loader').hide();var html="<div style='text-align: center; font-weight: bold; margin-top: 20px'>";html+=label+"<br/>";html+="<img width='32' src='"+JSHybridView.loadingImage+"'/></div>";JSHybridView.replaceHtml(list,html);};JSHybridView.prototype.stopListProgress=function(){if(this.tlmgr.totalPages>1){$('.ticket-sets-pagination').show();}};JSHybridView.prototype.updateReviewScores=function(rev,options){var review=rev.getTempObj();var count_text=null;if(options.cnt){count_text=review.useful+pluralLabel(review.useful,' fan',' fans');$("#"+options.cnt).html(count_text).parent().removeClass('display-none');}
if(review.ustu){var clazz=$("#"+options.td)[0].className;if(clazz.indexOf('disable')<0)
$("#"+options.td).removeClass(clazz).addClass(clazz+"-disable");$("#"+options.utext).html('Saved. Thank you.');}
if(review.ustd){var clazz=$("#"+options.tu)[0].className;if(clazz.indexOf('disable')<0)
$("#"+options.tu).removeClass(clazz).addClass(clazz+"-disable");$("#"+options.utext).html('Saved. Thank you.');}
if(review.usia){var clazz=$("#"+options.ia)[0].className;if(clazz.indexOf('disable')<0)
$("#"+options.ia).removeClass(clazz).addClass(clazz+"-disable");$("#"+options.itext).html('Saved. Thank you.');}};JSHybridView.prototype.drawList=function(){var tickets=this.tlmgr.getView();var srcCtx="tix"+(this.listView()?"-lst":"");var templates=this.brokerTemplates;var html=this.getListContent(tickets,srcCtx,function(brokerId,isDeleted){var tmp=templates[brokerId];if(tmp&&fsTop.jsTemplate.ticketSet[tmp])
return fsTop.jsTemplate.ticketSet[tmp].list.row;return fsTop.jsTemplate.ticketSet.base.list.row;});if(tickets.length==0){if(this.showEmptyAlertMessage){$('#seats-alert-empty').show();}else{$('#seats-list-empty').show();}}else{$('#seats-list-empty').hide();$('#seats-alert-empty').hide();if(tickets.length>0){$('#filterModalSuggest').show();}else{$('#filterModalSuggest').hide();}}
this.showEmptyAlertMessage=false;var list=document.getElementById("seats-list");JSHybridView.replaceHtml(list,html);this.updateStatsUI();};JSHybridView.prototype.updateShortList=function(tickets,hasSharedItems){this.stats.shortListCount=tickets.length;var srcCtx="sl"+(this.listView()?"-lst":"");var templates=this.brokerTemplates;var html=this.getListContent(tickets,srcCtx,function(brokerId,isDeleted){var tmp=templates[brokerId];if(tmp&&fsTop.jsTemplate.ticketSet[tmp])
tmp=fsTop.jsTemplate.ticketSet[tmp].list;else
tmp=fsTop.jsTemplate.ticketSet.base.list;return isDeleted?tmp.favDeleted:tmp.fav;});if(tickets.length==0){$('#short-list-empty').show();}else{$('#short-list-empty').hide();}
if(hasSharedItems){$('#sl-share-message').show();}else{$('#sl-share-message').hide();}
var list=document.getElementById("short-list");JSHybridView.replaceHtml(list,html);this.updateStatsUI();};JSHybridView.prototype.createMarker=function(node,zoom){var markerCache=node.getAttribute('markerCache');if(!markerCache){markerCache=new Object();node.setAttribute('markerCache',markerCache);}
zoom=Math.max(0,Math.min(this.viewSpecs.length-1,zoom));var configName=this.viewSpecs[zoom].config;var mck='mck_'+configName;var marker=markerCache[mck];if(marker)
return marker;var geom=node.getGeometry();var colorId={min:this.colors[node.getBucketId().min],max:this.colors[node.getBucketId().max]}
var point=geom.marker;point.x+=this.pixelOffSet.x;point.y+=this.pixelOffSet.y;var latlng=this.projection.fromPixelToLatLng(new GPoint(point.x,point.y),17);var baseIcon=this.getBaseIcon(configName,colorId,node.getQuantity()>1);var icon=new GIcon(baseIcon);icon.image=this.getMarkerImage(node,true);if(this.atmEnabled){marker=new ATMarker(this.map,latlng,icon);marker.markable=node;marker.data={view:this,model:this.model,node:node};node.marker=marker;marker.setDetailsContent(JSHybridView.getNodeDetails);marker.setSummaryContent(JSHybridView.getNodeSummary);marker.setWaitingContent(JSHybridView.getNodeWaiting);marker.setReviewsContent(JSHybridView.getNodeReviews);marker.setOpenCB(JSHybridView.openPopup);marker.setCloseCB(JSHybridView.closePopup);}
markerCache[mck]=marker;return marker;};JSHybridView.openPopup=function(data,type){var node=data.node;if(node){var style=type=='summary'?_config.view.props.polygonStrokeStyle.hover:_config.view.props.polygonStrokeStyle.select;if(style)
JSHybridView.setPolygonVisibility(node.getAttribute('gpolys'),style);}};JSHybridView.closePopup=function(data,type){var node=data.node;if(node)
JSHybridView.setPolygonVisibility(node.getAttribute('gpolys'));};JSHybridView.openReviewsPopup=function(data,type){$(".seat-view-link-lt").hide();var node=data.node;if(node){}};JSHybridView.closeReviewsPopup=function(data,type){$(".seat-view-link-lt").show();var node=data.node;if(node){}};JSHybridView.setPolygonVisibility=function(polygons,style){if(polygons){for(var i=0;i<polygons.length;i++){if(style){polygons[i].setStrokeStyle(style);polygons[i].show();}else{polygons[i].hide();}}}}
JSHybridView.prototype.zoomToPoint=function(){if(ATMarker.currentOverlay){var p=ATMarker.currentOverlay.getLatLng();var zoomTo=22;ATMarker.closeDetails()
this.map.setCenter(p);this.map.setZoom(zoomTo);PageUet.rec("ev=zoomlink-"+zoomTo);}}
JSHybridView.getNodeReviews=function(data,cb){PageUet.rec("ev=ugc:rr");var revTemp=fsTop.jsTemplate.reviews.section.row;SeatsPageController.getEntityReviews(data.node,function(reviews){var html="";var total=0;reviews.each(function(r){var rObj=r.getTempObj();total+=rObj.userReviewCount;html+=Template.apply(revTemp,rObj);});cb(html);});var revCont=fsTop.jsTemplate.reviews.section.container;var secName=data.node.getType()=='section'?data.node.getName():data.node.getParent().getName();var rowName=(data.node.getType()=='row'?data.node.getName():"");var nodeKey=secName;var rev=SeatsPageController.ugcMgr.ugc[nodeKey];var revCnt=rev?rev.reviews:0;var medCnt=rev?rev.media:0;return Template.apply(revCont,{reviewCount:revCnt,mediaCount:medCnt,reviewsLabel:pluralLabel(revCnt,"Review","Reviews"),mediaLabel:pluralLabel(medCnt,"Photo","Photos"),section:escape(secName),row:escape(rowName)});};JSHybridView.getNodeSummary=function(data){var node=data.node;var view=data.view;var colorId=SeatsPageController.view.colors[node.getBucketId().min];var type=node.getType();var nodeStyle=node.getName().toLowerCase()=='unmapped'?'unk':node.getType();if(view.drawPolygons){var polygons=node.getAttribute('gpolys');var style=view.polygonStrokeStyle.hover;if(!polygons&&style){polygons=JSHybridView.createGPolygons(view,node,style.color);node.setAttribute('gpolys',polygons);}
JSHybridView.setPolygonVisibility(polygons,style);}
var sec=null;var row=null;var seats=node.getQuantity();var price=node.getPriceRange();var photoUrl=SeatsPageController.ugcMgr.getVfsPhoto(node,'mrkr');var vfsReady=SeatsPageController.ugcMgr.isVfsReady();var htmlTemp=null;switch(nodeStyle){case'section':if(!vfsReady)
htmlTemp=fsTop.jsTemplate.toolTipSecWait;else if(photoUrl)
htmlTemp=fsTop.jsTemplate.toolTipSec;else
htmlTemp=fsTop.jsTemplate.toolTipSecNone;sec=node.getName();break;case'row':if(!vfsReady)
htmlTemp=fsTop.jsTemplate.toolTipRowWait;else if(photoUrl)
htmlTemp=fsTop.jsTemplate.toolTipRow;else
htmlTemp=fsTop.jsTemplate.toolTipRowNone;sec=node.getParent().getName();row=node.getName();if(node.getAttribute('isLastRow'))
row+=" or better";break;case'unk':htmlTemp=fsTop.jsTemplate.toolTipUnk;sec='Unmapped';}
var obj={section:sec,row:row,seats:seats+" tickets",price:price.min,imgPath:photoUrl}
return Template.apply(htmlTemp,obj);};JSHybridView.getNodeWaiting=function(data){var html="<div class='map-def-cont'>";html+="Loading your tickets..."+"<br/>";html+="<img style='width: 28px' src='"+JSHybridView.loadingImage+"'/></div>";return JSHybridView.getNodeDetails(data,html);};JSHybridView.getNodeDetails=function(data,contentOverride){var summaryOnly=contentOverride!=null;var node=data.node;var view=data.view;var filter=view.filter;var nopFilter=filter.isEmpty();var type=node.getName().toLowerCase()=='unmapped'||node.getAttribute("isUnmapped")?'unk':node.getType();var isSeries=view.events.length>1;var sets=summaryOnly?new Array():getTicketSets(node).sort(function(t1,t2){return t1.getPriceRange().min-t2.getPriceRange().min;});if(!summaryOnly){var markerState=node.isFlagged()?'sl':(node.getAttribute('bv')?'bv':'def');PageUet.rec("ev=mrk:"+type.substr(0,3)+";"+sets.length+";"+markerState);if(node.getAttribute("visible")&&sets.length<=0)
PageUet.rec("derr-mrk="+node.getGeomId()+"::"+node.getName()+"::"+node.getType());}
if(view.inactivityPopup){view.inactivityPopup.resetTimer('markerPopup');}
view.killFantip('mr1');if(view.drawPolygons){var polygons=node.getAttribute('gpolys');var style=view.polygonStrokeStyle.select;if(!polygons&&style){polygons=JSHybridView.createGPolygons(view,node,style.color);node.setAttribute('gpolys',polygons);}
JSHybridView.setPolygonVisibility(polygons,style);}
var outputTable="";if(!summaryOnly&&sets.length<=0){outputTable="<div class='map-def-cont'>Sorry. No ticket sets<br/>match your refinement options.</div>";}
var srcCtx="mrk-";var nodeKey=null;var headerLabel='';if(type=='section'){headerLabel=fsTop.jsTemplate.ticketSet.base.marker.headS;nodeKey=node.getName();srcCtx+="sec";}else if(type=='row'){headerLabel=node.getAttribute('isLastRow')?fsTop.jsTemplate.ticketSet.base.marker.headS:fsTop.jsTemplate.ticketSet.base.marker.headSR;nodeKey=node.getParent().getName();srcCtx+="row";}else if(type=='unk'){headerLabel=fsTop.jsTemplate.ticketSet.base.marker.headUnk;srcCtx+="unk";}
var s=node.getType()=='section'?node.getName():node.getParent().getName();var r=node.getType()=='row'?node.getName():"";r=node.getAttribute('isLastRow')?(r+" or better"):r;var label="Unmapped Seats";if(s!='Unmapped'){label=s;if(r&&r.length>0)
label+=" Row: "+r;}
if(sets.length>view.options.maxDetailSets)
label=view.options.maxDetailSets+" lowest offers in "+label;if(summaryOnly){headerLabel="<div class='map-det-top'>"+label+"</div>";}else{var revCnt=0;var medCnt=0;var hasRevTag="-off";var noRevTag="";var sampleRevTxt="";var photoHtml="";var reviewData=SeatsPageController.ugcMgr.ugc[nodeKey];if(reviewData){var txt=reviewData.rsamp;if(txt&&txt.length>=23)
txt=txt.slice(0,20)+"...";sampleRevTxt='"'+txt+'"';revCnt=reviewData.reviews?reviewData.reviews:0;if(revCnt>0){hasRevTag="";noRevTag="-off";}
if(reviewData.msamp&&((reviewData.media&&reviewData.media>0)||reviewData.msamp.editorial)){var cnt=reviewData.media;var editorial=reviewData.msamp.editorial;var samples=reviewData.msamp.samples;var photoTemp=fsTop.jsTemplate.ticketSet.base.marker.photoSec;var editorialTemp=fsTop.jsTemplate.ticketSet.base.marker.photoEditorial;if(editorial&&photoHtml.length==0){photoHtml+=Template.apply(editorialTemp,{imgPath:editorial.url,mediaId:editorial.id,ugcKey:nodeKey});}
if(photoHtml.length==0&&samples){for(var i=0;i<samples.length;i++){if(photoHtml.length==0){photoHtml+=Template.apply(photoTemp,{imgPath:samples[i].url,mediaId:samples[i].id,ugcKey:nodeKey});}}}}}
if(photoHtml.length==0){var emptyTemp=fsTop.jsTemplate.ticketSet.base.marker.photoSecNone;photoHtml+=Template.apply(emptyTemp,{escapedSection:s?escape(s):"",escapedRow:r?escape(r):""});}
var hdr={section:s?s:"",escapedSection:s?escape(s):"",row:r?r:"",escapedRow:r?escape(r):"",label:label,revCnt:revCnt,hasRevTag:hasRevTag,noRevTag:noRevTag,sampleRevTxt:sampleRevTxt,photos:photoHtml}
headerLabel=Template.apply(headerLabel,hdr);}
var html="";var rowTempName="";if(type=='section'){if(isSeries){rowTempName="itemSS";}else{rowTempName="itemS";}}else if(type=='row'){if(isSeries){rowTempName=node.getAttribute("isLastRow")?"itemSS":"itemSSR";}else{rowTempName=node.getAttribute("isLastRow")?"itemS":"itemSR";}}else{if(isSeries){rowTempName="itemSUnk";}else{rowTempName="itemUnk";}}
if(summaryOnly){outputTable=contentOverride;}else if(sets.length>0){var cnt=Math.min(sets.length,view.options.maxDetailSets);var templates=view.brokerTemplates;for(var i=0;i<cnt;i++){var brokerId=sets[i].getBrokerId();var tmp=templates[brokerId];var rowTemp=fsTop.jsTemplate.ticketSet.base.marker[rowTempName];if(tmp&&fsTop.jsTemplate.ticketSet[tmp])
rowTemp=fsTop.jsTemplate.ticketSet[tmp].marker[rowTempName];if(rowTemp){var t={offer:fsTop.jsTemplate.ticketSet.base.offer,ticketSet:rowTemp};outputTable+=view.listBuilder.getTicketSet(sets[i],t,srcCtx);}}}
var nodeDebug="";if(node&&fsTop.debugEnabled){nodeDebug="<hr/>"+node.toString();if(node.getParent()){nodeDebug="<hr/>"+node.getParent().toString()+nodeDebug;}}
return'<div class="map-det-container">'+headerLabel+'<div class="map-det-mid"><div class="scrollwrapper">'+outputTable+nodeDebug+"</div></div><div class='map-det-btm'></div></div>";function getTicketSets(n){var tixArray=new Array();if(n.getType()!='comparable'){n.getChildren().each(function(c){var sets=getTicketSets(c);if(sets)
tixArray=tixArray.concat(sets);});}else{var ok=nopFilter||n.isFlagged()||filter.containsTicketSet({providers:n.getBrokerList(),sections:n.getAttribute('sectionList'),area:(SeatsPageController.useIds?n.getAreaId():n.getAttribute('areaName')),priceRange:n.getPriceRange(),splits:n.getSplits(),deals:n.getComparables()});if(!ok)
return null;tixArray.push(n);}
return tixArray;}};JSHybridView.getSplitsText=function(tix){var s=tix.toArray().sort(function(a,b){return a-b});var max=s[s.length-1];if(s.length<=1)
return s[0]+pluralLabel(s[0],' ticket',' tickets')
if(s.length==2)
return s[0]+" or "+s[1]+" tickets";if(s.length==3)
return s[0]+", "+s[1]+" or "+s[2]+" tickets";return"Up to "+max+" tickets";};JSHybridView.prototype.getBaseIcon=function(configName,colorId,isMulti){var key=configName+"_"+colorId.min+"_"+colorId.max+"_"+isMulti;var base=this.iconCache[key];if(!base){var config=this.options.view.configs[configName];config=isMulti?config.multi:config.single;var imgConfig=config.basic;base=new GIcon();base.iconSize=new GSize(config.size.w,config.size.h);if(this.shadowEnabled&&config.shadow){base.shadow=config.shadow.image;base.shadowSize=new GSize(config.shadow.size.w,config.shadow.size.h);}
if(config.anchor)
base.iconAnchor=new GPoint(config.anchor.x,config.anchor.y);else
base.iconAnchor=new GPoint(config.size.w/2,config.size.h/2);this.iconCache[key]=base;}
return base;};JSHybridView.prototype.centroid=function(poly){var x=0;var y=0;if(poly){var n=poly.length;for(var i=0;i<n;i++){x+=poly[i].x;y+=poly[i].y;}
return{x:(x/n),y:(y/n)};}
else return{x:0,y:0};};JSHybridView.prototype.getMarkerImage=function(node,visible){var colorId={min:this.colors[node.getBucketId().min],max:this.colors[node.getBucketId().max]}
var zoom=Math.max(0,Math.min(this.viewSpecs.length-1,this.zoomLevel));var configName=this.viewSpecs[zoom].config;var isMulti=node.getQuantity()>1;var config=isMulti?this.options.view.configs[configName].multi:this.options.view.configs[configName].single;if(node.isFlagged())config=config.flagged;else if(node.getAttribute('bv'))config=config.best;else if(node.getAttribute('ps'))config=config.best;else config=config.basic;var image=config.image;if(visible){image=Template.apply(image,{minColor:colorId.min,maxColor:colorId.max});}else if(config.hidden){image=config.hidden;image=Template.apply(image,{minColor:colorId.min,maxColor:colorId.max});}
return image;};JSHybridView.prototype.setMarkerImage=function(marker,image){if(image){marker.getIcon().image=image;}else{marker.hide();}};JSHybridView.prototype.createPolygon=function(polygon,color){if(!polygon||!polygon.length)
return null;var projection=this.projection;var map=this.map;var offset=this.pixelOffSet;var gpoly=new Array();for(i=0;i<polygon.length;i++){var x=polygon[i].x+offset.x;var y=polygon[i].y+offset.y;gpoly[i]=projection.fromPixelToLatLng(new GPoint(x,y),17);}
gpoly[polygon.length]=projection.fromPixelToLatLng(new GPoint((polygon[0].x+offset.x),(polygon[0].y+offset.y)),17);return new GPolyline(gpoly,color,2,1,{geodesic:false});}
JSHybridView.createGPolygons=function(view,node,color){var gpolys=new Array();var polygons=node.getGeometry().polygons;if(polygons){polygons.each(function(p){var poly=view.createPolygon(p,color);if(poly){view.map.addOverlay(poly);gpolys.push(poly);}});}
return gpolys;};function TicketFilterHandler(groupTag,filter,view){if(!groupTag)
groupTag="";if(groupTag.length>0)
groupTag+="_";this.tags={priceSlider:groupTag+"histogram > .histogram-slider",min:groupTag+"seat_stat_min_price",max:groupTag+"seat_stat_max_price",count:groupTag+"seat_count",area:groupTag+"flt_area",sec:groupTag+"flt_sec"};this.filter=filter;this.view=view;this.isModal=groupTag.length>0;};TicketFilterHandler.prototype.setFilter=function(){var cnt=$("#"+this.tags.count).val();if(cnt=='Any'){cnt=0;}else{cnt=parseInt(cnt);}
this.filter.setQuantity(cnt);var min=$("#"+this.tags.min).val();if(!min||min<=0){min=0;}else{min=parseInt(min);}
var max=$("#"+this.tags.max).val();if(!max||max=='Max'){max=Infinity;}else{max=parseInt(max);}
this.filter.setPriceRange(min,max);if(this.isModal&&this.view&&this.view.areaFilterModal){this.view.areaFilterModal.updateFilter();}else{var t=0;this.filter.clearAreas();var areas=$("."+this.tags.area);for(var i=0;i<areas.length;i++){if($(areas[i]).attr("checked")){t++;this.filter.addArea(areas[i].value);if(!SeatsPageController.useIds){var a=SeatsPageController.model.findArea(areas[i].value);if(a){var secs=a.getChildren();for(var s=0;s<secs.length;s++){this.filter.addSection(secs[s].getName());}}}}}
if(t==areas.length){this.filter.clearAreas();this.filter.clearSections();}
t=0;if(areas.length==0){this.filter.clearSections();}
var sections=$("."+this.tags.sec);for(var i=0;i<sections.length;i++){if($(sections[i]).attr("checked")){t++;this.filter.addSection(sections[i].value);}}
if(t==sections.length&&areas.length==0)this.filter.clearSections();}};TicketFilterHandler.prototype.setControls=function(){var minPrice=this.filter.getPriceRange().min;var maxPrice=this.filter.getPriceRange().max;if(this.isModal){$('#'+this.tags.priceSlider).slider('values',0,minPrice);$('#'+this.tags.priceSlider).slider('values',1,maxPrice==Infinity?this.view.maxHistPrice:maxPrice);}else{minPrice=0;$('#priceSlider').slider('value',maxPrice);}
this.filter.setPriceRange(minPrice,maxPrice);var cnt=this.filter.getQuantity();if(cnt==0)
cnt='Any';$("#"+this.tags.count).val(cnt);if(this.isModal&&this.view&&this.view.areaFilterModal){this.view.areaFilterModal.setUI();}else if(this.view&&this.view.mapType=='interactive'){var areasFilter=this.filter.getAreas();var sectionsFilter=this.filter.getSections();if(areasFilter.count==0&&sectionsFilter.count==0){$('input.'+this.tags.area+',input.'+this.tags.sec).attr('checked',(this.isModal?'':'checked'));}else{$('input.'+this.tags.area+',input.'+this.tags.sec).attr('checked','');var areasInput=$('input.'+this.tags.area);for(var i=0;i<areasInput.length;i++){if(areasFilter.contains(areasInput[i].value)){areasInput[i].checked=true;$(areasInput[i]).siblings('ul').find('input').attr('checked','checked');}}
for(var k in sectionsFilter.keys){$('input.'+this.tags.sec+'[value='+k+']').attr('checked','checked');}}}else{var sectionsFilter=this.filter.getSections();var sections=$("."+this.tags.sec);if(sectionsFilter.count==0){sections.attr("checked",(this.isModal?'':'checked'));}else{for(var i=0;i<sections.length;i++){if(sectionsFilter.contains(sections[i].value))
$(sections[i]).attr("checked","checked");else
$(sections[i]).attr("checked","");}}}};fsTop.loadStartTime=(new Date).getTime();var SeatsPageController={initialize:function(data,options){this.options=options;this.useIds=this.options.useIds;this.apiVersion=this.options.apiVersion;this.filter=new TicketSetFilter({cnt:data.filter.seat_stat.seat_count,min:data.filter.seat_stat.min_price,max:data.filter.seat_stat.max_price,providers:data.filter.providers,sections:data.filter.sections,areas:data.filter.areas});PageUet.rec("apiver="+this.apiVersion);PageUet.rec("nh="+fsTop.nullHistogram);this.channel=data.channel;this.model=new SeatsData(data,options);this.ugcMgr=new UgcManager(this.model.getVenue(),fsTop.env.categories);this.ddm=new DataDownloaderManager(this.ugcMgr,this.model.tsm,this.model.requestQueue,{ugcEnabled:this.options.ugcEnabled});this.shortList=new ShortList();this.alertData=data.alertData;this.view=new JSHybridView(this.model,this.alertData,this.channel,options);this.showLoadingAt=new Date().getTime();this.filteringEnabled=true;var self=this;this.model.addListener('initialized',function(){var hasSharedItems=self.model.sharedOffers!=null&&self.model.sharedOffers.length>0;self.view.initialize(self.model,self.filter,hasSharedItems);self.bindEventHandlers();if(self.model.sharedOffers){self.model.sharedOffers.each(function(o){self.shortList.addTicket(o);});}
self.view.updateShortList(self.shortList.tickets,hasSharedItems);});this.view.addListener('initialized',function(){self.pingoutView=self.view.pingoutView;self.view.hideLoading();});SeatsPageController.ugcMgr.downloadVfs();this.model.initialize(this.filter);},bindEventHandlers:function(){var view=this.view;var filter=this.filter;view.addListener('priceRange',this.handlePriceRangeChange.bind(this));view.addListener('seatCount',this.handleSeatCountChange.bind(this));view.addListener('providerSet',this.handleProviderFilterChange.bind(this));view.addListener('sectionSet',this.handleSectionFilterChange.bind(this));view.addListener('areaSet',this.handleAreaFilterChange.bind(this));},getEntityReviews:function(node,cb){var self=this;this.ugcMgr.getEntityReview(node,function(data){cb(data);});},reviewFeedback:function(id,type,viewOptions){var review=this.ugcMgr.findReview(id);if(review.submitFeedback(id,type,function(){})){this.view.updateReviewScores(review,viewOptions);}},toggleShortList:function(ticketId){var ticket=this.model.getTicketSet(ticketId);var show=false;if(ticket){if(ticket.getAttribute('shared')){this.shortList.removeTicket(ticket);}else if(!ticket.getAttribute('inShortList')){ticket.setAttribute('inShortList',true);ticket.flagNode();this.shortList.addTicket(ticket);show=true;}else{this.shortList.removeTicket(ticket);ticket.unflagNode();ticket.setAttribute('inShortList',false);}
this.view.handleFlagged(ticket);this.view.killFantip('sl1');this.view.updateShortList(this.shortList.tickets);$('#fantip-sl2').jqmShow();}
return show;},addToShortList:function(ticketId){var ticket=this.model.getTicketSet(ticketId);if(ticket&&!ticket.getAttribute('inShortList')){ticket.setAttribute('inShortList',true);ticket.flagNode();this.shortList.addTicket(ticket);this.view.handleFlagged(ticket);this.view.killFantip('sl1');this.view.updateShortList(this.shortList.tickets);}},removeFromShortList:function(ticketId){var ticket=this.model.getTicketSet(ticketId);this.shortList.removeTicket(ticket);ticket.unflagNode();ticket.setAttribute('inShortList',false);this.view.handleFlagged(ticket);this.view.killFantip('sl1');this.view.updateShortList(this.shortList.tickets);},highlightSet:function(ticketId,show){var ticketSet=this.model.getTicketSet(ticketId);this.view.highlightMarker(ticketSet,show);},generatePingoutUrl:function(ticketId,ctx_,dealId,isLitePingout){if(!dealId){dealId=ticketId;}
if(this.view.inactivityPopup){this.view.inactivityPopup.resetTimer('confirm');}
context=this.getClickContext(ticketId,ctx_,dealId);var ticketSet=context.ts;var ctx=context.ctx;var qty=this.filter.getQuantity();if(qty==0){qty=ticketSet.getSplits().toArray().sort(function(a,b){return b-a;})[0];}
var event=ticketSet.getAttribute('event');var encodedEventData=event?event.serScores():"";encodedEventData=escape(encodedEventData);var afm=this.view.affiliateMerchantId?this.view.affiliateMerchantId:'';var link='/checkout/index/'+dealId+'?ctx='+escape(ctx)+'&ch='+this.channel.name+'&quantity='+qty+'&lp='+isLitePingout+'&poctx='+encodedEventData+'&afm='+escape(afm)+'&uet='+escape(PageUet.generateIdentifyingData());return link;},confirmPurchase:function(ticketId,ctx_,dealId){if(!dealId){dealId=ticketId;}
if(this.view.inactivityPopup){this.view.inactivityPopup.resetTimer('confirm');}
context=this.getClickContext(ticketId,ctx_,dealId);var ticketSet=context.ts;var isLitePingout=this.model.litePingoutBrokers.split(',').indexOf(String(ticketSet.getBrokerId(dealId)))>=0;if(this.model.newWindowPingout){window.open(this.generatePingoutUrl(ticketId,ctx_,dealId,isLitePingout));var fauxClick={ts:ticketSet,ctx:ctx_,dealId:dealId};if(this.view.surveyView){this.view.showSurvey(fauxClick,isLitePingout);}
return;}
var ctx=context.ctx;this.pingoutView.initialize(isLitePingout,dealId);this.pingoutView.startValidation(ticketSet,dealId,ctx);if(Pingout.fakePingout=='none')
return false;var qty=this.filter.getQuantity();if(qty==0){qty=ticketSet.getSplits().toArray().sort(function(a,b){return b-a;})[0];}
if(!Pingout.fakePingout){PageUet.rec("ev=po:"+dealId);PageUet.rec("ev=poctx:"+escape(ctx));}
var self=this;var event=ticketSet.getAttribute('event');Pingout.call(ticketSet,dealId,qty,ctx,event,this.channel.name,function(po){self.pingoutView.displayConfirmation(ticketSet,dealId,ctx,po);});},directClickout:function(ticketId,ctx_){context=this.getClickContext(ticketId,ctx_);var ticketSet=context.ts;var ctx=context.ctx;this.view.clickHandler(context);var lowestSplit=ticketSet.getSplits().toArray().sort()[0]
var link='/checkout/clickout/'+ticketId+'?ctx='+escape(ctx)+'&ch='+this.channel.name+'&quantity='+lowestSplit;return link;},getClickContext:function(ticketId,ctx_,dealId){var ticketSet=this.model.getTicketSet(ticketId);var ctx=ctx_;try{if(ticketSet.getAttribute('inShortList'))
ctx+=";t=fav";if(ticketSet.getAttribute('shared'))
ctx+=";t=shr";if(ticketSet.getAttribute('bv'))
ctx+=";t=bv";var broker=this.model.brokers[ticketSet.getBrokerId(dealId)];if(broker&&broker.ppc)
ctx+=";ppc";}catch(e){var trace=printStackTrace().join(',');this.recordException(e,trace);}
return{ts:ticketSet,ctx:ctx,dealId:dealId};},disableFiltering:function(){this.filteringEnabled=false;},enableFiltering:function(){this.filteringEnabled=true;},processFilter:function(excludes){if(this.filteringEnabled){this.view.filterView(this.filter,excludes);}},handlePriceRangeChange:function(_,min,max,excludes){this.filter.setPriceRange(min,max);this.processFilter(excludes);},handleSeatCountChange:function(_,cnt){if(cnt=='Any')cnt=0;this.filter.setQuantity(cnt);this.processFilter();},handleProviderFilterChange:function(_,list){this.filter.clearProviders();if(list){for(var k in list.keys){this.filter.addProvider(k);}}
this.processFilter();},handleAreaFilterChange:function(_,list){this.filter.clearAreas();this.filter.clearSections();if(list){for(var k in list.keys){if(!this.useIds){var a=this.model.findArea(k);if(a){var secs=a.getChildren();for(var s=0;s<secs.length;s++){this.filter.addSection(secs[s].getName());}}}
this.filter.addArea(k);}}
this.processFilter();},handleSectionFilterChange:function(_,list){this.filter.clearSections();if(list){for(var k in list.keys){this.filter.addSection(k);}}
this.processFilter();},setSmartAlert:function(location,email,authToken){var self=this;SmartAlert.submitAlert(self.model.events,self.filter,location,email,authToken);},reactivateAlert:function(alertId){SmartAlert.reactivateAlert(alertId);},recordException:function(e,trace){if(!this.exceptions)
this.exceptions=new Array();this.exceptions.push(e);LoggerUtil.logError(e,trace);}};var PageUet={initialize:function(comp,uid,style,channel,opts){this.comp=comp;this.uid=uid;this.style=style;this.channel=channel;this.sizeLimit=opts.sizeLimit?opts.sizeLimit:40;this.timeLimit=opts.timeLimit?opts.timeLimit:300000;this.checkLimit=true;this.buffer=new Array();this.count=opts.count?opts.count:0;this.start=new Date().getTime();this.last=null;if(opts.tag){this.ctx=opts.tag;this.buffer.push("_tag="+opts.tag);this.buffer.push("ts="+new Date().getTime());}
if(opts.slowLoad){this.buffer.push("sl=true");}
var self=this;$(window).unload(function(){var ts=new Date().getTime()-self.start;var nots=self.buffer.length==0;self.checkLimit=false;self.rec("t="+ts);self.dump(nots);});this.toid=setTimeout("PageUet.dump()",this.timeLimit);this.enabled=true;},rec:function(event){if(this.enabled){if(this.buffer.length==0)
this.buffer.push("ts="+new Date().getTime());if(this.checkLimit&&this.buffer.length>=this.sizeLimit){this.dump();}
this.buffer.push(event);this.last=new Date().getTime();}},dump:function(nots){if(this.enabled){clearTimeout(this.toid);if(this.buffer.length>0){var last=this.last;var tmp=this.buffer;this.buffer=new Array();if(!nots)
tmp.push("ts="+last);var msg=this.serialize(tmp);$.ajax({url:'/la/'+this.comp,type:'get',data:'m='+msg+'&ch='+this.channel,type:'get',success:function(){},error:function(data,status){LoggerUtil.logAjaxError(data,status);}});}
this.toid=setTimeout("PageUet.dump()",this.timeLimit);}},serialize:function(buf){if(this.enabled){var ser="_uid="+this.uid+"&";ser+="_ctx="+this.ctx+"&";ser+="_cnt="+(this.count++)+"&";ser+="_st="+this.style+"&";for(var i=0;i<buf.length;i++){ser+=buf[i]+"&";}
return escape(ser);}},generateIdentifyingData:function(){var idString=this.uid+'|'+this.style+'|'+this.channel+'|'+this.ctx;return idString;}};