(function($){$.fn.carousel=function(o){o=$.extend({btnPrev:null,btnNext:null,speed:300,easing:null,ajaxCallback:null,visible:3,listOffset:0,scroll:1},o||{});return this.each(function(){var container=$(this).parent(".carousel_container"),div=$(this),ul=$("ul",div),li=$("li",ul),liSize=li.size(),liWidth=li.first().outerWidth(true),liHeight=li.outerHeight(),lastScroll=Math.floor(liSize/o.visible),visible=o.visible,viewportWidth=o.visible*liWidth,endPos=-((liSize*liWidth)-viewportWidth),overflowLength=(liSize*liWidth)-(liSize%visible),leftPos=0,current=0,isOverflowMode=false;div.css({width:liWidth*o.visible,overflow:"hidden",position:"relative"});ul.css({position:"relative",left:0,width:(liWidth*liSize)+o.listOffset,overflow:"hidden"});if(ul.height()>=liHeight*2){ul.css({width:(liWidth*liSize)+liWidth})}$(o.btnPrev,container).addClass("disabled");if($("[originalsrc]",ul).length>0){lazyImg($("[originalsrc]:lt("+visible+")",ul))}if(o.btnPrev){$(o.btnPrev,container).click(function(){if(current==0){return}var pos=leftPos+viewportWidth;current=current-1;if(current==0&&isOverflowMode){pos=0;isOverflowMode=false}return scrollTo(pos)})}if(o.btnNext){$(o.btnNext,container).removeClass("disabled");$(o.btnNext,container).bind("click",{endPos:endPos},function(e){var restart=false;var pos=leftPos-viewportWidth;current=current+1;if(o.ajaxCallback!==null){o.ajaxCallback(e.target,current,liSize,o.visible,container,function(){sizeChanged();if(current>=lastScroll){if(overflowLength>0&&leftPos!=endPos){pos=endPos;isOverflowMode=true}else{current=0;pos=0;ul.animate({opacity:0.5},100);ul.css({"margin-left":0,left:0});restart=true}}scrollTo(pos,e.data.endPos,restart)})}else{if(current>=lastScroll){if(overflowLength>0&&leftPos!=endPos){pos=endPos;isOverflowMode=true}else{current=0;pos=0;ul.animate({opacity:0.5},100);restart=true}}scrollTo(pos,e.data.endPos,restart)}})}var scrollTo=function(pos,endPos,restart){ul.animate({left:pos},restart?o.speed*2:o.speed,o.easing||null,function(){ul.animate({opacity:1},100);isScrolling=false});leftPos=pos;if(current>0){$(o.btnPrev,container).removeClass("disabled")}else{$(o.btnPrev,container).addClass("disabled")}if($("[originalsrc]",ul).length>0){lazyImg($("[originalsrc]:lt("+visible+")",ul))}};var sizeChanged=function(){liSize=$("li",ul).size();lastScroll=Math.floor(liSize/o.visible);endPos=-((liSize*liWidth)-viewportWidth);overflowLength=(liSize*liWidth)-(liSize%visible);div.css({width:liWidth*o.visible,overflow:"hidden",position:"relative"});ul.css({position:"relative",width:(liWidth*liSize)+o.listOffset,overflow:"hidden"});if(ul.height()>=liHeight*2){ul.css({width:(liWidth*liSize)+liWidth})}}})};var lazyImg=function(elements){elements.each(function(){$(this).css("background-image","url("+$(this).attr("originalsrc")+")");$(this).removeAttr("originalsrc")})}})(jQuery);(function($){var $window=$(window);$.fn.lazyImg=function(options){var didScroll=false,elements=this,loadQueue=[],queueActive=false;var options=$.extend({threshold:100,effect:"show",effectspeed:0,scrollElm:$window,throttleQueue:null},options||{});var loadFromQueue=function(){if(loadQueue.length==0){queueActive=false;return}queueActive=true;var chunk=loadQueue.splice(0,options.throttleQueue),lastImg=chunk[chunk.length-1];lastImg.bind("complete",loadFromQueue);$.each(chunk,function(){if(this){$(this).trigger("appear")}})};var handleScroll=function(){elements.each(function(){var self=$(this);if(!isBelowFold(self,options)){if(options.throttleQueue&&!self.data("queued")){loadQueue.push(self);self.data("queued",true)}else{self.trigger("appear")}}});if(!queueActive&&options.throttleQueue){loadFromQueue()}};var handler_scroll=null;options.scrollElm.bind("scroll",function(){didScroll=true;if(handler_scroll){clearTimeout(handler_scroll)}handler_scroll=setTimeout(function(){handler_scroll=null;didScroll=false},333)});setInterval(function(){if(didScroll){didScroll=false;handleScroll()}},400);var queue=[];var queue_max=8;var queue_running=0;var handler_queueticking=null;var prime_tickqueue=13;var prime_finishqueue=647;var pushQueue=function(f){if(typeof(f)!=="function"){return false}queue[queue.length]=f;tickQueue()};var tickQueue=function(){if(handler_queueticking){clearTimeout(handler_queueticking);handler_queueticking=null}if(queue.length>0&&queue_running<queue_max){doQueue();setTimeout(tickQueue,prime_tickqueue)}};var doQueue=function(){++queue_running;(queue.splice(0,1))[0]()};var finishQueue=function(){if(queue_running>0){--queue_running}handler_queueticking=setTimeout(tickQueue,prime_finishqueue)};var genOnImgAppear=function(self){var $self=$(self),src=$self.data("src"),myfunc=function(){$("<img />").bind("load",function(){if(options.background){$self.hide().css("background-image",["url(",src,")"].join(""))[options.effect](options.effectspeed)}else{$self.hide().attr("src",src)[options.effect](options.effectspeed)}$self.data("loaded",true);$.grep(elements,function(item){return !$(item).data("loaded")});$self.trigger("complete");finishQueue()}).attr("src",src)};return function(){pushQueue(myfunc)}};return elements.each(function(){var self=$(this);self.one("appear",genOnImgAppear(this));if(!isBelowFold(self,options)){self.trigger("appear")}else{self.data("loaded",false)}})};var isBelowFold=function(element,options){var fold=options.scrollElm.scrollTop()+options.scrollElm.height(),imgPos=element.offset().top;return imgPos>=(fold+options.threshold)||false}})(jQuery);var callout={defaults:{my:"left top",at:"left top",offset:"-259 -27",collision:"none",side:"left"},dom:'<div class="rsvp-box jsStartHidden"><div class="tail"><div class="tailInner"></div></div><div class="rsvp-container" id="rsvp-container"></div></div>',$elm:null,currentSide:null,init:function(options,element){var $element=$(element);$.extend(this.defaults,options||{});this.$elm=$(this.dom).appendTo($element);return this},getCallout:function(){return this.$elm},position:function(elm,pos){var opts=pos||this.defaults;this.$elm.position({of:$(elm),my:opts.my,at:opts.at,offset:opts.offset,collision:opts.collision})},setPointerSide:function(side){if(this.currentSide){this.$elm.removeClass(this.currentSide)}this.$elm.addClass(side);this.currentSide=side},show:function(){this.$elm.removeClass("jsStartHidden")},hide:function(){this.$elm.addClass("jsStartHidden")}};(function($){var Mustache=function(){var Renderer=function(){};Renderer.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(template,context,partials,in_recursion){if(!in_recursion){this.context=context;this.buffer=[]}if(!this.includes("",template)){if(in_recursion){return template}else{this.send(template);return}}template=this.render_pragmas(template);var html=this.render_section(template,context,partials);if(in_recursion){return this.render_tags(html,context,partials,in_recursion)}this.render_tags(html,context,partials,in_recursion)},send:function(line){if(line!=""){this.buffer.push(line)}},render_pragmas:function(template){if(!this.includes("%",template)){return template}var that=this;var regex=new RegExp(this.otag+"%([\\w-]+) ?([\\w]+=[\\w]+)?"+this.ctag);return template.replace(regex,function(match,pragma,options){if(!that.pragmas_implemented[pragma]){throw ({message:"This implementation of mustache doesn't understand the '"+pragma+"' pragma"})}that.pragmas[pragma]={};if(options){var opts=options.split("=");that.pragmas[pragma][opts[0]]=opts[1]}return""})},render_partial:function(name,context,partials){name=this.trim(name);if(!partials||partials[name]===undefined){throw ({message:"unknown_partial '"+name+"'"})}if(typeof(context[name])!="object"){return this.render(partials[name],context,partials,true)}return this.render(partials[name],context[name],partials,true)},render_section:function(template,context,partials){if(!this.includes("#",template)&&!this.includes("^",template)){return template}var that=this;var regex=new RegExp(this.otag+"(\\^|\\#)\\s*(.+)\\s*"+this.ctag+"\n*([\\s\\S]+?)"+this.otag+"\\/\\s*\\2\\s*"+this.ctag+"\\s*","mg");return template.replace(regex,function(match,type,name,content){var value=that.find(name,context);if(type=="^"){if(!value||that.is_array(value)&&value.length===0){return that.render(content,context,partials,true)}else{return""}}else{if(type=="#"){if(that.is_array(value)){return that.map(value,function(row){return that.render(content,that.create_context(row),partials,true)}).join("")}else{if(that.is_object(value)){return that.render(content,that.create_context(value),partials,true)}else{if(typeof value==="function"){return value.call(context,content,function(text){return that.render(text,context,partials,true)})}else{if(value){return that.render(content,context,partials,true)}else{return""}}}}}}})},render_tags:function(template,context,partials,in_recursion){var that=this;var new_regex=function(){return new RegExp(that.otag+"(=|!|>|\\{|%)?([^\\/#\\^]+?)\\1?"+that.ctag+"+","g")};var regex=new_regex();var tag_replace_callback=function(match,operator,name){switch(operator){case"!":return"";case"=":that.set_delimiters(name);regex=new_regex();return"";case">":return that.render_partial(name,context,partials);case"{":return that.find(name,context);default:return that.escape(that.find(name,context))}};var lines=template.split("\n");for(var i=0;i<lines.length;i++){lines[i]=lines[i].replace(regex,tag_replace_callback,this);if(!in_recursion){this.send(lines[i])}}if(in_recursion){return lines.join("\n")}},set_delimiters:function(delimiters){var dels=delimiters.split(" ");this.otag=this.escape_regex(dels[0]);this.ctag=this.escape_regex(dels[1])},escape_regex:function(text){if(!arguments.callee.sRE){var specials=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];arguments.callee.sRE=new RegExp("(\\"+specials.join("|\\")+")","g")}return text.replace(arguments.callee.sRE,"\\$1")},find:function(name,context){name=this.trim(name);function is_kinda_truthy(bool){return bool===false||bool===0||bool}var value;if(is_kinda_truthy(context[name])){value=context[name]}else{if(is_kinda_truthy(this.context[name])){value=this.context[name]}}if(typeof value==="function"){return value.apply(context)}if(value!==undefined){return value}return""},includes:function(needle,haystack){return haystack.indexOf(this.otag+needle)!=-1},escape:function(s){s=String(s===null?"":s);return s.replace(/&(?!\w+;)|["'<>\\]/g,function(s){switch(s){case"&":return"&amp;";case"\\":return"\\\\";case'"':return"&quot;";case"'":return"&#39;";case"<":return"&lt;";case">":return"&gt;";default:return s}})},create_context:function(_context){if(this.is_object(_context)){return _context}else{var iterator=".";if(this.pragmas["IMPLICIT-ITERATOR"]){iterator=this.pragmas["IMPLICIT-ITERATOR"].iterator}var ctx={};ctx[iterator]=_context;return ctx}},is_object:function(a){return a&&typeof a=="object"},is_array:function(a){return Object.prototype.toString.call(a)==="[object Array]"},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},map:function(array,fn){if(typeof array.map=="function"){return array.map(fn)}else{var r=[];var l=array.length;for(var i=0;i<l;i++){r.push(fn(array[i]))}return r}}};return({name:"mustache.js",version:"0.3.1-dev",to_html:function(template,view,partials,send_fun){var renderer=new Renderer();if(send_fun){renderer.send=send_fun}renderer.render(template,view,partials);if(!send_fun){return renderer.buffer.join("\n")}}})}();$.mustache=function(template,view,partials){return Mustache.to_html(template,view,partials)}})(jQuery);(function($){$.fn.emailSignUp=function(){var obj=$(this);obj.click(function(event){event.preventDefault();var href=obj.attr("href");$.ajax({url:href,context:document.body,success:function(){var isOptIn=/arg_setting=true/.test(href);if(isOptIn){obj.html(Meetup.Copy.weeklyCalendarOptOut);obj.attr("href",href.replace("arg_setting=true","arg_setting=false"));obj.removeClass("email_add_icon").addClass("email_delete_icon")}else{obj.html(Meetup.Copy.weeklyCalendarOptIn);obj.attr("href",href.replace("arg_setting=false","arg_setting=true"));obj.removeClass("email_delete_icon").addClass("email_add_icon")}var msg=Meetup.Bubble(isOptIn?Meetup.Copy.weeklyCalendarOptInSuccess:Meetup.Copy.weeklyCalendarOptOutSuccess,true);msg.show(obj);setTimeout(function(){msg.hide()},3000)}})});return this};if(Meetup.Data.isLoggedIn){$(".weeklyCalendarEmail").emailSignUp()}$(document).ready(function(){$(".carousel_list").carousel({btnNext:".carousel_next",btnPrev:".carousel_prev",visible:4,speed:400,easing:"swing",scroll:4});var $group=$(".search-facepile-wrap");if($group){$group.each(function(){Meetup.MemberInfoWidget($(this),{isNotGrouphome:true,my:"left top",at:"right top",offset:"-2 -30",position:"left",trackingCode:"sj51a"})})}var $rsvp=$(".D_secondary");if($rsvp.length){$rsvp.each(function(){Meetup.MemberInfoWidget($(this),{isNotGrouphome:true,position:"right",my:"right top",at:"left top",offset:"2 -27",trackingCode:"sj51a"})})}})})(jQuery);
