/* /js/unit/ek/users/detail.js */
/* Copyright Eventful, Inc. All rights reserved except where otherwise noted. */
if(typeof window.Eventful==="undefined"){window.Eventful={};}
if(jQuery&&jQuery.fn.jquery>="1.4"){jQuery.ajaxSettings.traditional=true;}
if(window.console==="undefined"){window.console=(function(){var console={},noOp=function(){},aProps=['assert','count','debug','dir','dirxml','error','group','groupCollapsed','groupEnd','info','log','markTimeline','profile','profileEnd','time','timeEnd','trace','warn'],i,l;for(i=0,l=aProps.length;i<l;i++){console[aProps[i]]=noOp;}
return console;})();}
Eventful.isIE=false/*@cc_on @*//*@if (@_win32) || true/*@end @*/;Eventful.isSafari=navigator&&navigator.userAgent.indexOf('Safari')>0;Eventful.JSCheck=function(){document.body.className+=" has-js";};Eventful.fixKeyCode=function(keyCode){var keyEnter=13;if(Eventful.isSafari&&keyCode===3){return keyEnter;}
if(Eventful.isIE&&keyCode===0){return keyEnter;}
return keyCode;};Eventful.UIEvent=function()
{this.subscribers=[];}
Eventful.UIEvent.prototype.subscribe=function(fnCallback)
{this.subscribers.push(fnCallback);}
Eventful.UIEvent.prototype.fire=function()
{var aArgs=arguments;for(var i=0;i<this.subscribers.length;i++)
{this.subscribers[i].apply(undefined,aArgs);}}
Eventful.TrackPageview=function(oArgs){window._gaq=window._gaq||[];oArgs=oArgs||{};if(typeof oArgs=='string'){return Eventful.TrackPageview({page:oArgs});}
oArgs.page=oArgs.page||window.location.pathname;oArgs.query=oArgs.query||'';var sQuery=Eventful.TrackPageview.query();if(oArgs.query&&oArgs.page.indexOf('?')>=0){oArgs.query='&'+oArgs.query.substring(1);}
if(sQuery&&(oArgs.page.indexOf('?')>=0||oArgs.query)){sQuery='&'+sQuery.substring(1);}
Eventful.TrackPageview.track(oArgs.page+oArgs.query+sQuery);};Eventful.TrackPageview.track=function(sPage){_gaq.push(['_trackPageview',sPage]);};Eventful.TrackPageview.trackVirturalEvent=function(){Eventful.TrackPageview.track('/virtual/event/'+Array.prototype.slice.call(arguments).join('/'));};Eventful.TrackPageview.trackEvent=function(category,action,optional_label,optional_value){if(typeof window["console"]==="object"&&Eventful.Session&&Eventful.Session.userRole==="admin"){window["console"].log("Google Analytics _trackEvent:",arguments);}
_gaq.push(['_trackEvent',category,action,optional_label,optional_value]);};Eventful.TrackPageview.trackSocial=function(network,action,optional_target,optional_pagepath){_gaq.push(['_trackSocial',network,action,optional_target,optional_pagepath]);}
Eventful.TrackPageview.query=function(sQuery){return Eventful.TrackPageview._sQuery=sQuery||Eventful.TrackPageview._sQuery||window.location.search.toLowerCase();};Eventful.TrackPageview.setParams=function(oParams){var aParams=[];for(var sKey in oParams){aParams.push(sKey+'='+oParams[sKey]);}
var sQuery=Eventful.TrackPageview.query();Eventful.TrackPageview.query((sQuery?sQuery+'&':'?')+aParams.join('&'));};Eventful.Forms={};Eventful.Forms.focusFirstField=function(elForm)
{$(":input",elForm)
.not(':hidden')
.eq(0)
.not('[value],.inactive,:file')
.focus();}
Function.prototype.bind=function(){var __method=this,args=Array.prototype.slice.call(arguments),object=args.shift();return function(){var local_args=args.concat(Array.prototype.slice.call(arguments));if(this!==window)local_args.push(this);return __method.apply(object,local_args);}}
Function.prototype.mixin=function(fn)
{this.prototype=$.extend(this.prototype,fn.prototype);return this;}
Function.prototype.later=function(msec)
{var fn=this,args=Array.prototype.slice.call(arguments,1);return window.setTimeout(function(){fn.apply(this,args)},msec);}
Function.prototype.slow=function(msec,next){var fn=this,tm;if(next){return function(){if(tm)return;tm=1;fn.apply(this,Array.prototype.slice.call(arguments));(function(){tm=0;}).later(msec);}}else{return function(){if(tm)clearTimeout(tm);tm=(function(args){tm=0;fn.apply(this,args);})
.bind(this,Array.prototype.slice.call(arguments))
.later(msec);}}}
Function.prototype.invert=function()
{return function()
{return!this.call();}.bind(this);};/*
 * SimpleModal 1.1.1 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://plugins.jquery.com/project/SimpleModal
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2007 Eric Martin - http://ericmmartin.com
 *
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Revision: $Id: jquery.simplemodal.js 93 2008-01-15 16:14:20Z emartin24 $
 *
 */
(function($){$.modal=function(data,options){return $.modal.impl.init(data,options);};$.modal.close=function(){$.modal.impl.close(true);};$.fn.modal=function(options){return $.modal.impl.init(this,options);};$.modal.defaults={overlay:50,overlayId:'modalOverlay',overlayCss:{},containerId:'modalContainer',containerCss:{},close:true,closeTitle:'Close',closeClass:'modalClose',closeText:'&#215;',persist:false,onOpen:null,onShow:null,onClose:null};$.modal.impl={opts:null,dialog:{},init:function(data,options){if(this.dialog.data){return false;}
this.opts=$.extend({},$.modal.defaults,options);if(typeof data=='object'){data=data instanceof jQuery?data:$(data);if(data.parent().parent().size()>0){this.dialog.parentNode=data.parent();if(!this.opts.persist){this.dialog.original=data.clone(true);}}}
else if(typeof data=='string'||typeof data=='number'){data=$('<div>').html(data);}
else{if(console){console.log('SimpleModal Error: Unsupported data type: '+typeof data);}
return false;}
this.dialog.data=data.addClass('modalData');data=null;this.create();this.open();if($.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog]);}
return this;},create:function(){this.dialog.overlay=$('<div>')
.attr('id',this.opts.overlayId)
.addClass('modalOverlay')
.css($.extend(this.opts.overlayCss,{opacity:this.opts.overlay/100,height:'100%',width:'100%',position:'fixed',left:0,top:0,zIndex:3000}))
.hide()
.appendTo('body');this.dialog.container=$('<div>')
.attr('id',this.opts.containerId)
.addClass('modalContainer')
.css($.extend(this.opts.containerCss,{zIndex:3100}))
.append(this.opts.close?'<a class="modalCloseImg '
+this.opts.closeClass
+'" title="'
+this.opts.closeTitle+'">'+this.opts.closeText+'</a>':'')
.hide()
.appendTo('body');if($.browser.msie&&($.browser.version<7)){this.fixIE();}
this.dialog.container.append(this.dialog.data.hide());},bindEvents:function(){var modal=this;$('.'+this.opts.closeClass).click(function(e){e.preventDefault();modal.close();});},unbindEvents:function(){$('.'+this.opts.closeClass).unbind('click');},fixIE:function(){if($(document.body).height()<$(document).height())
{$(document.body).css({height:'100%'});}
var wHeight=$(document.body).height()+'px';var wWidth=$(document.body).width()+'px';this.dialog.overlay.css({position:'absolute',height:wHeight,width:wWidth});this.dialog.container.css({position:'absolute'});this.dialog.iframe=$('<iframe src="javascript:false;">')
.css($.extend(this.opts.iframeCss,{opacity:0,position:'absolute',height:wHeight,width:wWidth,zIndex:1000,width:'100%',top:0,left:0}))
.hide()
.appendTo('body');},open:function(){if(this.dialog.iframe){this.dialog.iframe.show();}
if($.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog]);}
else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show();}},close:function(external){if(!this.dialog.data){return false;}
if($.isFunction(this.opts.onClose)&&!external){this.opts.onClose.apply(this,[this.dialog]);}
if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode);}
else{this.dialog.data.remove();this.dialog.original.appendTo(this.dialog.parentNode);}}
else{this.dialog.data.remove();}
this.dialog.container.remove();this.dialog.overlay.remove();if(this.dialog.iframe){this.dialog.iframe.remove();}
this.dialog={};this.unbindEvents();}};})(jQuery);Eventful.Panel=function(id)
{this.id=id;this.trackingString=null;this.eventShow=new Eventful.UIEvent();this.eventClose=new Eventful.UIEvent();this.eventReady=new Eventful.UIEvent();var fnToggleAds=function(){var ads=$('.rev-gen').filter(function(){return $(this).parents('.panel').length==0?this:null;});ads.toggle();};this.eventShow.subscribe(fnToggleAds);this.eventClose.subscribe(fnToggleAds);}
Eventful.Panel.prototype.panel=function()
{if(!this.jqPanel)this.jqPanel=$('#'+this.id);return this.jqPanel;}
Eventful.Panel.prototype.find=function(sExpr)
{return this.panel().find(sExpr)}
Eventful.Panel.prototype.options=function(oOptions)
{if(oOptions.tracking_string)
{this.trackingString=oOptions.tracking_string;}
if(oOptions.width)
{oOptions.width=+oOptions.width.toString().replace('px','');oOptions.containerCss=$.extend(oOptions.containerCss,{width:oOptions.width,marginLeft:-oOptions.width/2});}
oOptions=$.extend({persist:true,overlay:75,onShow:this.listenShow.bind(this),closeClass:'modalClose',closeOnKeyEsc:false},oOptions);oOptions.containerCss=$.extend({position:'absolute'},oOptions.containerCss);this.oOptions=oOptions;return this;}
Eventful.Panel.prototype.autoShow=function(sHash)
{if(window.location.hash=="#"+sHash)
{$(this.show.bind(this));}}
Eventful.Panel.prototype.clickShow=function(sQuery)
{return this.clickClose(sQuery,true);}
Eventful.Panel.prototype.clickClose=function(sQuery,bShow)
{$(function()
{if(sQuery instanceof Array)sQuery=$.map(sQuery,function(id){return'#'+id}).join();$(sQuery).click(function(evt)
{evt.preventDefault();if(bShow)this.show(evt);else this.close(evt);}.bind(this));}.bind(this));return this;}
Eventful.Panel.prototype.show=function(evt)
{if(!this.panel().length)return this;if(this.oOptions.containerCss.position=='absolute')
{this.oOptions.containerCss.top=(Eventful.scrollTop()+30)+'px';}
if(this.oOptions.topMod){this.oOptions.containerCss.top=(Eventful.scrollTop()+30+this.oOptions.topMod)+'px';}
if(this.parent(Eventful.Panel.current()))
{this.parent().close();}
var jqModal=this.panel().modal(this.oOptions);if(jqModal){this.jqModal=jqModal;}
Eventful.Panel.current(this);if(this.oOptions.containerCss.position=='fixed'&&!($.browser.msie&&($.browser.version<7)))
{var jqMC=$('#modalContainer');jqMC
.css('top','50%')
.css('marginTop','-'+Math.round(jqMC.height()*0.67)+'px');}
if(this.oOptions.closeOnKeyEsc)
{$('#modalContainer').one('keyup',function(evt){if(evt.keyCode==27)this.close();}.bind(this));}
$('#modalContainer .'+this.oOptions.closeClass).one('click',this.close.bind(this));if(this.trackingString){Eventful.TrackPageview.track(this.trackingString);}
this.eventShow.fire(evt);return this;}
Eventful.Panel.prototype.close=function(evt)
{if(this.jqModal)this.jqModal.close();this.eventClose.fire(evt);if(Eventful.Panel.current()==this)
{Eventful.Panel.current(null);}
if(this.parent())
{this.parent().show();this.parent(null);}
return this;}
Eventful.Panel.prototype.parent=function(obj)
{return obj!==undefined?this.oParent=obj:this.oParent||null;}
Eventful.Panel.prototype.listenShow=function()
{Eventful.Forms.focusFirstField(this.panel());}
Eventful.Panel.current=function(obj)
{return obj!==undefined?Eventful.Panel.oCurrent=obj:Eventful.Panel.oCurrent||null;}
Eventful.Panel.prototype.resize=function(){var width=0;this.panel().each(function(){tmpWidth=$(this).width();if(tmpWidth>=width){width=tmpWidth;}});var left=$(window).width()/2;$('#modalContainer').css({'width':width+'px','left':(left-(width/2))+'px','margin-left':'0px'});}
Eventful.scrollTop=function()
{return document.body.scrollTop||document.documentElement.scrollTop||0;}
Eventful.PanelConfirm=function(id)
{Eventful.Panel.call(this,id||'panel-confirm');this.eventConfirmYes=new Eventful.UIEvent();this.eventConfirmNo=new Eventful.UIEvent();}.mixin(Eventful.Panel);Eventful.PanelConfirm.prototype.options=function(oOptions){oOptions=$.extend({autoCloseOnYes:true,autoCloseOnNo:true,width:"350px",closeOnKeyEsc:true,containerCss:{position:'fixed'}},oOptions);var jYesBtn=this.find('.confirm-yes').click(function(evt){this.eventConfirmYes.fire(evt);}.bind(this));if(oOptions.autoCloseOnYes){this.clickClose(jYesBtn);}
var jNoBtn=this.find('.confirm-no').click(function(evt){this.eventConfirmNo.fire(evt);}.bind(this));if(oOptions.autoCloseOnNo){this.clickClose(jNoBtn);}
return Eventful.Panel.prototype.options.call(this,oOptions);}
Eventful.PanelConfirm.prototype.showLoading=function(css){var jqLoading=this.find('.ft .process').addClass('loading').css(css||{});this.eventClose.subscribe(function(){jqLoading.removeClass('loading');});return this;}
String.prototype.truncate=function(n,suffix)
{if(!this.length||!n)return this;suffix=suffix||'...';if(this.length>n)
{return this.substring(0,n)+suffix;}
else{return this.substring(0);}}
String.prototype.append=function(sAdd,sSep)
{return this+((this.length)?sSep:'')+sAdd;}
String.prototype.trim=function()
{return this.replace(/(^\s+|\s+$)/g,'');}
String.prototype.lpad=function(n,sPad)
{if(n&&this.length<n)
{return(sPad+this).lpad(n,sPad);}else
{return this;}}
String.prototype.commify=function()
{return this.replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,");}
String.prototype.uppercaseFirst=function()
{return this.replace(/\b(\w)/g,function(_,m)
{return m.toUpperCase();});}
String.prototype.surplant=function(O)
{return this.replace(/\{(\w+)\}/g,function(a,b){var r=O[b];return typeof r==="string"?r:a;});}
Eventful.ChangeFriendshipPanel=function(){this.aOpenerAddFrind=[];this.aOpenerRemoveFrind=[];$(document).ready(this.setup.bind(this));}
Eventful.ChangeFriendshipPanel.prototype.addFriend=function(sFriendUserName){if(sFriendUserName){this.aOpenerAddFrind.push("change-friend-"+sFriendUserName);}}
Eventful.ChangeFriendshipPanel.prototype.removeFriend=function(sFriendUserName){if(sFriendUserName){this.aOpenerRemoveFrind.push("change-friend-"+sFriendUserName);}}
Eventful.ChangeFriendshipPanel.prototype.setup=function(){var setupOnePanel=function(sId,aClickId,url){if(aClickId.length==0)return;var oPanel=(new Eventful.PanelConfirm(sId))
.options({'width':"380px",'autoCloseOnYes':false})
.clickShow(aClickId);oPanel.eventShow.subscribe(function(sHd,sBd,evt){var username=evt.target.id.substr(14),r={"username":username,"username_shown":username.truncate(15)};oPanel.find('.hd').html(sHd.surplant(r));oPanel.find('.bd').html(sBd.surplant(r));}.bind(this,oPanel.find('.hd').html(),oPanel.find('.bd').html()));oPanel.eventConfirmYes.subscribe(function(){$.post(url,oPanel.showLoading().find('form').serializeArray(),function(){this.close();window.location.reload(true);}.bind(oPanel),'json');});};setupOnePanel("panel-add-friend",this.aOpenerAddFrind,'/json/tools/users/favorites/users/add');setupOnePanel("panel-remove-friend",this.aOpenerRemoveFrind,'/json/tools/users/favorites/users/remove');}
Eventful.oChangeFriendshipPanel=new Eventful.ChangeFriendshipPanel();;/*
 * jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses.
 */(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];if(result=/rgba\(0, 0, 0, 0\)/.exec(color))return colors['transparent'];return colors[jQuery.trim(color).toLowerCase()];}function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]};})(jQuery);Eventful.Notification=function(){var fnAnimation=function(){var oStyle=Eventful.Notification.style();$('.notification#notification')
.animate({backgroundColor:"#ffffff",color:"#666666",borderBottomColor:oStyle.borderColor,borderLeftColor:oStyle.borderColor,borderRightColor:oStyle.borderColor,borderTopColor:oStyle.borderColor},2000)
.find('.sign').animate({backgroundColor:"#eeeeee"},2000);}
$(function(){fnAnimation.later(1000);});}
Eventful.Notification.oStyle={borderColor:'#eeeeee'}
Eventful.Notification.style=function(oArgs)
{if(oArgs)
{$.extend(Eventful.Notification.oStyle,oArgs);}
return Eventful.Notification.oStyle;}
Eventful.FormVal=function(formJExpr,summaryJExpr,oArgs){this.jForm=$(formJExpr);if(summaryJExpr)this.jqFormSummary=$(summaryJExpr);if(!oArgs)oArgs={};this.args={summaryError:oArgs.summaryError||"Oh no! Errors! Please check the fields above.",summaryEmpty:oArgs.summaryEmpty||"You forgot to fill out the fields! Good thing I reminded you.",keepValidate:oArgs.keepValidate===undefined?false:oArgs.keepValidate,isMobile:oArgs.isMobile||false};this.rules=[];this.eventBeginValidation=new Eventful.UIEvent();this.eventPassValid=new Eventful.UIEvent();this.eventJSONValidate=new Eventful.UIEvent();this.eventFailValid=new Eventful.UIEvent();this.eventErrorShown=new Eventful.UIEvent();this.eventFailFormEmpty=new Eventful.UIEvent();this.initialize();}
Eventful.FormVal.prototype.bindEvent=function(nm,fn){var nmEvts={'beginValidatation':this.eventBeginValidation,'passValid':this.eventPassValid,'failValid':this.eventFailValid,'errorShown':this.eventErrorShown,'JSONValidate':this.eventJSONValidate};if(nmEvts[nm])nmEvts[nm].subscribe(fn);return this;}
Eventful.FormVal.GetPattern=function(type){var allPatterns={"float":/^-?(\d+\.?\d*|\d*\.\d+)$/,"number":/^[-+]?\d+$/,"email":/^[\w.%+-]+@([\w-]+\.)+[A-Za-z]{2,4}$/,"url":/^https?:\/\/([\w-]+\.)+[A-Za-z]{2,4}/i};return allPatterns[type];}
Eventful.FormVal.prototype.getPattern=Eventful.FormVal.GetPattern;Eventful.FormVal.setInactive=function(exprActiveToggle){$(exprActiveToggle||'input[type=text][alt!=""],textarea[alt!=""]',!exprActiveToggle&&this.jForm?this.jForm:undefined)
.bind('focus',function(){if($(this).hasClass('inactive')){$(this).removeClass('inactive').val('');}})
.bind('blur',function(){var alt=$(this).attr('alt');if(this.value==''){$(this).addClass('inactive').val(alt);}})
.each(function(i,el){var alt=$(this).attr('alt');if(el.value==""||el.value==alt){$(el).addClass('inactive').val(alt);}});return this;}
Eventful.FormVal.prototype.setInactive=Eventful.FormVal.setInactive;Eventful.FormVal.emptyInactive=function(exprActiveToggle){$(exprActiveToggle||'input.inactive[type=text][alt!=""],textarea.inactive[alt!=""]',!exprActiveToggle&&this.jForm?this.jForm:undefined).val('');return this;}
Eventful.FormVal.prototype.emptyInactive=Eventful.FormVal.emptyInactive;Eventful.FormVal.prototype.initialize=function(){this._serializedValues=this.jForm.serialize();this.jForm.bind('submit.formval',function(){this.validateForm.bind(this).later(1);return false;}.bind(this));return this;}
Eventful.FormVal.prototype.deinitialize=function(){this.jForm.unbind('submit.formval');return this;}
Eventful.FormVal.prototype.focusFirstField=function(){if(this.args.isMobile){return this;}
var jqInputs=this.jForm.find('.has-error :input').not(':hidden');if(!jqInputs.size())
{jqInputs=this.jForm.find(':input').not(':hidden');}
jqInputs.eq(0).trigger('focus');return this;}
Eventful.FormVal.prototype.isDirty=function(){return this._serializedValues!==this.jForm.serialize();}
Eventful.FormVal.prototype.trackEvent=function(sAction,sLabel,sValue)
{Eventful.TrackPageview.trackEvent("Form Validation",sAction,sLabel,sValue);}
Eventful.FormVal.prototype.validateForm=function(){this.eventBeginValidation.fire(this.jForm[0]);if($.grep(this.jForm.find(":input").not(':hidden,:button,:reset,:image,:submit,.inactive').serializeArray(),function(pair){return!!$.trim(pair.value)}).length===0&&$.grep(this.rules,function(rule){return rule.rule.required;}).length>0&&this.jqFormSummary)
{this.showSummaryError(this.args.summaryEmpty);this.eventFailFormEmpty.fire(this.jForm[0]);return;}
if(this.args.isMobile){this.jForm.find('.field-container').removeClass('has-error show-errors');}
this.hideSummaryError().hideHasError();$.each(this.rules,function(_,oNameRulePair){oNameRulePair.rule.quality={error:0,message:'',defaultMessage:''};});function _markBadQuality(errInput,jInput,rule,errBit,defMsg,msg){errInput.push(jInput);rule.quality.error|=1<<errBit;rule.quality.defaultMessage=defMsg||"The input has error";rule.quality.message=msg||rule.message;}
var errInput=[],jsonQueue=[];$.each(this.rules,function(_,oNameRulePair){var jInput=this.jForm.find(':input[name='+oNameRulePair.name+']'),rule=oNameRulePair.rule;if(jInput.length==0||$.grep(errInput,function(j){return jInput.attr('name')===j.attr('name')}).length||!rule)return;var nameValues=$.grep(jInput.not('.inactive').serializeArray(),function(pair){return!!$.trim(pair.value)});if(rule.ignoreCb&&rule.ignoreCb(jInput.length===1?jInput[0]:jInput,nameValues)){return;}
if(rule.required&&!nameValues.length){_markBadQuality(errInput,jInput,rule,0,"Data is required");}else if(nameValues.length&&rule.pattern&&$.grep(nameValues,function(oPair){return rule.pattern.test(oPair.value)===false;}).length){_markBadQuality(errInput,jInput,rule,1,"The input has incorrect format");}else if(nameValues.length&&rule.hasOwnProperty("minlen")){if(jInput.is(':text, :password, textarea')&&jInput.val().length<rule.minlen){_markBadQuality(errInput,jInput,rule,2,"string length must >= "+rule.minlen);}else if(jInput.is(':checkbox, select')&&nameValues.length<rule.minlen){_markBadQuality(errInput,jInput,rule,3,"at least "+rule.minlen+" selected");}}else if(nameValues.length&&rule.hasOwnProperty("maxlen")){if(jInput.is(':text, :password, textarea')&&jInput.val().length>rule.maxlen){_markBadQuality(errInput,jInput,rule,4,"string length must <= "+rule.maxlen);}else if(jInput.is(':checkbox, select')&&nameValues.length>rule.maxlen){_markBadQuality(errInput,jInput,rule,5,"at most "+rule.maxlen+" selected");}}else if(nameValues.length&&rule.hasOwnProperty("min")&&jInput.is(':text')){var aNum=/^[+-]?\d+$/.test(jInput.val())?parseInt(jInput.val()):parseFloat(jInput.val());if(isNaN(aNum)||aNum<rule.min){_markBadQuality(errInput,jInput,rule,6,"must >= "+rule.min);}}else if(nameValues.length&&rule.hasOwnProperty("max")&&jInput.is(':text')){var aNum=/^[+-]?\d+$/.test(jInput.val())?parseInt(jInput.val()):parseFloat(jInput.val());if(isNaN(aNum)||aNum>rule.max){_markBadQuality(errInput,jInput,rule,7,"must <= "+rule.max);}}else if(rule.helperCb){var msg=rule.helperCb(jInput.length===1?jInput[0]:jInput,nameValues);if(msg&&msg.error)_markBadQuality(errInput,jInput,rule,8,'Failed to helper check',msg.message);}else if(rule.jsonCb){var oJSONsetup=rule.jsonCb(jInput.length==1?jInput[0]:jInput,nameValues);if(oJSONsetup&&(oJSONsetup.post||oJSONsetup.get))
{jsonQueue.push($.extend(oJSONsetup,{'rule':rule,'jInput':jInput}));}}}.bind(this));if(errInput.length){this._afterFailure(errInput);}else if(jsonQueue.length){var _onJsonResponse=function(helperCb,jInput,rule,sJsonUrl,oResponse)
{if(rule.accept_unavailable&&oResponse.status===503)
{this.trackEvent("Service Unavailable",sJsonUrl,jInput.val());}else
{var msg=helperCb(oResponse,jInput.length==1?jInput[0]:jInput,this.jForm[0]);}
if(msg&&msg.error){_markBadQuality(errInput,jInput,rule,9,'Failed to ajax check',msg.message);this._afterFailure(errInput);}else if(msg===false){return;}else if(jsonQueue.length){_shiftJsonQueue.call(this);}else{this._afterSuccess();}};var _shiftJsonQueue=function()
{var oJson=jsonQueue.shift();if(oJson)
{var sJsonUrl=oJson.post||oJson.get;$.ajax({url:sJsonUrl,type:oJson.post?"post":"get",data:oJson.data,success:_onJsonResponse.bind(this,oJson.helperCb,oJson.jInput,oJson.rule,sJsonUrl),error:_onJsonResponse.bind(this,oJson.helperErrorCb||function(){return{"error":1,"message":"Sorry! There is trouble to validate your input."}},oJson.jInput,oJson.rule),dataType:oJson.dataType||'json'});}};_shiftJsonQueue.call(this);this.eventJSONValidate.fire();}else{this._afterSuccess();}
return this;}
Eventful.FormVal.prototype._afterSuccess=function(){if(!this.args.keepValidate)this.deinitialize();if(this.eventPassValid.subscribers.length){this.eventPassValid.fire(this.jForm[0]);}else{this.emptyInactive();this.jForm.trigger('submit');}
return this;}
Eventful.FormVal.prototype._afterFailure=function(errInput){this.showSummaryError();this.showHasError(errInput);this.eventFailValid.fire(this.jForm[0],errInput);return this;}
Eventful.FormVal.prototype.addRule=function(inputname,oRule,position){if(typeof position=='number'){this.rules.splice(position,0,{name:inputname,rule:oRule});}else{this.rules.push({name:inputname,rule:oRule});}
return this;}
Eventful.FormVal.prototype.removeRule=function(inputname){this.rules=$.map(this.rules,function(oRule){return oRule.name===inputname?null:oRule;});return this;}
Eventful.FormVal.prototype.showShowError=function(elInput){var jqElContainer=$(elInput).parents(".field-container").addClass("show-errors");var sInputName=$(elInput).attr('name');var sMessage="There are errors in your input.";var jqFormError=jqElContainer.find(".form-error");if(!jqFormError.size()){jqFormError=$('<div class="form-error"></div>')
.attr('id',sInputName+'-error')
.appendTo(jqElContainer);}
var oNameRulePair=$.grep(this.rules,function(oNameRulePair){return oNameRulePair.name==sInputName&&oNameRulePair.rule.quality&&oNameRulePair.rule.quality.error;})[0];if(oNameRulePair)
{var oRule=oNameRulePair.rule;if(oRule.markupMessage==undefined)
{oRule.markupMessage=jqFormError.html();}
sMessage=oRule.quality.message||oRule.markupMessage||oRule.quality.defaultMessage||sMessage;}
jqFormError.html(sMessage);this.eventErrorShown.fire(elInput,jqFormError.get(0));return this;}
Eventful.FormVal.prototype.hideShowError=function(elInput){$(elInput).parents(".field-container").removeClass("show-errors");return this;}
Eventful.FormVal.prototype.showHasError=function(errInput){this._fnClearHasError=this._fnClearHasError?this._fnClearHasError.splice(0):[];$.each(errInput,function(i,el){var jqEl=$(el),jqContainer=jqEl.parents(".field-container").addClass("has-error");if(jqContainer.length==0)return;if(this.args.isMobile){this.showShowError.call(this,el);return this;}else{jqEl.bind("focus.haserror",this.showShowError.bind(this,el))
.bind("blur.haserror",this.hideShowError.bind(this,el));}
var afterTryAgain=function(){jqContainer.removeClass("has-error").removeClass("show-errors");jqEl.unbind("focus.haserror").unbind("blur.haserror");}
if(jqEl.is(':text, :password, textarea')){jqEl.bind("keyup.causechange",function(sOldVal){if($(this).val()!=sOldVal){afterTryAgain();$(this).unbind('keyup.causechange')}}.bind(jqEl[0],jqEl.val()));this._fnClearHasError.push(function(){jqEl.unbind("keyup.causechange");afterTryAgain();});}else if(jqEl.is('select')){jqEl.one("change",afterTryAgain);this._fnClearHasError.push(function(){jqEl.unbind("change",afterTryAgain);afterTryAgain();});}else if(jqEl.is(':checkbox, :radio')){jqEl.one("click",afterTryAgain);this._fnClearHasError.push(function(){jqEl.unbind("click",afterTryAgain);afterTryAgain();});}}.bind(this));return this.focusFirstField();}
Eventful.FormVal.prototype.hideHasError=function(){if(this._fnClearHasError){var fn;while(fn=this._fnClearHasError.pop())fn();}
return this;}
Eventful.FormVal.prototype.showSummaryError=function(sErrorMsg){if(this.jqFormSummary){sErrorMsg=sErrorMsg||this.args.summaryError;this.jqFormSummary.html(sErrorMsg).addClass("show-errors");var fnHideSummary=function(sOldFormValue){if(sOldFormValue!==this.jForm.serialize()){this.hideSummaryError();this.jForm
.find(':text, :password, textarea')
.unbind("keyup",fnHideSummary)
.end()
.find('select')
.unbind("change",fnHideSummary)
.end()
.find(':checkbox, :radio')
.unbind("click",fnHideSummary);}}.bind(this,this.jForm.serialize());this.jForm
.find(':text, :password, textarea')
.bind("keyup",fnHideSummary)
.end()
.find('select')
.bind("change",fnHideSummary)
.end()
.find(':checkbox, :radio')
.bind("click",fnHideSummary);}
return this.focusFirstField();}
Eventful.FormVal.prototype.hideSummaryError=function(evt){if(this.jqFormSummary){this.jqFormSummary.empty().removeClass("show-errors");}
return this;}
Eventful.Autoclose=function()
{$('body').click(Eventful.Autoclose.body_click);}
Eventful.Autoclose.element_id=null;Eventful.Autoclose.afterClosed=new Eventful.UIEvent();Eventful.Autoclose.body_click=function(evt)
{if(evt)
{var elTarget=$(evt.target);if(elTarget.size())
{if(elTarget.hasClass("autoclose")||elTarget.hasClass("autoclose-click")||elTarget.parents('.autoclose').size())
{return true;}}}
Eventful.Autoclose.close_block();}
Eventful.Autoclose.close_block=function()
{var id=Eventful.Autoclose.element_id;if(id&&id.length)
{var elAutoclose=$('#'+id);if(elAutoclose.size())
{elAutoclose.hide();Eventful.Autoclose.element_id=null;Eventful.Autoclose.afterClosed.fire(elAutoclose.get(0));}}}
Eventful.Autoclose.set_id=function(idEl)
{if(Eventful.Autoclose.element_id!=idEl)
{Eventful.Autoclose.close_block();Eventful.Autoclose.element_id=idEl;}}
$(Eventful.Autoclose);Eventful.Popover=function(jqEx,oOptions)
{this.eventShow=new Eventful.UIEvent();this.eventClose=new Eventful.UIEvent();this._setup({width:"300px",css:{'backgroundColor':'#fff','border':'1px solid #666','zIndex':"10"},position:{"top":10,"left":10,"right":'auto',"bottom":'auto',"relative":'mouse'},no_focus:false,tracking:''},jqEx,oOptions||{});}
Eventful.Popover.prototype._setup=function(default_args,jqEx,oOptions){var popoverCss={},containerCss={};$.each($.extend(default_args.css,{'width':default_args.width},oOptions.css,{'width':oOptions.width}),function(attr,val){if(!val)return;if(/^(width|height|zIndex)$/.test(attr)){containerCss[attr]=val;}else{popoverCss[attr]=val;}});this.popover(jqEx).css(popoverCss);this.args={'containerCss':containerCss,'position':$.extend(default_args.position,oOptions.position),'tracking':oOptions.tracking||default_args.tracking,'no_focus':oOptions.no_focus||default_args.no_focus,'listenKeyESC':!!this.find(':input').not(':hidden').length};}
Eventful.Popover.prototype.container=function(){var jContainer,oEvt,oInst,fnKeyESCHdl=function(evt){if(evt.keyCode==27&&oInst){oInst.close(evt);}},fnReposition=function(evt){if(oInst)oInst._position(evt);},fnMouseLeaveHdl=function(){if(oInst)oInst._slowUIAct(!oInst.args.slowActOverPopover,true);},fnMouseEnterHdl=function(){if(oInst)oInst._slowUIAct(!oInst.args.slowActOverPopover,false);},fnShow=function(intc,evt){if(oInst)fnClose();oInst=intc;oEvt=evt?{'target':evt.target,'pageX':evt.pageX,'pageY':evt.pageY}:null;jContainer
.prepend(oInst.popover(true))
.css($.extend({height:'auto',width:'auto',zIndex:'auto'},oInst.args.containerCss,{"top":"-1000px","left":"-1000px"}))
.show();oInst._position(oEvt);if(oInst.args.listenOverPopover){jContainer
.bind('mouseenter',fnMouseEnterHdl)
.bind('mouseleave',fnMouseLeaveHdl);}
if(oInst.args.listenKeyESC){jContainer.bind('keyup',fnKeyESCHdl);}
if(oInst.args.position.relative==='mouse'&&oEvt){$(oEvt.target).bind('mousemove',fnReposition);}},fnClose=function(){if(oInst.args.listenOverPopover){jContainer
.unbind('mouseenter',fnMouseEnterHdl)
.unbind('mouseleave',fnMouseLeaveHdl);}
if(oInst.args.listenKeyESC){jContainer.unbind('keyup',fnKeyESCHdl);}
if(oInst.args.position.relative==='mouse'&&oEvt){$(oEvt.target).unbind('mousemove',fnReposition);}
jContainer
.hide()
.children().not('iframe')
.each(function(){if(this.parentNode)this.parentNode.removeChild(this);});oInst=oEvt=null;};return function(doElse){if(!jContainer){jContainer=$('<div id="eventful-tooltip" class="popover autoclose" \
                          style="position:absolute;margin:0;border:0;padding:0;background-color:transparent;"> \
                      </div>')
.appendTo(document.body)
.hide()
.bind('resize',function(){jContainer
.children('iframe')
.css({'width':jContainer.width(),'height':jContainer.height()});fnReposition(oEvt);});if($.browser.msie&&($.browser.version<7)){jContainer.append('<iframe frameborder="0" src="javascript:\'\'" \
                             style="position:absolute;top:0;left:0;z-index:-1;filter:mask();"> \
                           </iframe>');}
$(window).bind('resize',function(){fnReposition(oEvt);});}
if(doElse){if(doElse.get&&doElse.get==='event'){return oEvt;}else if(doElse.get&&doElse.get==='instance'){return oInst;}else if(doElse.set&&doElse.set[0]){fnShow(doElse.set[0],doElse.set[1]);}else if(doElse.set&&oInst){fnClose();}}
return jContainer;}}();Eventful.Popover.prototype.popover=function(jqEx){if(!this._jPopover&&jqEx){this._jPopover=$(jqEx).hide();if(this._jPopover.parents('body').length){this._jPopover._delayDetach=true;}else if(typeof jqEx==='string'){this._jPopover=$('<div class="popbd">'+jqEx+'</div>');}}else if(this._jPopover._delayDetach&&jqEx===true){this._jPopover.each(function(){if(this.parentNode)this.parentNode.removeChild(this);}).removeClass('hidden').show();delete this._jPopover['_delayDetach'];}
return this._jPopover;}
Eventful.Popover.prototype.find=function(sExpr)
{return this.popover().find(sExpr)}
Eventful.Popover.prototype.clickShow=function(jSel,bStayOpen){$(jSel)
.addClass('popover-sender autoclose')
.click(function(evt){(!bStayOpen&&this.isOpen())?this.close(evt):this.show(evt);evt.preventDefault();}.bind(this));return this;}
Eventful.Popover.prototype.clickClose=function(jSel){$(jSel).click(function(evt){this.close(evt);evt.preventDefault();}.bind(this));return this;}
Eventful.Popover.prototype.hoverShow=function(jSel,options){var fnShow,fnClose;if(options&&(options.show_over||options.show_slow)){fnShow=this._slowUIAct.bind(this,!options.show_slow,false);fnClose=this._slowUIAct.bind(this,!options.show_slow,true);}else{fnShow=this.show.bind(this);fnClose=this.close.bind(this);}
this.args.listenOverPopover=!!(options&&options.show_over);this.args.slowActOverPopover=this.args.listenOverPopover&&options.show_slow;$(jSel)
.addClass('popover-sender')
.bind('mouseenter',fnShow)
.bind('mouseleave',fnClose);return this;}
Eventful.Popover.prototype._slowUIAct=(function(){var fn=function(evt,bClosing){bClosing===true?this.close(evt):this.show(evt);},fnHalfSec=fn.slow(500),fnMillSec=fn.slow(10);return function(bQuick,bClosing,evt){(bQuick?fnMillSec:fnHalfSec)
.call(this,evt?{'target':evt.target,'pageX':evt.pageX,'pageY':evt.pageY}:null,bClosing);}})();Eventful.Popover.prototype.isOpen=function(bPopover){var inst=this.container({'get':'instance'});return bPopover?!!inst:this===inst;}
Eventful.Popover.prototype.show=function(evt){if(this.isOpen()){var lastShowEvt=this.container({'get':'event'});if(!evt)return this._position(lastShowEvt);if(lastShowEvt&&lastShowEvt.target===evt.target)return this._position(evt);}
if(this.isOpen(true)){this.container({'get':'instance'}).close(evt);}
this.container({'set':[this,evt]});if(!this.args.no_focus){this.container().find(":input").not('.inactive,:hidden').eq(0).trigger('focus');}
if(this.args.tracking){Eventful.TrackPageview.track(this.args.tracking);}
Eventful.Autoclose.set_id(this.container().attr('id'));this.eventShow.fire(evt);return this;}
Eventful.Popover.prototype.close=function(evt){this.container({'set':[null,null]});Eventful.Autoclose.element_id=null;this.eventClose.fire(evt);return this;}
Eventful.Autoclose.afterClosed.subscribe(function(elClose){if(elClose===Eventful.Popover.prototype.container()[0]){var intsToClose=Eventful.Popover.prototype.container({'get':'instance'});if(intsToClose)intsToClose.close();}});Eventful.Popover.prototype._position=function(evt){var docScrollTop=document.body.scrollTop||document.documentElement.scrollTop||0,docScrollLeft=document.body.scrollLeft||document.documentElement.scrollLeft||0,h=this.container().height(),w=this.container().width(),top=0,left=0;if(typeof this.args.position.relative=='object'||(this.args.position.relative=='sender'&&evt)){var jRelative=typeof this.args.position.relative==='object'?$(this.args.position.relative):$(evt.target).parents('.popover-sender').andSelf(),positionOffset=jRelative.offset();if(typeof this.args.position.top=='number'){top=positionOffset.top+this.args.position.top;}else if(typeof this.args.position.bottom=='number'){top=positionOffset.top+jRelative.height()-h-this.args.position.bottom;}else{top=positionOffset.top+10;}
if(typeof this.args.position.left=='number'){left=positionOffset.left+this.args.position.left;}else if(typeof this.args.position.right=='number'){left=positionOffset.left+jRelative.width()-w-this.args.position.right;}else{left=positionOffset.left+10;}}else if(this.args.position.relative=='viewport'){if(typeof this.args.position.top=='number'){top=docScrollTop+this.args.position.top;}else if(typeof this.args.position.bottom=='number'){top=docScrollTop+$(window).height()-h-this.args.position.bottom;}else{top=docScrollTop+10;}
if(typeof this.args.position.left=='number'){left=docScrollLeft+this.args.position.left;}else if(typeof this.args.position.right=='number'){left=docScrollLeft+$(window).width()-w-this.args.position.right;}else{left=docScrollLeft+10;}}else if(/^(mouse|click)$/.test(this.args.position.relative)&&evt){if(typeof this.args.position.top!=='number')this.args.position.top=10;if(typeof this.args.position.left!=='number')this.args.position.left=10;if(evt.pageY<=docScrollTop+$(window).height()*0.5){top=evt.pageY+this.args.position.top;}else{top=evt.pageY-this.args.position.top-h;}
if(evt.pageX<=docScrollLeft+$(window).width()*0.5){left=evt.pageX+this.args.position.left;}else{left=evt.pageX-this.args.position.left-w;}}
this.container().css({"top":top+"px","left":left+"px"});return this;}
Eventful.Popover.blockUI=function(){if(!Eventful.Popover.blockUI.blocker)Eventful.Popover.blockUI.blocker=new Eventful.Popover('<div id="eventful-uiblocker" style="height:'+$(document).height()+
'px;background:#FFFFFF url(http://s1.evcdn.com/store/skin/throbbers/throbber_32x32.gif) no-repeat fixed center center;"></div>',{css:{width:'100%',border:false,opacity:0.66},position:{top:0,left:0,relative:'viewport'}});Eventful.Popover.blockUI.blocker.show();}
Eventful.Popover.unblockUI=function(){if(Eventful.Popover.blockUI.blocker)Eventful.Popover.blockUI.blocker.close();}
Eventful.ManageFavorites=function(oArgs){if(!oArgs||!oArgs.type)return false;this.oArgs=oArgs;this.bTrack=oArgs.noTracking?false:true;this.sType=oArgs.type||null;$(document).ready(this.setup.bind(this));}
Eventful.ManageFavorites.prototype.setup=function(){this.jqDebug=$("#debug-text");}
Eventful.ManageFavorites.prototype.setType=function(sType){if(!sType)return;this.sType=sType;}
Eventful.ManageFavorites.prototype.doTrack=function(sType){if(!sType)return;Eventful.TrackPageview.track("/fav_"+sType);}
Eventful.ManageFavorites.prototype.doManageFavorite=function(sId,sAction,fnCallback){if(!sId||!sAction||!this.sType)return false;var url="/json/tools/users/favorites/"+this.sType+"/"+sAction;if(this.bTrack){this.doTrack(this.sType);}
if(Eventful.Session.userType!='session'){$.post(url,{id:sId},fnCallback,"json");}}
Eventful.ActionItems=function(oArgs){$(document).ready(this.setup.bind(this));}
Eventful.ActionItems.prototype.setup=function(){this.jqActionItems=$(".action-item");this.jqActionElements=$(".action-items li, .action-items tbody tr, .action-items dt, .action-items dd, .actionable");this.jqJoinButton=$("#btn-signin-required-join");this.jqJoinFrom=$("#form-signin-required-from");this.bFromSet=false;this.jqFrame=$("#outer-container");this.jqActionElements.hover(this.listenHandleHoverIn.bind(this),this.listenHandleHoverOut.bind(this));this.jqHoverElement=$('<div></div>')
.hide()
.appendTo(this.jqFrame)
.attr({id:'action-item-popover'})
.addClass("action-item-hover")
.text('this is text')
.click(this.listenActOnItemClick.bind(this));this.jqHoverElementHeight=this.jqHoverElement.outerHeight()
this.oPopover=new Eventful.Popover(this.jqHoverElement,{css:{zIndex:1000,width:125,backgroundColor:'#EAEAEA',border:'none'},bToggleClick:1,position:{relative:this.jqFrame,top:'auto',bottom:'auto',right:'auto',left:'auto'}});this.jqActionElements.each(function(_,oItem){this.oPopover.hoverShow(oItem,{show_over:true})}.bind(this));this.oManageFavs=new Eventful.ManageFavorites({type:null,noTracking:true});}
Eventful.ActionItems.prototype.listenHandleHoverIn=function(evt,oItem){var jqActor=$(".action-item",oItem);var sHoverText,sClassToAdd;if(jqActor.hasClass('is-item-fan')){this.updatePopoverCopy('is_fan');this.jqHoverElement.addClass('is-item-fan');}else{this.updatePopoverCopy('not_fan');this.jqHoverElement.removeClass('is-item-fan');}
this.jqHoverElement.attr('alt',jqActor.attr('alt'));var nDiffTop=(this.jqHoverElementHeight-jqActor.outerHeight())/2;var nTop=jqActor.offset().top-nDiffTop;var nLeft=jqActor.offset().left-this.jqFrame.offset().left-2;this.oPopover.args.position.top=nTop;this.oPopover.args.position.left=nLeft;this.oPopover.show();}
Eventful.ActionItems.prototype.listenHandleHoverOut=function(evt,oItem){}
Eventful.ActionItems.prototype.doTrack=function(sType){if(!sType)return;var sTrackId="/click_pfav_"+sType+"&type="+Eventful.Session.userType;Eventful.TrackPageview.track(sTrackId);}
Eventful.ActionItems.prototype.listenActOnItemClick=function(evt){var jqActor=$(evt.target);var sId=jqActor.attr('alt');var bDoSwitch=Eventful.Session.userType=='session'?false:true;if(/.*eventful.com\/my/.test(jqActor.attr('href'))){return;}
else{evt.preventDefault();}
if(Eventful.Session.userType=='session'){window.location=Eventful.Hosts.web+'/signin?goto='+escape(window.location.href);return;}
if(jqActor.hasClass('is-item-fan')){if(bDoSwitch)jqActor.removeClass('is-item-fan');this.doAddItem(sId,'remove');this.updateItemView(sId,'remove');this.updatePopoverCopy('not_fan');}else{jqActor.addClass('is-item-fan');this.doAddItem(sId,'add');this.updateItemView(sId,'add');this.updatePopoverCopy('is_fan');}}
Eventful.ActionItems.prototype.listenItemUpdated=function(){return;}
Eventful.ActionItems.prototype.updateItemView=function(sId,sAction){this.jqActionItems.each(function(_,oItem){jqActor=$(oItem);if(jqActor.attr('alt')==sId){if(sAction=='add'){jqActor.addClass('is-item-fan');}else if(sAction=='remove'){jqActor.removeClass('is-item-fan');}}});}
Eventful.ActionItems.prototype.updatePopoverCopy=function(sType){if(!sType)return;switch(sType){case'is_fan':this.jqHoverElement.html('Added - <a href="'+Eventful.Hosts.web+'/my">View Favorites</a>');this.jqHoverElement.attr('data-ga-label','View Favorites Link');break;case'not_fan':this.jqHoverElement.text('Add to favorites');this.jqHoverElement.attr('data-ga-label','Favorites Link');break;}}
Eventful.ActionItems.prototype.doAddItem=function(sId,sAction){if(!sId||!sAction)return;var aIdSplit=sId.split('-');var sType;switch(aIdSplit[0]){case'E0':sType='events';this.doTrack('event');break;case'V0':sType='venues';this.doTrack('venue');break;case'P0':sType='performers';this.doTrack('performer');break;case'M0':sType='movies';this.doTrack('movie');break;case'T0':sType='theaters';this.doTrack('theater');break;default:sType='users';this.doTrack('user');}
if(Eventful.Session.userType!='session'){this.oManageFavs.setType(sType);this.oManageFavs.doManageFavorite(sId,sAction,this.listenItemUpdated.bind(this));}}
new Eventful.ActionItems();Eventful.TrackTicketLinks=function(){$("a.ticket-link").click(function(evt){Eventful.TrackPageview.track("/click_ticket");});$('#movie-showtimes td.tickets a').click(function(){Eventful.fandango_link_source=Eventful.fandango_link_source||'unknown';Eventful.TrackPageview.trackEvent('Fandango Links','Click',Eventful.fandango_link_source,null);});}
$(Eventful.TrackTicketLinks);/*
 * jQuery Templating Plugin
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 */;(function(jQuery,undefined){var oldManip=jQuery.fn.domManip,tmplItmAtt="_tmplitem",htmlExpr=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,newTmplItems={},wrappedItems={},appendToTmplItems,topTmplItem={key:0,data:{}},itemKey=0,cloneIndex=0,stack=[];function newTmplItem(options,parentItem,fn,data){var newItem={data:data||(parentItem?parentItem.data:{}),_wrap:parentItem?parentItem._wrap:null,tmpl:null,parent:parentItem||null,nodes:[],calls:tiCalls,nest:tiNest,wrap:tiWrap,html:tiHtml,update:tiUpdate};if(options){jQuery.extend(newItem,options,{nodes:[],parent:parentItem});}
if(fn){newItem.tmpl=fn;newItem._ctnt=newItem._ctnt||newItem.tmpl(jQuery,newItem);newItem.key=++itemKey;(stack.length?wrappedItems:newTmplItems)[itemKey]=newItem;}
return newItem;}
jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(selector){var ret=[],insert=jQuery(selector),elems,i,l,tmplItems,parent=this.length===1&&this[0].parentNode;appendToTmplItems=newTmplItems||{};if(parent&&parent.nodeType===11&&parent.childNodes.length===1&&insert.length===1){insert[original](this[0]);ret=this;}else{for(i=0,l=insert.length;i<l;i++){cloneIndex=i;elems=(i>0?this.clone(true):this).get();jQuery.fn[original].apply(jQuery(insert[i]),elems);ret=ret.concat(elems);}
cloneIndex=0;ret=this.pushStack(ret,name,insert.selector);}
tmplItems=appendToTmplItems;appendToTmplItems=null;jQuery.tmpl.complete(tmplItems);return ret;};});jQuery.fn.extend({tmpl:function(data,options,parentItem){return jQuery.tmpl(this[0],data,options,parentItem);},tmplItem:function(){return jQuery.tmplItem(this[0]);},template:function(name){return jQuery.template(name,this[0]);},domManip:function(args,table,callback,options){if(args[0]&&args[0].nodeType){var dmArgs=jQuery.makeArray(arguments),argsLength=args.length,i=0,tmplItem;while(i<argsLength&&!(tmplItem=jQuery.data(args[i++],"tmplItem"))){}
if(argsLength>1){dmArgs[0]=[jQuery.makeArray(args)];}
if(tmplItem&&cloneIndex){dmArgs[2]=function(fragClone){jQuery.tmpl.afterManip(this,fragClone,callback);};}
oldManip.apply(this,dmArgs);}else{oldManip.apply(this,arguments);}
cloneIndex=0;if(!appendToTmplItems){jQuery.tmpl.complete(newTmplItems);}
return this;}});jQuery.extend({tmpl:function(tmpl,data,options,parentItem){var ret,topLevel=!parentItem;if(topLevel){parentItem=topTmplItem;tmpl=jQuery.template[tmpl]||jQuery.template(null,tmpl);wrappedItems={};}else if(!tmpl){tmpl=parentItem.tmpl;newTmplItems[parentItem.key]=parentItem;parentItem.nodes=[];if(parentItem.wrapped){updateWrapped(parentItem,parentItem.wrapped);}
return jQuery(build(parentItem,null,parentItem.tmpl(jQuery,parentItem)));}
if(!tmpl){return[];}
if(typeof data==="function"){data=data.call(parentItem||{});}
if(options&&options.wrapped){updateWrapped(options,options.wrapped);}
ret=jQuery.isArray(data)?jQuery.map(data,function(dataItem){return dataItem?newTmplItem(options,parentItem,tmpl,dataItem):null;}):[newTmplItem(options,parentItem,tmpl,data)];return topLevel?jQuery(build(parentItem,null,ret)):ret;},tmplItem:function(elem){var tmplItem;if(elem instanceof jQuery){elem=elem[0];}
while(elem&&elem.nodeType===1&&!(tmplItem=jQuery.data(elem,"tmplItem"))&&(elem=elem.parentNode)){}
return tmplItem||topTmplItem;},template:function(name,tmpl){if(tmpl){if(typeof tmpl==="string"){tmpl=buildTmplFn(tmpl)}else if(tmpl instanceof jQuery){tmpl=tmpl[0]||{};}
if(tmpl.nodeType){tmpl=jQuery.data(tmpl,"tmpl")||jQuery.data(tmpl,"tmpl",buildTmplFn(tmpl.innerHTML));}
return typeof name==="string"?(jQuery.template[name]=tmpl):tmpl;}
return name?(typeof name!=="string"?jQuery.template(null,name):(jQuery.template[name]||jQuery.template(null,htmlExpr.test(name)?name:jQuery(name)))):null;},encode:function(text){return(""+text).split("<").join("&lt;").split(">").join("&gt;").split('"').join("&#34;").split("'").join("&#39;");}});jQuery.extend(jQuery.tmpl,{tag:{"tmpl":{_default:{$2:"null"},open:"if($notnull_1){_=_.concat($item.nest($1,$2));}"},"wrap":{_default:{$2:"null"},open:"$item.calls(_,$1,$2);_=[];",close:"call=$item.calls();_=call._.concat($item.wrap(call,_));"},"each":{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},"html":{open:"if($notnull_1){_.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){_.push($.encode($1a));}"},"!":{open:""}},complete:function(items){newTmplItems={};},afterManip:function afterManip(elem,fragClone,callback){var content=fragClone.nodeType===11?jQuery.makeArray(fragClone.childNodes):fragClone.nodeType===1?[fragClone]:[];callback.call(elem,fragClone);storeTmplItems(content);cloneIndex++;}});function build(tmplItem,nested,content){var frag,ret=content?jQuery.map(content,function(item){return(typeof item==="string")?(tmplItem.key?item.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+tmplItmAtt+"=\""+tmplItem.key+"\" $2"):item):build(item,tmplItem,item._ctnt);}):tmplItem;if(nested){return ret;}
ret=ret.join("");ret.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,function(all,before,middle,after){frag=jQuery(middle).get();storeTmplItems(frag);if(before){frag=unencode(before).concat(frag);}
if(after){frag=frag.concat(unencode(after));}});return frag?frag:unencode(ret);}
function unencode(text){var el=document.createElement("div");el.innerHTML=text;return jQuery.makeArray(el.childNodes);}
function buildTmplFn(markup){return new Function("jQuery","$item","var $=jQuery,call,_=[],$data=$item.data;"+
"with($data){_.push('"+
jQuery.trim(markup)
.replace(/([\\'])/g,"\\$1")
.replace(/[\r\t\n]/g," ")
.replace(/\$\{([^\}]*)\}/g,"{{= $1}}")
.replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,function(all,slash,type,fnargs,target,parens,args){var tag=jQuery.tmpl.tag[type],def,expr,exprAutoFnDetect;if(!tag){throw"Template command not found: "+type;}
def=tag._default||[];if(parens&&!/\w$/.test(target)){target+=parens;parens="";}
if(target){target=unescape(target);args=args?(","+unescape(args)+")"):(parens?")":"");expr=parens?(target.indexOf(".")>-1?target+parens:("("+target+").call($item"+args)):target;exprAutoFnDetect=parens?expr:"(typeof("+target+")==='function'?("+target+").call($item):("+target+"))";}else{exprAutoFnDetect=expr=def.$1||"null";}
fnargs=unescape(fnargs);return"');"+
tag[slash?"close":"open"]
.split("$notnull_1").join(target?"typeof("+target+")!=='undefined' && ("+target+")!=null":"true")
.split("$1a").join(exprAutoFnDetect)
.split("$1").join(expr)
.split("$2").join(fnargs?fnargs.replace(/\s*([^\(]+)\s*(\((.*?)\))?/g,function(all,name,parens,params){params=params?(","+params+")"):(parens?")":"");return params?("("+name+").call($item"+params):all;}):(def.$2||""))+
"_.push('";})+
"');}return _;");}
function updateWrapped(options,wrapped){options._wrap=build(options,true,jQuery.isArray(wrapped)?wrapped:[htmlExpr.test(wrapped)?wrapped:jQuery(wrapped).html()]).join("");}
function unescape(args){return args?args.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null;}
function outerHtml(elem){var div=document.createElement("div");div.appendChild(elem.cloneNode(true));return div.innerHTML;}
function storeTmplItems(content){var keySuffix="_"+cloneIndex,elem,elems,newClonedItems={},i,l,m;for(i=0,l=content.length;i<l;i++){if((elem=content[i]).nodeType!==1){continue;}
elems=elem.getElementsByTagName("*");for(m=elems.length-1;m>=0;m--){processItemKey(elems[m]);}
processItemKey(elem);}
function processItemKey(el){var pntKey,pntNode=el,pntItem,tmplItem,key;if((key=el.getAttribute(tmplItmAtt))){while(pntNode.parentNode&&(pntNode=pntNode.parentNode).nodeType===1&&!(pntKey=pntNode.getAttribute(tmplItmAtt))){}
if(pntKey!==key){pntNode=pntNode.parentNode?(pntNode.nodeType===11?0:(pntNode.getAttribute(tmplItmAtt)||0)):0;if(!(tmplItem=newTmplItems[key])){tmplItem=wrappedItems[key];tmplItem=newTmplItem(tmplItem,newTmplItems[pntNode]||wrappedItems[pntNode],null,true);tmplItem.key=++itemKey;newTmplItems[itemKey]=tmplItem;}
if(cloneIndex){cloneTmplItem(key);}}
el.removeAttribute(tmplItmAtt);}else if(cloneIndex&&(tmplItem=jQuery.data(el,"tmplItem"))){cloneTmplItem(tmplItem.key);newTmplItems[tmplItem.key]=tmplItem;pntNode=jQuery.data(el.parentNode,"tmplItem");pntNode=pntNode?pntNode.key:0;}
if(tmplItem){pntItem=tmplItem;while(pntItem&&pntItem.key!=pntNode){pntItem.nodes.push(el);pntItem=pntItem.parent;}
delete tmplItem._ctnt;delete tmplItem._wrap;jQuery.data(el,"tmplItem",tmplItem);}
function cloneTmplItem(key){key=key+keySuffix;tmplItem=newClonedItems[key]=(newClonedItems[key]||newTmplItem(tmplItem,newTmplItems[tmplItem.parent.key+keySuffix]||tmplItem.parent,null,true));}}}
function tiCalls(content,tmpl,data,options){if(!content){return stack.pop();}
stack.push({_:content,tmpl:tmpl,item:this,data:data,options:options});}
function tiNest(tmpl,data,options){return jQuery.tmpl(jQuery.template(tmpl),data,options,this);}
function tiWrap(call,wrapped){var options=call.options||{};options.wrapped=wrapped;return jQuery.tmpl(jQuery.template(call.tmpl),call.data,options,call.item);}
function tiHtml(filter,textOnly){var wrapped=this._wrap;return jQuery.map(jQuery(jQuery.isArray(wrapped)?wrapped.join(""):wrapped).filter(filter||"*"),function(e){return textOnly?e.innerText||e.textContent:e.outerHTML||outerHtml(e);});}
function tiUpdate(){var coll=this.nodes;jQuery.tmpl(null,null,null,this).insertBefore(coll[0]);jQuery(coll).remove();}})(jQuery);/**
 * A simple querystring parser.
 * Example usage: var q = $.parseQuery(); q.fooreturns  "bar" if query contains "?foo=bar"; multiple values are added to an array. 
 * Values are unescaped by default and plus signs replaced with spaces, or an alternate processing function can be passed in the params object .
 * http://actingthemaggot.com/jquery
 *
 * Copyright (c) 2008 Michael Manning (http://actingthemaggot.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 **/jQuery.parseQuery=function(qs,options){var q=(typeof qs==='string'?qs:window.location.search),o={'f':function(v){return unescape(v).replace(/\+/g,' ');}},options=(typeof qs==='object'&&typeof options==='undefined')?qs:options,o=jQuery.extend({},o,options),params={};jQuery.each(q.match(/^\??(.*)$/)[1].split('&'),function(i,p){p=p.split('=');p[1]=o.f(p[1]);params[p[0]]=params[p[0]]?((params[p[0]]instanceof Array)?(params[p[0]].push(p[1]),params[p[0]]):[params[p[0]],p[1]]):p[1];});return params;}
Eventful.ThirdParty=function(adData){this.oParams=$.parseQuery();this.adData=(adData)?adData:[];this.global_delay=(this.oParams.global_delay)?this.oParams.global_delay:500;this.fb_delay=(this.oParams.fb_delay)?this.oParams.fb_delay:this.global_delay;this.rondavu_delay=(this.oParams.rondavu_delay)?this.oParams.rondavu_delay:this.global_delay;this.g1_delay=(this.oParams.g1_delay)?this.oParams.g1_delay:this.global_delay;this.ad_delay=(this.oParams.ad_delay)?this.oParams.ad_delay:this.global_delay;this.global_disable=(this.oParams.global_disable)?1:0;this.fb_disable=(this.oParams.disable_facebook_js_lib==='1')?1:this.global_disable;this.rondavu_disable=(this.oParams.rondavu_disable)?1:this.global_disable;this.g1_disable=(this.oParams.g1_disable)?1:this.global_disable;this.ad_disable=(this.oParams.ad_disable)?1:this.global_disable;$(this.setup.bind(this));};Eventful.ThirdParty.adData=[];Eventful.ThirdParty.eventDOMReady=new Eventful.UIEvent();Eventful.ThirdParty.prototype.renderAd=function(oItem){this.tmplAd=$('#template-ad').template();$(oItem.jqSelector).replaceWith($.tmpl(this.tmplAd,oItem));};Eventful.ThirdParty.prototype.renderFBAll=function(){if(this.jqBody.hasClass('disable-fb'))return;if(Eventful.FBConnect){window.fbAsyncInit=function(){Eventful.FBConnect.fbReady.fire();};}
(function(d,t){var e=d.createElement(t),f;e.type='text/javascript';e.async=true;e.src=d.location.protocol+'//connect.facebook.net/en_US/all.js';d.getElementById('fb-root').appendChild(e);f=function(){if(FB&&!Eventful.oFBConnect){Eventful.FBConnect.fbReady.fire();}};setTimeout(f,3000);setTimeout(f,7000);})(document,'script');};Eventful.ThirdParty.prototype.renderG1=function(){if(this.jqBody.hasClass('disable-g1'))return;(function(d,t){var e=d.createElement(t),s=d.getElementsByTagName(t)[0];e.type='text/javascript';e.async=true;e.src="https://apis.google.com/js/plusone.js";s.parentNode.insertBefore(e,s);})(document,'script');};Eventful.ThirdParty.prototype.renderRondavu=function(){if(this.jqBody.hasClass('disable-rondavu'))return;var scriptPath=arguments[0];(function(){var s=document.createElement('script');s.async=true;s.src=scriptPath;document.getElementsByTagName('head')[0].appendChild(s);})();};Eventful.ThirdParty.prototype.delayCall=function(fn,args,delay){var delay=(delay)?delay:0;setTimeout(function(){fn.apply(this,[args]);}.bind(this),delay);};Eventful.ThirdParty.prototype.loadAds=function(){if(this.jqBody.hasClass('disable-ads'))return;for(var i=0;i<this.nAds;i++){var item=this.adData[i];this.renderAd(item);}};Eventful.ThirdParty.prototype.setup=function(){this.jqBody=$('body');if(this.global_disable)return;this.nAds=this.adData.length;if(this.nAds&&!this.ad_disable){this.delayCall.apply(this,[this.loadAds,null,this.ad_delay]);}
if(!this.fb_disable){this.delayCall.apply(this,[this.renderFBAll,null,this.fb_delay]);}
if(!this.g1_disable){this.delayCall.apply(this,[this.renderG1,null,this.g1_delay]);}
if(window.RondavuScriptPath&&window.RondavuData&&!this.rondavu_disable){this.delayCall.apply(this,[this.renderRondavu,window.RondavuScriptPath,this.rondavu_delay]);}};Eventful.ThirdParty.eventDOMReady.subscribe(function(){new Eventful.ThirdParty(Eventful.ThirdParty.adData);});$(function(){Eventful.ThirdParty.eventDOMReady.fire();});Eventful.Cookies={};Eventful.Cookies.addCookie=function(sKey,sValue,nExpires)
{var sCurrentValue=Eventful.Cookies.getCookie(sKey);sValue=(sCurrentValue?sCurrentValue+'^':'')+sValue;Eventful.Cookies.setCookie(sKey,sValue,nExpires);}
Eventful.Cookies.setCookie=function(sKey,sValue,nExpires,sPath)
{if(!sPath)sPath='/';var sCookie=sKey+'='+sValue+';path='+sPath+';';if(nExpires)
{var oDate=new Date(new Date().getTime()+nExpires*60000);sCookie+='expires='+oDate.toUTCString()+';';}
document.cookie=sCookie;}
Eventful.Cookies.getCookie=function(sKey)
{var rx=new RegExp(sKey+'=([^;]*)');return(document.cookie.match(rx)||[])[1];}
Eventful.Cookies.removeCookie=function(sKey,sPath)
{Eventful.Cookies.setCookie(sKey,'',-1,sPath);}
Eventful.FBConnect=function(){this.sRequiredPermissions='publish_stream,email,user_birthday,user_about_me,user_interests,offline_access,user_location,user_likes';this.oFBLoggedIn=new Eventful.UIEvent();this.oFBLoggedOut=new Eventful.UIEvent();this.oFBAuthResponseChange=new Eventful.UIEvent();this.oFBStatusChange=new Eventful.UIEvent();this.oFBItemLiked=new Eventful.UIEvent();this.oFBItemUnliked=new Eventful.UIEvent();this.oFBCommentAdded=new Eventful.UIEvent();this.oFBLogged=new Eventful.UIEvent();$(this.setup.bind(this));};Eventful.FBConnect.getInstance=function(){return Eventful.oFBConnect=Eventful.oFBConnect||new Eventful.FBConnect();};Eventful.FBConnect.fbReady=new Eventful.UIEvent();Eventful.FBConnect.fbReady.subscribe(Eventful.FBConnect.getInstance);Eventful.FBConnect.prototype.setup=function(){if(window.Eventful.FacebookAppId===undefined)return;if(window.FB===undefined)return;FB.init({appId:Eventful.FacebookAppId,oauth:true,status:true,cookie:false,xfbml:true,channelUrl:window.location.protocol+'//'+window.location.host+'/fb_xd_channel.html'});FB.getLoginStatus(function(res){if(!res||res.status!=="connected"){FB.Event.subscribe('auth.login',this.listenLoginState.bind(this,null));}}.bind(this));FB.Event.subscribe('auth.logout',function(){this.oFBLoggedOut.fire()}.bind(this));FB.Event.subscribe('auth.authResponseChange',function(){this.oFBAuthResponseChange.fire()}.bind(this));FB.Event.subscribe('auth.statusChange',function(){this.oFBStatusChange.fire()}.bind(this));FB.Event.subscribe('edge.create',function(){Eventful.TrackPageview.trackSocial("Facebook","fbLike");this.oFBItemLiked.fire()}.bind(this));FB.Event.subscribe('edge.remove',function(){Eventful.TrackPageview.trackSocial("Facebook","fbUnlike");this.oFBItemUnliked.fire()}.bind(this));FB.Event.subscribe('message.send',function(){Eventful.TrackPageview.trackSocial("Facebook","fbSend");this.oFBItemUnliked.fire()}.bind(this));FB.Event.subscribe('comments.add',function(){Eventful.TrackPageview.trackSocial("Facebook","fbComment");this.oFBCommentAdded.fire()}.bind(this));FB.Event.subscribe('fb.log',function(){this.oFBLogged.fire()}.bind(this));};Eventful.FBConnect.prototype.authorize=function(url){var sParams=Eventful.Cookies.getCookie("override_fb_params");url=url||null;if(sParams){var oAuthResponse=jQuery.parseQuery(decodeURIComponent(sParams));return this.listenLoginState(null,{authResponse:oAuthResponse});}
FB.login(this.listenLoginState.bind(this,url),{scope:this.sRequiredPermissions});};Eventful.FBConnect.prototype.listenLoginState=function(url,response){if(response.authResponse){this.oAuthResponse=response.authResponse;this.oFBLoggedIn.fire(this.oAuthResponse);if(url){window.location.href=url;}}else{this.oFBLoggedOut.fire();}};Eventful.Signin=function(){this.eventEvUserLoggedIn=new Eventful.UIEvent();$(this.setup.bind(this));};Eventful.Signin.prototype.setup=function(){this.jqFBLogin=$('.fb-login-click');this.jqPopover=new Eventful.Popover("#user-panel-popover",{css:{width:'',border:'',zIndex:1010,backgroundColor:''},position:{relative:$('#user-panel-signin'),top:20,left:'auto',right:-81},tracking:'lbox_signin'})
.clickShow('#user-panel-signin, #user-panel-signin-block',true);this.jqFBLogin.click(this.listenConnectButtonClicked.bind(this));Eventful.FBConnect.fbReady.subscribe(function(){this.FBConnect().oFBLoggedIn.subscribe(this.listenLoggedIn.bind(this));}.bind(this));};Eventful.Signin.prototype.FBConnect=function(e){return Eventful.FBConnect.getInstance();}
Eventful.Signin.prototype.listenConnectButtonClicked=function(e){this.jqClickedFacebookButton=$(e.target);this.FBConnect().authorize();e.preventDefault();};Eventful.Signin.prototype.listenLoggedIn=function(oSession){if(!oSession){return;}
this.oFBSession=oSession;this.logInEvUser();};Eventful.Signin.prototype.logInEvUser=function(oExtraParams){if(!this.oFBSession){return;}
if(this.bLoggingIn)return;this.bLoggingIn=true;var params={};$.extend(params,this.oFBSession,oExtraParams);$.post("/json/apps/facebook/login",params,function(oResponse){delete this.bLoggingIn;if(oResponse.status==="ok"){this.listenEvUserLoggedIn(oResponse);}else{this.listenEvUserLoggedOut(oResponse);}}.bind(this),"json");};Eventful.Signin.prototype.listenEvUserLoggedIn=function(oResponse){if(!this.jqClickedFacebookButton)return;this.loading('hide');var sAction=this.jqClickedFacebookButton.attr('data-goto');if(sAction=='no_reload'){this.eventEvUserLoggedIn.fire(oResponse);return;}else if(sAction){window.location.href=sAction;}else{window.location.reload();}};Eventful.Signin.prototype.listenEvUserLoggedOut=function(oResponse){if(!oResponse)return;this.loading('hide');if(!this.jqClickedFacebookButton)return;if(oResponse.status==="error"){if(oResponse.message=="emails do not match"){this.panel().show();}else if(oResponse.message=="password invalid"){this.listenBadPassword();}else{if(!this.oFacebookLoginFailed){$('\
        <div id="facebook-login-failed" class="hidden">\
          <div class="hd">Facebook Login Failed</div>\
          <div class="bd">Sorry, Facebook encountered an error while trying to log you in.</div>\
        </div>\
        ').appendTo('body');this.oFacebookLoginFailed=new Eventful.Panel('facebook-login-failed').options({width:300});}
this.oFacebookLoginFailed.show();}}};Eventful.Signin.prototype.panel=function(){if(this._jqPanel){return this._jqPanel;}else{var _sHtml='<div id="facebook-signin-panel" class="hidden">';_sHtml+='<div class="hd">';_sHtml+='<h1>Connect your account with facebook</h1>';_sHtml+='</div>';_sHtml+='<div class="bd">';_sHtml+='<div class="reason">';_sHtml+='<p>You already have an Eventful account with a different email address than connected to your Facebook account.</p><p>Would you like to create a new user tied to your Facebook information or merge the existing Eventful account with your Facebook information?</p>';_sHtml+='<div class="buttons">';_sHtml+='<span class="update option">Merge Accounts</span>';_sHtml+='<span class="or">or</span>';_sHtml+='<span class="create option">Create New Account</span>';_sHtml+='</div>';_sHtml+='</div>';_sHtml+='<div class="authenticate hidden">';_sHtml+='<p>To protect the privacy and security of your Eventful account, please enter the password associated with your Eventful account and click "Continue".</p><p>Or click the "Create New Account" button to create a new account based on your Facebook information.</p>';_sHtml+='<div class="password"><span class="label">Enter Password</span><input type="password" name="password" id="inp-facebook-signin-panel" class="text-input"><a href="/forgot">Forgot your password</a></div>';_sHtml+='<div class="buttons">';_sHtml+='<span class="continue option">Continue</span>';_sHtml+='<span class="or">or</span>';_sHtml+='<span class="create option">Create New Account</span>';_sHtml+='</div>';_sHtml+='<p class="bad-pass hidden">';_sHtml+='That password is incorrect';_sHtml+='</p>';_sHtml+='</div>';_sHtml+='</div>';_sHtml+='</div>';$(_sHtml).appendTo('body');this._jqPanel=new Eventful.Panel('facebook-signin-panel').
options({width:536,onShow:null});$('#facebook-signin-panel span.update').click(this.listenUpdateUserClicked.bind(this));$('#facebook-signin-panel span.create').click(this.listenCreateUserClicked.bind(this));$('#facebook-signin-panel span.continue').click(this.listenContinueClicked.bind(this));this._jqPanel.eventShow.subscribe(this.listenPanelDisplay.bind(this,'on'));this._jqPanel.eventClose.subscribe(this.listenPanelDisplay.bind(this,'off'));return this._jqPanel;}}
Eventful.Signin.prototype.listenUpdateUserClicked=function(){Eventful.Forms.focusFirstField(this.panel().find('.reason').addClass('hidden').end().find('.authenticate').removeClass('hidden').end());};Eventful.Signin.prototype.listenCreateUserClicked=function(){if(this.loadingStatus==1)return;this.logInEvUser({skip_email_check:1});this.loading('show');};Eventful.Signin.prototype.listenContinueClicked=function(){if(this.loadingStatus==1)return;this.panel().find('.bad-pass').slideUp();this.logInEvUser({password:$('#inp-facebook-signin-panel').val()});this.loading('show');};Eventful.Signin.prototype.listenPanelDisplay=function(sAction){if(sAction=='on'){$('#modalContainer a.modalCloseImg').addClass('fbMoved');}else{$('#modalContainer a.modalCloseImg').removeClass('fbMoved');}};Eventful.Signin.prototype.listenBadPassword=function(){this.loading('hide');this.panel().find('.bad-pass').slideDown();};Eventful.Signin.prototype.loading=function(sState){if(sState=='show'){if(this._jqPanel)this.panel().addClass='loading';this.loadingStatus=1;}else{if(this._jqPanel)this.panel().removeClass='loading';this.loadingStatus=0;}}
Eventful.oSignin=new Eventful.Signin();Eventful.LB=function(){$(this.setup.bind(this));};Eventful.LB.prototype.setup=function(){this.oQueryString=$.parseQuery();this.lightbox;if(!this.oQueryString.lbURL){return;}
this.constructContents(this.oQueryString.lbURL);}
Eventful.LB.prototype.listenLoad=function(){var height=$('#lightboxer').innerHeight();var width=$('#lightboxer').innerWidth();this.lightbox.resize();}
Eventful.LB.prototype.constructContents=function(url){var sHTML='<img id="lightboxer" src="'+url+'" />';$(sHTML).appendTo('body');this.lightbox=new Eventful.Panel('lightboxer').options({width:300});this.lightbox.show();$('#lightboxer').load(this.listenLoad.bind(this));}
Eventful.lbViewer=new Eventful.LB();Eventful.CircularQ=function()
{this.iter=null;if(arguments.length==1)
{this.queue=arguments[0];}
else
{this.queue=[];}}
Eventful.CircularQ.prototype={next:function()
{if(this.queue.length>0)
{var next;if(this.iter===null)next=0;else next=this.iter+1;if(next>=this.queue.length)
{next=0;}
this.iter=next;return this.queue[next];}
else
{return null;}},prev:function()
{if(this.queue.length>0)
{var prev;if(this.iter===null)prev=this.queue.length-1;else prev=this.iter-1;if(prev<0)
{prev=this.queue.length-1;}
this.iter=prev;return this.queue[prev];}
else
{return null;}},goto:function(goTo)
{if((this.queue.length>0)&&(goTo<=this.queue.length))
{var idToGoTo=goTo-1;this.iter=idToGoTo;return this.queue[idToGoTo];}
else
{return null;}},current:function()
{if(this.queue.length>0)
{var current=this.iter;return this.queue[current];}
else
{return null;}},add:function(item)
{this.queue.push(item);},extend:function(items)
{this.queue=this.queue.concat(items);},rem:function(idx)
{this.queue.splice(idx,1);}}
Eventful.InactiveText=function(el)
{el=$(el);el.blur();el.blur(Eventful.InactiveText.listenBlur);el.focus(Eventful.InactiveText.listenFocus);if(!el.prop('defaultValue'))
{el.val(el.attr('alt'));el.addClass('inactive');}else
{el.val(el.prop('defaultValue'));}
el.removeClass('inactive-text');}
Eventful.InactiveText.attachHandlers=function(root)
{$('.inactive-text',root).each(function(_,el){Eventful.InactiveText(el);});}
Eventful.InactiveText.listenBlur=function(evt)
{var el=$(evt.target);if(!el.val()&&!el.parents('.field-container.has-error').size())
{el.addClass('inactive');el.val(el.attr('alt'));}}
Eventful.InactiveText.listenFocus=function(evt)
{var el=$(evt.target);if(el.hasClass('inactive'))
{el.removeClass('inactive');el.val('');}}
Eventful.InactiveText.doForcedUpdate=function(el)
{el=$(el);el.addClass('inactive');el.val(el.attr('alt'));}
Eventful.DropDown=function(oArgs)
{this.elInput=oArgs.input;this.elPopover=oArgs.popover;this.nMinInputLength=oArgs.minInputLength||0;this.listItemClass=oArgs.listItemClass||0;this.bSuggestionMode=oArgs.suggestionMode||0;this.bExact=oArgs.exact;this.eventItemSelected=new Eventful.UIEvent();this.eventInputChanged=new Eventful.UIEvent();this.eventPopoverShown=new Eventful.UIEvent();this.eventItemHighlighted=new Eventful.UIEvent();this.eventEscRequested=new Eventful.UIEvent();this.eventBlur=new Eventful.UIEvent();this.eventBadFocus=new Eventful.UIEvent();this.eventEnterAfterSelected=new Eventful.UIEvent();$(this.setup.bind(this));}
Eventful.DropDown.prototype.popover=function()
{return this.jqPopover?this.jqPopover:this.jqPopover=$(this.elPopover);}
Eventful.DropDown.prototype.find=function(sExpr)
{return this.popover().find(sExpr);}
Eventful.DropDown.prototype.input=function()
{return this.jqInput?this.jqInput:this.jqInput=$(this.elInput);}
Eventful.DropDown.prototype.list=function()
{return this.jqList?this.jqList:this.jqList=this.find('ul:first');}
Eventful.DropDown.prototype.setup=function()
{if(this.input().hasClass('inactive-text'))
{Eventful.InactiveText(this.input());}
this.input().
focus(this.listenFocus.bind(this)).
click(this.listenClick.bind(this)).
blur(this.listenBlur.bind(this)).
keyup(this.listenKeyUp.bind(this));if(jQuery.browser.safari||jQuery.browser.msie)
{this.input().keydown(this.listenKeyDown.bind(this));}else
{this.input().keypress(this.listenKeyDown.bind(this));}
this.popover().
mousedown(this.listenMouseDown.bind(this)).
mouseup(this.listenMouseUp.bind(this));this.sListItem=this.listItemClass?'li.'+this.listItemClass:'li';if(this.list().html())
{this.list().find(this.sListItem).
mouseover(this.listenMouseOver.bind(this)).
click(this.listenClickItem.bind(this))}else
{this.list().
mouseover(this.listenMouseOver.bind(this)).
click(this.listenClickItem.bind(this));}}
Eventful.DropDown.prototype.reset=function()
{if(!this.bSuggestionMode){this.input().val('');}
this.popover().hide();this.list().empty();this.queue(null);if(!this.bHasFocus)
{Eventful.InactiveText.doForcedUpdate(this.input())}}
Eventful.DropDown.prototype.currentElement=function()
{if(this.oQueue&&this.oQueue.iter>=0)
{return this.list().find(this.sListItem).eq(this.oQueue.iter);}}
Eventful.DropDown.prototype.indexFromElement=function(el)
{el=$(el);el=el.is('li')?el:el.parents('li');if(el[0]){return this.list().find(this.sListItem).index(el[0]);}}
Eventful.DropDown.prototype.queue=function(oQueue)
{if(oQueue!==undefined)
{if(oQueue&&!this.bSuggestionMode)oQueue.next();this.oQueue=oQueue;}
return this.oQueue;}
Eventful.DropDown.prototype.usingQueue=function(bUsingQueue)
{if(bUsingQueue!==undefined)this.bUsingQueue=bUsingQueue;return this.bUsingQueue;}
Eventful.DropDown.prototype.showPopover=function()
{var sVal=this.input().hasClass('inactive')?'':this.input().val();if((this.list().html()||this.popover().hasClass('empty'))&&sVal.length>=this.nMinInputLength)
{this.popover().show();this.find('iframe.popover-layer').css({width:this.popover().width(),height:this.popover().height()+500});this.eventPopoverShown.fire();setTimeout(function(){this.input().select()}.bind(this),0);}}
Eventful.DropDown.prototype.highlight=function(arg)
{if(this.oQueue[arg]||arg!=this.oQueue.iter)
{if(this.oQueue[arg])
{this.oQueue[arg]();}else
{this.oQueue.goto(arg%this.oQueue.queue.length+1);}}
this.list().find('li.highlight').removeClass('highlight');var jqCurrentElement=this.currentElement();if(jqCurrentElement){jqCurrentElement.addClass('highlight');}}
Eventful.DropDown.prototype.clearInput=function()
{if(!this.input().hasClass('inactive'))
{this.input().val('');if(this.input().attr('alt'))
{Eventful.InactiveText.listenBlur({target:this.input()});}}}
Eventful.DropDown.prototype.listenClick=function()
{if(this.popover().css('display')!='block')
{this.showPopover();}}
Eventful.DropDown.prototype.listenFocus=function()
{if(!this.input().is(':visible'))
{this.eventBadFocus.fire();return;}
if(this.bHasFocus)return;this.bHasFocus=true;this.showPopover();}
Eventful.DropDown.prototype.listenBlur=function()
{if(this.bIgnoreBlur)
{this.bIgnoreBlur=false;return;}
this.eventBlur.fire();this.popover().hide();this.bHasFocus=false;}
Eventful.DropDown.prototype.listenKeyDown=function(evt)
{switch(evt.keyCode)
{case 27:evt.preventDefault();this.eventEscRequested.fire(this.oQueue.current());break;case 38:if(this.oQueue)
{evt.preventDefault();this.usingQueue(true);this.highlight('prev');this.eventItemHighlighted.fire(this.oQueue.current());}
break;case 40:if(this.oQueue)
{evt.preventDefault();this.usingQueue(true);this.highlight('next');this.eventItemHighlighted.fire(this.oQueue.current());}
break;case 13:if(this.oQueue)
{evt.preventDefault();if(this.popover().is(':visible'))
{if(this.usingQueue()||this.bExact)
{this.eventItemSelected.fire(this.oQueue.current());}else
{this.eventItemSelected.fire(this.input().val())}
this.popover().hide();}
else
{this.eventEnterAfterSelected.fire();}}
break;}
this.sOldInput=this.input().val();}
Eventful.DropDown.prototype.listenKeyUp=function(evt)
{var sInput=this.input().val();if(this.sOldInput!=sInput)
{this.usingQueue(false);this.eventInputChanged.fire(sInput);}}
Eventful.DropDown.prototype.listenMouseOver=function(evt)
{this.highlight(this.indexFromElement(evt.target));}
Eventful.DropDown.prototype.listenClickItem=function(evt)
{var i=this.indexFromElement(evt.target);this.oQueue.goto(i+1);this.eventItemSelected.fire(this.oQueue.current());this.popover().hide();}
Eventful.DropDown.prototype.listenMouseDown=function()
{this.bIgnoreBlur=true;}
Eventful.DropDown.prototype.listenMouseUp=function()
{this.input().focus();}
Eventful.TypeAhead=function(oArgs)
{if(typeof oArgs==="undefined")return;this.id=oArgs.id;this.bSingular=!oArgs.multiple;this.sExcludeQuery=null;this.oItemsToExclude={};this.bOptions=oArgs.options;this.bRequired=oArgs.required;this.sListItemClass=oArgs.itemClass||'click-result';this.bSuggestionMode=oArgs.suggestionMode||0;this.bHideDescription=oArgs.hide_description;this.nMinInputLength=(typeof oArgs.minInputLength==="number")?oArgs.minInputLength:2;this.bDefaultOnBlur=this.bRequired||oArgs.default_on_blur;this.bForceBoldSearchTerms=oArgs.forceBoldSearchTerms;this.eventItemSelected=new Eventful.UIEvent();this.eventNoItemSelected=new Eventful.UIEvent();this.eventOptionSelected=new Eventful.UIEvent();this.eventItemRemoved=new Eventful.UIEvent();this.eventEnterConfirm=new Eventful.UIEvent();this.eventInputChanged=new Eventful.UIEvent();this.oDropDown=new Eventful.DropDown({exact:1,input:'#inp-'+this.id,popover:'#popover-'+this.id,listItemClass:this.sListItemClass,suggestionMode:this.bSuggestionMode,minInputLength:this.nMinInputLength});this.oDropDown.eventItemSelected.subscribe(this.listenItemSelected.bind(this));this.oDropDown.eventItemHighlighted.subscribe(this.listenItemHighlighted.bind(this));this.oDropDown.eventInputChanged.subscribe(this.listenInputChanged.bind(this));this.oDropDown.eventEnterAfterSelected.subscribe(this.listenEnterAfterSelected.bind(this));this.oDropDown.eventEscRequested.subscribe(this.listenEscRequested.bind(this));if(this.bDefaultOnBlur)
{this.oDropDown.eventBlur.subscribe(this.listenBlur.bind(this));}
$(this.setup.bind(this));}
Eventful.TypeAhead.prototype.typeahead=function()
{return this.jqTypeahead?this.jqTypeahead:this.jqTypeahead=$('#type-ahead-'+this.id);}
Eventful.TypeAhead.prototype.selected=function()
{return this.jqSelected?this.jqSelected:this.jqSelected=$('ul',this.typeahead());}
Eventful.TypeAhead.prototype.description=function()
{return this.jqDescription?this.jqDescription:this.jqDescription=$('#description-'+this.id);}
Eventful.TypeAhead.prototype.setup=function()
{Eventful.InactiveText(this.oDropDown.input());if(this.bSingular)
{this.oDropDown.input().css({width:'98%'});this.selected().hide();}
if(this.bOptions)
{this.renderResults();}
if(this.bSuggestionMode)
{this.oDropDown.input().focus(function(){this.oDropDown.popover().show();this.oDropDown.eventPopoverShown.fire();}.bind(this));}
this.updateInputLength();}
Eventful.TypeAhead.prototype.updateInputLength=function()
{if(this.bSingular)return;var nWidth=this.typeahead().width()-this.selected().width()-10;this.oDropDown.input().css({width:nWidth+'px'});this.oDropDown.popover().css({left:this.selected().width()+'px'});}
Eventful.TypeAhead.prototype.removeExcluded=function(aResults){return aResults;}
Eventful.TypeAhead.prototype.setValue=function(sValue)
{if(sValue)
{this.oDropDown.input().val(sValue).removeClass('inactive');}else
{this.reset();}}
Eventful.TypeAhead.prototype.reset=function()
{this.item(null);}
Eventful.TypeAhead.prototype.promoteType=function(aResults,listingType){return aResults.sort(function(a,b){if(a.type===listingType&&b.type!==listingType)return-1;if(a.type!==listingType&&b.type===listingType)return 1;return 0;});}
Eventful.TypeAhead.prototype.addSponsoredViewMore=function(oItem){if(oItem.show_uri){oItem.permalink=oItem.base_url+'/show/'+oItem.show_uri;var jqDetailLink=$('<a />').text('View Full Schedule').attr('href',oItem.permalink);$('<li />').addClass('typeahead-full-schedule').
attr({id:oItem.seeMoreID}).
html(jqDetailLink).
insertAfter('#'+oItem.domID);$('<span />').text('sponsored').appendTo('#'+oItem.domID);$('#'+oItem.seeMoreID).click(function(){window.location.href=oItem.permalink;return false;});}}
Eventful.TypeAhead.prototype.renderResults=function(sQuery,aResults,oAdditionalArgs)
{this.typeahead().removeClass('loading');if(this.bOptions)
{var aOptions=this.options();if(aOptions&&aOptions.length)
{aResults=(aResults||[]).concat(aOptions);}}
if(!aResults)return;this.promoteType.apply(this,[aResults,"sponsored"]);aResults=this.removeExcluded(aResults);if((sQuery&&!this.bSuggestionMode)||(sQuery&&this.bForceBoldSearchTerms))
{var aSplit=$.grep(sQuery.split(/[\s,']+/),function(s){return s;});var rxBold=new RegExp('('+aSplit.join('|')+')','ig');}
if(aResults.length)
{this.oDropDown.popover().removeClass('empty');this.oDropDown.queue(new Eventful.CircularQ(aResults));this.oDropDown.list().empty();if(this.bShowSuggestionHeaders){var elIntroText=$('<li>').
addClass('suggestion-header').
html('<em>Or, are you looking for&#0133;</em>').
appendTo(this.oDropDown.list());}
$.each(aResults,function(i,oItem)
{if(this.bShowCategoryHeaders&&oItem.type&&(!this.sSection||this.sSection!=oItem.type)){var elCatHeader=$('<li>').
addClass('result-cat').
addClass('header-type-'+oItem.type).
html(this.itemCategoryHeader(oItem)).
appendTo(this.oDropDown.list());}
var sTitle=this.itemTitle(oItem);if(rxBold&&!oItem.option)
{sTitle=sTitle.replace(rxBold,'<b>$1</b>');}
var sDescription=this.itemDescription(oItem);var sItemID=this.itemId(oItem)||Math.floor(Math.random()*10000000);oItem.domID='type-ahead-'+this.id+'-'+sItemID;oItem.seeMoreID=oItem.domID+'-full-schedule';var elItem=$('<li>').
addClass(this.sListItemClass).
attr('id',oItem.domID).
html(sTitle+(sDescription?'<p class="diminished">'+sDescription+'</p>':'')).
appendTo(this.oDropDown.list());elItem.addClass('result-type-'+oItem.type);if(!this.bSuggestionMode&&!i)elItem.addClass(i?'':'highlight');if(oItem.type==="sponsored"){this.addSponsoredViewMore.call(this,oItem);}
if(oItem.option)elItem.addClass('option');if(oItem.customClass)elItem.addClass(oItem.customClass);if(i==0)elItem.addClass('first');}.bind(this));}else
{this.oDropDown.popover().addClass('empty');this.oDropDown.queue(null);this.oDropDown.list().empty();}
this.sSection=null;if(this.oDropDown.bHasFocus)
{this.oDropDown.popover().show();}}
Eventful.TypeAhead.prototype.item=function(oItem)
{if(oItem===null)
{this.description().hide();this.oDropDown.reset();this.renderResults();}else if(oItem)
{var sTitle=this.itemTitle(oItem);var sDescription=this.itemDescription(oItem);if(this.bSingular)
{if(!this.bSuggestionMode){this.setValue(sTitle);}
if(sDescription&&!this.bHideDescription)
{this.description().html(sDescription).show().removeClass('hidden');}else
{this.description().hide();}}else
{this.oDropDown.input().css({width:0}).val('');this.oDropDown.list().empty();var elItem=$('<li>'+sTitle+' <span class="faded delete_box click-remove">X</span></li>').
appendTo(this.selected());elItem.find('.click-remove').click(this.listenClickRemove.bind(this,elItem,oItem));this.updateInputLength();}}
if(typeof oItem!=='undefined')this.oItem=oItem;return this.oItem;}
Eventful.TypeAhead.prototype.listenBlur=function()
{if(!this.oDropDown.input().is(':visible'))return;var oItem=this.item();var oQueue=this.oDropDown.oQueue;if(oQueue&&oQueue.queue[0]&&!oQueue.queue[0].option&&(oQueue.iter==0||!oItem))
{this.item(oQueue.queue[0]);this.eventItemSelected.fire(oQueue.queue[0]);}else if(oItem)
{this.item(oItem);}}
Eventful.TypeAhead.prototype.listenItemSelected=function(oItem)
{if(!oItem)
{this.eventNoItemSelected.fire();return;}
if(oItem.option)
{this.eventOptionSelected.fire(oItem);}else{this.item(oItem);this.eventItemSelected.fire(oItem);Eventful.InactiveText.listenFocus({target:this.oDropDown.input()});this.oDropDown.input().select();}}
Eventful.TypeAhead.prototype.listenEnterAfterSelected=function()
{if(this.item())
{this.eventEnterConfirm.fire(this.item());}}
Eventful.TypeAhead.prototype.listenItemHighlighted=function(oItem)
{if(!oItem.option)
{this.item(oItem);}}
Eventful.TypeAhead.prototype.listenInputChanged=function(sInput)
{this.description().hide();if(!this.oDropDown.input().hasClass('inactive')&&sInput.length>=this.nMinInputLength)
{this.typeahead().addClass('loading');this.search(sInput);}else{if(sInput.length===0&&!this.bRequired)
{this.reset();}
if(!this.bSuggestionMode)
{this.oDropDown.popover().hide();}}
this.eventInputChanged.fire();}
Eventful.TypeAhead.prototype.listenClickRemove=function(elItem,oItem,evt)
{$(elItem).remove();this.updateInputLength();this.eventItemRemoved.fire(oItem);}
Eventful.TypeAhead.prototype.listenServerResponse=function(sQuery,oResponse)
{var aResults=(oResponse||{}).results||[];this.renderResults(sQuery,aResults);}
Eventful.TypeAhead.prototype.listenEscRequested=function()
{if(this.bSuggestionMode){this.reset();}}
Eventful.LocationTypeAhead=function(oArgs)
{this.nTruncate=oArgs.truncate||oArgs.length||64;this.sExclude=oArgs.exclude||'';this.bBubbleUp=oArgs.bubble_up||'';this.sRegionId=oArgs.region_id||'';this.sLocationType=oArgs.location_type||'';Eventful.TypeAhead.call(this,oArgs);this.eventLocationPosted=new Eventful.UIEvent();if(oArgs.post)
{this.eventItemSelected.subscribe(this.listenLocationSelected.bind(this));}}.mixin(Eventful.TypeAhead);Eventful.LocationTypeAhead.prototype.itemTitle=function(oLocation)
{var aSplit=this.splitLines(oLocation);if(aSplit)
{return aSplit[1].trim().truncate(this.nTruncate);}
return oLocation.pretty_name.truncate(this.nTruncate);}
Eventful.LocationTypeAhead.prototype.itemDescription=function(oLocation)
{var aSplit=this.splitLines(oLocation);if(aSplit)
{return aSplit[2].trim().truncate(this.nTruncate);}}
Eventful.LocationTypeAhead.prototype.splitLines=function(oLocation)
{return oLocation.pretty_name.match(/^(.*)\((.*)\)$/);}
Eventful.LocationTypeAhead.prototype.itemId=function(oLocation)
{return oLocation.location_type+'-'+oLocation.location_id;}
Eventful.LocationTypeAhead.prototype.search=function(sQuery)
{$.get('/json/tools/location/typedown',this.searchParams(sQuery),this.listenServerResponse.bind(this,sQuery),'json');}.slow(500);Eventful.LocationTypeAhead.prototype.searchParams=function(sQuery)
{return{location:sQuery,destination_key:'results',recent:1,bubble_up:this.bBubbleUp,region_id:this.sRegionId,location_type:this.sLocationType,exclude:this.sExclude};}
Eventful.LocationTypeAhead.prototype.listenLocationSelected=function(oLocation)
{$.post('/json/tools/location',{location_type:oLocation.location_type,location_id:oLocation.location_id,input_token:'save'},this.listenLocationPosted.bind(this,oLocation),'json');}
Eventful.LocationTypeAhead.prototype.listenLocationPosted=function(oLocation,oResponse)
{this.eventLocationPosted.fire(oLocation,oResponse);}
Eventful.LocationTypeAhead.prototype.options=function()
{return Eventful.LocationTypeAhead.options;}
Eventful.LocationTypeAhead.options=[{pretty_name:'Worldwide',option:1,worldwide:1,svid:'V0-001-000000001-8'}];Eventful.GoogleAnalytics={};Eventful.GoogleAnalytics.setup=function(){if(typeof window["console"]==="object"&&Eventful.Session&&Eventful.Session.userRole==="admin"){this.bLog=true;}
if(typeof window["console"]==="object"&&Eventful.Session&&Eventful.Session.userRole==="admin"){this.bLog=true;}
$("[data-ga-label]").live("click change",this.listenUserAction.bind(this));};Eventful.GoogleAnalytics.listenUserAction=function(evt){if(evt.type=='click'&&evt.target.type=='checkbox'){return};var jqLabel=$(evt.currentTarget),jqAction,jqCategory,sLabel,sAction,sCategory;if(Eventful.GADebug){evt.preventDefault();}
sLabel=jqLabel.data("ga-label");jqAction=jqLabel.closest("[data-ga-action]");if(jqAction.length){sAction=jqAction.data("ga-action");}
jqCategory=jqLabel.closest("[data-ga-category]");if(jqCategory.length){sCategory=jqCategory.data("ga-category");}
if(!sCategory){sCategory=null;}
if(!sAction){sAction=null;}
if(!sLabel){sLabel=null;}
this.trackEvent(sCategory,sAction,sLabel);};Eventful.GoogleAnalytics.trackEvent=function(sCategory,sAction,sLabel){var aParams=["_trackEvent",sCategory,sAction,sLabel];if(!window._gaq){return;}
if(this.bLog){window["console"].log(aParams);}
window._gaq.push(aParams);};$(Eventful.GoogleAnalytics.setup.bind(Eventful.GoogleAnalytics));Eventful.Location=function(oArgs){this.oArgs=(oArgs)?oArgs:{};this.nMinInputLength=this.oArgs.minInputLength;this.oTypeAhead=new Eventful.LocationTypeAhead({id:"header-location-change",itemClass:"header-location-change-result",suggestionMode:1,forceBoldSearchTerms:1,minInputLength:this.nMinInputLength});this.oTypeAhead.eventItemSelected.subscribe(this.listenItemSelected.bind(this));this.oTypeAhead.oDropDown.eventPopoverShown.subscribe(this.listenPopoverShown.bind(this));$(this.setup.bind(this));};Eventful.Location.prototype.setup=function(){var height=$('#header-location-change').height();this.oTypeAhead.oDropDown.popover().css('top',height);this.jqRecentLocations=$('#recent-locations');this.jqRecentLocationsList=$('#recent-locations-list');this.jqRecentLocationsList.find('li .fakelink').live('click',this.listenClickRecentLocation.bind(this));this.jqO2Banner=$('#o2-banner');this.jqO2ClickTicketLinks=$('.o2-click-ticket-link').not('#event-tickets');this.jqO2ClickTicketLinksLrg=$('#event-tickets.o2-click-ticket-link');this.jqO2Banner.add(this.jqO2ClickTicketLinks).add(this.jqO2ClickTicketLinksLrg).bind('click',function(e){var targ=e.currentTarget;this.listenClickO2.call(this,targ);}.bind(this));};Eventful.Location.prototype.listenClickO2=function(){var currentSelector=$(arguments[0]),isO2Banner=currentSelector.attr('id')==='o2-banner',isClickTicketLinkLrg=currentSelector.attr('id')==='event-tickets';if(isO2Banner){Eventful.TrackPageview.trackEvent('o2','o2 Banner')}else if(isClickTicketLinkLrg){Eventful.TrackPageview.trackEvent('o2','o2 Button LRG');}else{Eventful.TrackPageview.trackEvent('o2','o2 Button');}};Eventful.Location.prototype.changeLocation=function(location_type,location_id){$.post('/json/tools/location',{location_type:location_type,location_id:location_id,input_token:"change_location",path:window.location.pathname+window.location.search},this.listenChangeLocationServerResponse.bind(this),"json");};Eventful.Location.prototype.listenItemSelected=function(oItem){this.changeLocation(oItem.location_type,oItem.location_id);};Eventful.Location.prototype.listenChangeLocationServerResponse=function(oResponse){if(oResponse.base_path){window.location=window.location.protocol+'//'+window.location.host+oResponse.base_path;}else{window.location.reload();}};Eventful.Location.prototype.listenPopoverShown=function(){if(!this.bRecentLocationsLoaded){this.bRecentLocationsLoaded=true;$.get('/json/tools/location','?'+new Date().getTime(),this.listenRecentLocationsServerResponse.bind(this),'json');}};Eventful.Location.prototype.listenRecentLocationsServerResponse=function(oResponse){var aLocations=oResponse.saved_locations||oResponse.recent_locations;var jqRecentLocationsList=$('#recent-locations-list'),jqNewItem;$.each(aLocations,function(index,oLocation){jqNewItem=$("<li/>");if(Eventful.Session&&Eventful.Session.CWL&&Eventful.Session.CWL.location_id===oLocation.location_id&&Eventful.Session.CWL.location_type===oLocation.location_type){jqNewItem.html('<span class="current">'+oLocation.pretty_name+'</span>');}else{jqNewItem.html('<span class="fakelink">'+oLocation.pretty_name+'</span>');}
jqNewItem.data('location',oLocation.location_type+'-'+oLocation.location_id).appendTo(jqRecentLocationsList);});if(Eventful.Session&&Eventful.Session.CWL&&Eventful.Session.CWL.pretty_name==="Worldwide"){$('<li><span class="current" id="location-worldwide">Worldwide</span></li>')
.appendTo(jqRecentLocationsList);}else{$('<li><span class="fakelink" id="location-worldwide">Worldwide</span></li>')
.data('location','worldwide-worldwide')
.appendTo(jqRecentLocationsList);}
this.jqRecentLocations.removeClass('loading');};Eventful.Location.prototype.listenClickRecentLocation=function(evt){var location_type_id=$(evt.target).parent('li').data('location').split('-');this.changeLocation(location_type_id[0],location_type_id[1]);};Eventful.Location.prototype.changeLocationString=function(sLocation){this.oTypeAhead.oDropDown.input().attr('alt',sLocation);Eventful.InactiveText.doForcedUpdate(this.oTypeAhead.oDropDown.input());if(this.bRecentLocationsLoaded){this.bRecentLocationsLoaded=false;this.jqRecentLocations.addClass('loading');this.jqRecentLocationsList.empty();}};Eventful.Search=function(oArgs){this.oArgs=(oArgs)?oArgs:{};this.nMinInputLength=(this.oArgs.minInputLength)?this.oArgs.minInputLength:0;var oArgs={id:'uni-search',itemClass:'uni-search-result',suggestionMode:1,options:1,minInputLength:this.nMinInputLength};this.bShowCategoryHeaders=1;this.sCurrentQuery='';this.sGoTo='';Eventful.TypeAhead.call(this,oArgs);this.eventItemSelected.subscribe(this.handleItemSelected.bind(this));this.eventNoItemSelected.subscribe(this.handleItemSelected.bind(this));this.eventOptionSelected.subscribe(this.handleItemSelected.bind(this));this.oDropDown.eventInputChanged.subscribe(this.listenInputChanged.bind(this));$(this.setupPopover.bind(this));}.mixin(Eventful.TypeAhead);Eventful.Search.prototype.setupPopover=function(){var height=$('#search').height();this.oDropDown.popover().css('top',height);};Eventful.Search.prototype.listenInputChanged=function(sInput){if(!this.oDropDown.input().hasClass('inactive')&&sInput.length>=this.nMinInputLength){this.jqContainer=this.jqContainer||$('#uni-search');this.jqContainer.addClass("loading");}
Eventful.TypeAhead.prototype.listenInputChanged.call(this,sInput);};Eventful.Search.prototype.itemTitle=function(oItem){var name=oItem.name.replace('&amp;','&').truncate(50);if(oItem.type==='movie'&&oItem.rating){name+=" ("+oItem.rating+")";}
return name;};Eventful.Search.prototype.itemDescription=function(oItem){switch(oItem.type){case'category':break;case'movie':if(oItem.coming_soon&&oItem.release_date_string){return"In theaters: "+oItem.release_date_string;}else if(oItem.coming_soon){return"Coming soon";}else{return"Now playing";}
case'performer':return oItem.short_bio.truncate(50);case'venue':return[oItem.city,oItem.region_abbr||oItem.country].join(', ').truncate(50);case'location':return("Change your location to "+oItem.name).truncate(50);case'sponsored':return oItem.venue.truncate(50);}};Eventful.Search.prototype.itemId=function(oItem){return oItem.svid||oItem.spid||oItem.location_type+"-"+oItem.location_id;};Eventful.Search.prototype.itemCategoryHeader=function(oItem){switch(oItem.type){case'category':this.sSection='category';return'Categories';case'venue':this.sSection='venue';return'Venues';case'performer':this.sSection='performer';return'Performers';case'location':this.sSection='location';return'Locations';case'movie':this.sSection='movie';return'Movies';case'sponsored':this.sSection='sponsored';return'Sponsored';}};Eventful.Search.prototype.search=function(sQuery){this.sCurrentQuery=sQuery;$.get('/json/tools/uni-search',{q:sQuery,destination_key:'results'},this.listenServerResponse.bind(this,sQuery),'json');}.slow(250);Eventful.Search.prototype.listenServerResponse=function(sQuery,oResponse){this.jqContainer.removeClass("loading");Eventful.TypeAhead.prototype.listenServerResponse.call(this,sQuery,oResponse);};Eventful.Search.prototype.renderResults=function(sQuery,aResults){Eventful.TypeAhead.prototype.renderResults.call(this,sQuery,aResults,{addCategories:1,name:'thing'});};Eventful.Search.prototype.handleItemSelected=function(oItem){if(!oItem){$('#site-search').submit();return;}
if(oItem.option&&oItem.advanced){this.doTrack('advanced');this.sGoTo=Eventful.Hosts.web+"/search?q="+this.sCurrentQuery;}else if(oItem.type==='event'||oItem.type==='performer'||oItem.type==='venue'||oItem.type==='category'||oItem.type==='movie'||oItem.type==='sponsored'){switch(oItem.type){case'venue':this.sGoTo=Eventful.Hosts.web+"/venues/"+oItem.svid;break;case'performer':this.sGoTo=Eventful.Hosts.web+"/performers/"+oItem.spid;break;case'category':this.sGoTo=Eventful.Hosts.web+"/events/categories/"+oItem.name_squish;break;case'movie':if(oItem.coming_soon){this.sGoTo=oItem.permalink+"/info";}else{this.sGoTo=oItem.permalink+"/showtimes";}
break;case'location':this.sGoTo=Eventful.Hosts.web+"/events";break;case'sponsored':this.sGoTo=oItem.permalink;break;default:return false;}
this.doTrack(oItem);var SID=oItem.seid||oItem.svid||oItem.spid||oItem.smid;if(SID){$.post('/json/tools/globalactions/add/'+SID,{type:"search-result"});}}else if(oItem.type==='location'){Eventful.Location.prototype.changeLocation(oItem.location_type,oItem.location_id);}
if(this.sGoTo){this.goToUrl.bind(this).later(100);}};Eventful.Search.prototype.goToUrl=function(){window.location.href=this.sGoTo;};Eventful.Search.prototype.doTrack=function(oItem){if(!oItem){return;}
Eventful.TrackPageview.track("/unifed_search?type="+oItem.type+"&query="+encodeURIComponent(this.sCurrentQuery));if(oItem.type==="sponsored"&&Eventful.GoogleAnalytics){Eventful.GoogleAnalytics.trackEvent("MGM","Type Ahead",oItem.placement_label);}};Eventful.Search.prototype.options=function(){return Eventful.Search.options;};Eventful.Search.options=[{name:'Advanced search',option:1,advanced:1,customClass:'advanced'}];Eventful.HeaderNav=function(){this.sSiteSection=$('body').attr('id');if(this.sSiteSection){this.sSiteSection='nav-'+this.sSiteSection;}
this.aNavClasses='nav-home nav-events nav-concerts nav-movies nav-demands nav-community nav-users nav-groups nav-my nav-show';this.jqSiteTabs=$('.site-tab');this.jqBody=$('body');this.jqSiteTabs.hover(function(evt,item){this.jqBody.removeClass(this.aNavClasses).addClass($(item).attr('id'));}.bind(this),function(evt,item){this.jqBody.removeClass(this.aNavClasses).addClass(this.sSiteSection);}.bind(this));};$(Eventful.HeaderNav);Eventful.oLocation=new Eventful.Location({minInputLength:2});Eventful.oSearch=new Eventful.Search({minInputLength:1});Eventful.PopoverChangeLocation=function(oArgs)
{Eventful.Popover.call(this,'#popover-change-location',$.extend({width:250},oArgs));this.bPost=typeof oArgs.post=='undefined'?true:oArgs.post;this.sInputToken=oArgs.token;this.eventLocationChanged=new Eventful.UIEvent();this.oValidator=new Eventful.FormVal(this.find('#location-form'));this.oValidator.addRule('location-search',{required:1,message:'Please enter a location.'});this.oValidator.eventPassValid.subscribe(this.listenLocationValidated.bind(this));this.oValidator.eventFailValid.subscribe(this.listenLocationInvalid.bind(this));if(this.popover().hasClass('guessed'))
{this.swapTopAndBottom();}
this.eventShow.subscribe(this.listenShow.bind(this));this.oLocationTypeAhead=new Eventful.LocationTypeAhead({id:'location-search',required:1,exclude:oArgs.exclude||['place_id'],length:28});this.oLocationTypeAhead.eventItemSelected.subscribe(this.changeLocation.bind(this));if(window.navigator&&navigator.geolocation)
{this.find('.geolocate')
.show()
.click(this.listenClickGeoLocate.bind(this));}}.mixin(Eventful.Popover);Eventful.PopoverChangeLocation.prototype.updateLocations=function(aLocales,oCurrentLocale)
{this.find('#location-form').removeClass('loading');this.find('#location-search').val('');this.find('#location-form').removeClass('has-error');this.find('#location-form').removeClass('show-errors');if(aLocales&&oCurrentLocale)
{this.aLocales=aLocales;var bFoundCurrent=false;if(this.sInputToken!='demand_flow'&&oCurrentLocale.pretty_name!='Worldwide')
{aLocales.push({pretty_name:'Worldwide',location_type:'worldwide',location_id:'worldwide'});}
this.find('#locations-list').empty();$.each(aLocales,function(_,oLocale)
{if(oLocale.location_type==oCurrentLocale.location_type&&oLocale.location_id==oCurrentLocale.location_id)
{oLocale.current=true;bFoundCurrent=true;}else
{oLocale.current=false;}
this.addLocationItem(oLocale);}.bind(this));if(!bFoundCurrent)
{oCurrentLocale.current=true;this.addLocationItem(oCurrentLocale);if(oCurrentLocale.pretty_name!='Worldwide')
{this.aLocales.push(oCurrentLocale);}}}
if(this.popover().hasClass('guessed')&&!oCurrentLocale.geo_ip_guess)
{this.popover().removeClass('guessed');this.swapTopAndBottom();}}
Eventful.PopoverChangeLocation.prototype.swapTopAndBottom=function()
{var elBody=this.find('.popbd:first')
elBody.children(':first').remove().appendTo(elBody);}
Eventful.PopoverChangeLocation.prototype.addLocationItem=function(oLocale)
{var elItem=$('\
    <li>\
      <span class="link-arrow">\
        <span class="title">\
          '+oLocale.pretty_name+'\
          <span class="progress"></span>\
        </span>\
      </span>\
    </li>\
  ').appendTo(this.find('#locations-list'));if(oLocale.current)
{elItem.addClass('current');}else
{elItem.find('.title')
.addClass('fakelink')
.click(this.listenLocationClick.bind(this,elItem,oLocale));}
if(oLocale.pretty_name=='Worldwide')
{elItem.find('.title').attr({id:'location-worldwide'});}}
Eventful.PopoverChangeLocation.prototype.changeLocation=function(oLocale,bFire)
{if(this.bPost)
{this.bLoading=true;$.post('/json/tools/location',{location_type:oLocale.location_type,location_id:oLocale.location_id,input_token:this.sInputToken,path:window.location.pathname+window.location.search},this.listenChangeLocationServerResponse.bind(this,oLocale,bFire),'json');}else
{this.updateLocations(this.aLocales,oLocale);this.eventLocationChanged.fire({locale:oLocale});}}
Eventful.PopoverChangeLocation.prototype.listenShow=function()
{this.show();this.oLocationTypeAhead.oDropDown.input().focus();if(!this.bLoaded&&!this.bLoading)
{$.get('/json/tools/location','?'+new Date().getTime(),this.listenGetLocationsServerResponse.bind(this),'json');}}
Eventful.PopoverChangeLocation.prototype.listenClickGeoLocate=function()
{navigator.geolocation.getCurrentPosition(this.listenGeoLocate.bind(this));}
Eventful.PopoverChangeLocation.prototype.listenGeoLocate=function(oPosition)
{if(oPosition&&oPosition.coords){$.getJSON('/json/tools/location/latlong',{latitude:oPosition.coords.latitude,longitude:oPosition.coords.longitude},function(oResponse)
{if(oResponse.location)
{this.changeLocation(oResponse.location);}}.bind(this))}}
Eventful.PopoverChangeLocation.prototype.listenChangeLocationServerResponse=function(oLocale,bFire,oResponse)
{this.bLoaded=true;this.bLoading=false;var aLocales=oResponse.saved_locations||oResponse.recent_locations;this.updateLocations(aLocales,oLocale);this.close();if(bFire||typeof bFire=='undefined')
{this.eventLocationChanged.fire({locale:oLocale,response:oResponse});}}
Eventful.PopoverChangeLocation.prototype.listenGetLocationsServerResponse=function(oResponse)
{this.bLoaded=true;var aLocales=oResponse.saved_locations||oResponse.recent_locations;var oCurrentLocale=oResponse.current;this.updateLocations(aLocales,oCurrentLocale);this.show();}
Eventful.PopoverChangeLocation.prototype.listenLocationClick=function(elItem,oLocale)
{if(!this.bLoading)
{elItem.addClass('loading');this.changeLocation(oLocale);}}
Eventful.PopoverChangeLocation.prototype.listenLocationValidated=function()
{this.oValidator.initialize();var oLocale=this.oLocationTypeAhead.item();if(oLocale)
{this.changeLocation(oLocale);}}
Eventful.PopoverChangeLocation.prototype.listenLocationInvalid=function()
{this.find('#location-form').removeClass('loading');}
Eventful.UsersDetail=function()
{$(this.setup.bind(this));}
Eventful.UsersDetail.prototype.setup=function(){if(!Eventful.Session.userName){$('#open-comment-post-popover, #talk-to-me-popover, button.add-friend').click(function(){window.location=Eventful.Hosts.web+'/signin?goto='+escape(window.location.href);});return;}
this.jqOpenPopover=$('#open-comment-post-popover');this.jqLoadCommentList=$("#reload-list-comment");this.popover=(new Eventful.Popover('#comment-post-popover',{width:"270px",position:{relative:"sender",top:20,left:'auto',right:0},bToggleClick:false}))
.clickShow(this.jqOpenPopover)
.clickClose('#btn-comment-post-cancel');this.bIsLoading=false;$("#comment-post-form").submit(this.onSubmitAddComment.bind(this));this.jqLoadCommentList.click(this.onClickCommentList.bind(this));}
Eventful.UsersDetail.prototype.onSubmitAddComment=function(evt){evt.preventDefault();elForm=evt.target;if(this.bIsLoading)return;this.bIsLoading=true;var jqForm=$(elForm);jqForm.find('.progress').addClass('loading');$.post(jqForm.attr('action'),jqForm.serializeArray(),this.onServerResponseAddComment.bind(this,jqForm),'html');}
Eventful.UsersDetail.prototype.onServerResponseAddComment=function(jqForm,R){this.bIsLoading=false;this.refreshCommentList(R);var jqNewComment=this.jqLoadCommentList.find('.comment-box.firstloop');h=jqNewComment.height();jqNewComment.css({"opacity":0.1,"height":"1px"});this.popover.close();jqNewComment.animate({"opacity":1.0,"height":h+"px"},"slow");jqForm
.find('.progress')
.removeClass('loading')
.end()
[0].reset();}
Eventful.UsersDetail.prototype.onClickCommentList=function(evt){var jqLink=$(evt.target);if(jqLink.hasClass("link-delete-comment")){evt.preventDefault();if(this.bIsLoading)return;this.bIsLoading=true;jqLink.parent().addClass('loading');$.get(jqLink.prevAll('.delete-link').text(),{is_detail:1,page_list:1},this.onServerResponseDeleteComment.bind(this,jqLink),"html");}else if(jqLink.hasClass("talk-to-me-popover")){evt.stopPropagation();this.jqOpenPopover.trigger('click');}}
Eventful.UsersDetail.prototype.onServerResponseDeleteComment=function(jqLink){this.bIsLoading=false;jqLink
.parents('.comment-box')
.animate({opacity:0.1,height:"1px"},"slow","linear",function(el){this.refreshCommentList(el);}.bind(this));}
Eventful.UsersDetail.prototype.refreshCommentList=function(R){if(/^\s*<div(.|\s)+<\/div>\s*$/i.test(R)){this.jqLoadCommentList.html(R)}else{window.location.reload(true);}}
new Eventful.UsersDetail();
