
$(document).ready(function(){var leftoffset=0;var imagewidth=160;var averageimagewidth=0;var maskwidth=$("div#scroller-holder").width();var imageholderwidth=0;var numimages=$("div#scroller-stage img").length;var scrollamount=maskwidth/2;var scrollspeed=1000;$("div#scroller-stage img:last").load(function(){getimagewidth();});$("div#eventsleftarrow").click(function(){if(averageimagewidth==0){$("div#scroller-stage").css("width",(getimagewidth()));}
var scrollerLeft=parseInt($("div#scroller-stage").css("left"));if(-scrollamount>=scrollerLeft){$("div#scroller-stage").animate({left:(scrollerLeft+scrollamount)},scrollspeed,"");}else{$("div#scroller-stage").animate({left:('0')},scrollspeed,"");}});$("div#eventsrightarrow").click(function(){if(averageimagewidth==0){$("div#scroller-stage").css("width",(getimagewidth()));}
var scrollerLeft=parseInt($("div#scroller-stage").css("left"));if((scrollerLeft-scrollamount)>maskwidth-imageholderwidth){$("div#scroller-stage").animate({left:(scrollerLeft-scrollamount)},scrollspeed,"");}else{$("div#scroller-stage").animate({left:maskwidth-imageholderwidth},scrollspeed,"");}});function getimagewidth(){var i=0;$("div#scroller-stage img").each(function(){imageholderwidth+=($(this).width());$("div#events-article-"+i).width=$(this).width();$("div#events-article-"+i+" events_article_text").width=$(this).width();i++;});averageimagewidth=imageholderwidth/(numimages/2);$("div#scroller-stage").css("width",(imageholderwidth));$("div#scroller-stage").css("left",(leftoffset));}});