jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}});
(function($){var opts;$.fn.lightbox=function(options){opts=$.extend({},$.fn.lightbox.defaults,options);$.fn.lightbox.initialize();return this.each(function(){$(this).bind('click.lightbox',function(e){return false;});$(this).bind('mouseup.lightbox',function(e){if(!dragging){delayLoading=true;$(this).lightbox.start(this);}
return true;});});};$.fn.lightbox.initialize=function(){$('#overlay').remove();$('#lightbox').remove();opts.inprogress=false;var string='<div id="overlay"></div><div id="lightbox"><div id="tools"><a id="download">download image</a></div><div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage" /><div id="hoverNav"><a href="javascript://" title="'+opts.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript://" id="nextLink" title="'+opts.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><img src="'+opts.fileLoadingImage+'"></a></div></div></div></div>';$("body").append(string);$("#overlay").click(function(){$.fn.lightbox.end();}).hide();$("#lightbox").click(function(){$.fn.lightbox.end();}).hide();$("#loadingLink").click(function(){$.fn.lightbox.end();return false;});$("#bottomNavClose").click(function(){$.fn.lightbox.end();return false;});$('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);$('#imageDataContainer').width(opts.widthCurrent);};$.fn.lightbox.getPageSize=function(){var jqueryPageSize=new Array($(document).width(),$(document).height(),$(window).width(),$(window).height());return jqueryPageSize;};$.fn.lightbox.getPageScroll=function(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
var arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};$.fn.lightbox.start=function(imageLink){opts.justOpened=true;$("select, embed, object").hide();var arrayPageSize=$.fn.lightbox.getPageSize();$("#overlay").hide().css({width:'100%',height:arrayPageSize[1]+'px',opacity:opts.overlayOpacity}).fadeIn();opts.imageArray=[];imageNum=0;var anchors=document.getElementsByTagName(imageLink.tagName);if(!imageLink.rel||(imageLink.rel=='')){opts.imageArray.push(new Array(imageLink.href,opts.displayTitle?imageLink.title:'',imageLink.id));}else{if(opts.imageStripMode){$(imageLink.parentNode).children().each(function(){opts.imageArray.push(new Array(this.href,opts.displayTitle?this.title:'',this.id));})}else{$("a").each(function(){if(this.href&&(this.rel==imageLink.rel)){opts.imageArray.push(new Array(this.href,opts.displayTitle?this.title:''));}})}
for(i=0;i<opts.imageArray.length;i++){for(j=opts.imageArray.length-1;j>i;j--){if(opts.imageArray[i][0]==opts.imageArray[j][0]){opts.imageArray.splice(j,1);}}}
while(opts.imageArray[imageNum][0]!=imageLink.href){imageNum++;}}
var arrayPageScroll=$.fn.lightbox.getPageScroll();var lightboxTop=arrayPageScroll[1];var lightboxLeft=arrayPageScroll[0];$('#lightbox').css({top:lightboxTop+'px',left:lightboxLeft+'px'}).show();if(!opts.slideNavBar)
$('#imageData').hide();$.fn.lightbox.changeImage(imageNum);};$.fn.lightbox.changeImage=function(imageNum){if(opts.inprogress==false){opts.inprogress=true;opts.activeImage=imageNum;if(opts.imageStripMode){var scroller=$('#'+opts.imageArray[imageNum][2]).parent()
var container=$('#'+opts.imageArray[imageNum][2]).parent().parent();var picture=$('#'+opts.imageArray[imageNum][2]);if(!opts.justOpened){var newLeft=picture.position().left*-1+(Math.floor(container.width()/2-picture.width()/2));if(newLeft<0&&newLeft>scroller.width()*-1+container.width()){scroller.animate({left:newLeft+'px'},300);}else if(newLeft<0){scroller.animate({left:(scroller.width()*-1+container.width())+'px'},300);}else{scroller.animate({left:'0px'},300);}}}
$('#loading').show();$('#lightboxImage').hide()
$('#hoverNav').hide();$('#prevLink').hide();$('#nextLink').hide();if(opts.slideNavBar){$('#imageDataContainer').hide();$('#imageData').hide();$.fn.doChangeImage();}else{$.fn.doChangeImage();}}};$.fn.doChangeImage=function(){imgPreloader=new Image();imgPreloader.onload=function(){var newWidth=imgPreloader.width;var newHeight=imgPreloader.height;if(opts.fitToScreen){var arrayPageSize=$.fn.lightbox.getPageSize();var ratio;var initialPageWidth=arrayPageSize[2]-2*opts.borderSize-300;var initialPageHeight=arrayPageSize[3]-100;var dI=initialPageWidth/initialPageHeight;var dP=imgPreloader.width/imgPreloader.height;if((imgPreloader.height>initialPageHeight)||(imgPreloader.width>initialPageWidth)){if(dI>dP){newWidth=parseInt((initialPageHeight/imgPreloader.height)*imgPreloader.width);newHeight=initialPageHeight;}else{newHeight=parseInt((initialPageWidth/imgPreloader.width)*imgPreloader.height);newWidth=initialPageWidth;}}}
var matches=opts.imageArray[opts.activeImage][0].split('/');$("#tools #download").attr('href','DownloadImage.ashx?date='+matches[matches.length-2]+'&image='+matches[matches.length-1]);$('#lightboxImage').attr('src',opts.imageArray[opts.activeImage][0]).width(newWidth).height(newHeight);$.fn.lightbox.resizeImageContainer(newWidth,newHeight);opts.justOpened=false;}
imgPreloader.src=opts.imageArray[opts.activeImage][0];}
$.fn.lightbox.end=function(){$.fn.lightbox.disableKeyboardNav();$('#lightbox').hide();$('#overlay').fadeOut();$('select, object, embed').show();};$.fn.lightbox.preloadNeighborImages=function(){if((opts.imageArray.length-1)>opts.activeImage){preloadNextImage=new Image();preloadNextImage.src=opts.imageArray[opts.activeImage+1][0];}
if(opts.activeImage>0){preloadPrevImage=new Image();preloadPrevImage.src=opts.imageArray[opts.activeImage-1][0];}};$.fn.lightbox.resizeImageContainer=function(imgWidth,imgHeight){opts.widthCurrent=document.getElementById('outerImageContainer').offsetWidth;opts.heightCurrent=document.getElementById('outerImageContainer').offsetHeight;var widthNew=(imgWidth+(opts.borderSize*2));var heightNew=(imgHeight+(opts.borderSize*2));opts.xScale=(widthNew/opts.widthCurrent)*100;opts.yScale=(heightNew/opts.heightCurrent)*100;var wDiff=opts.widthCurrent-widthNew;var hDiff=opts.heightCurrent-heightNew;var props={width:widthNew,height:heightNew,top:Math.floor(($(window).height()-50-heightNew)/2.4-15)}
$('#imageDataContainer').animate({width:widthNew},opts.resizeSpeed,'linear');if((hDiff!=0)||(wDiff!=0)){$('#outerImageContainer').animate(props,{duration:opts.resizeSpeed,easing:'linear',queue:false,complete:function(){$.fn.lightbox.showImage();}});}else{$.fn.lightbox.showImage();}
$('#prevLink').height(imgHeight);$('#nextLink').height(imgHeight);};$.fn.lightbox.showImage=function(){$('#loading').hide();$('#lightboxImage').fadeIn(200);$.fn.lightbox.updateDetails();$.fn.lightbox.preloadNeighborImages();opts.inprogress=false;};$.fn.lightbox.updateDetails=function(){if(opts.imageArray[opts.activeImage][1]){$('#caption').html(opts.imageArray[opts.activeImage][1]).show();}
if(opts.imageArray.length>1){var nav_html;nav_html=opts.strings.image+(opts.activeImage+1)+opts.strings.of+opts.imageArray.length;$('#numberDisplay').html(nav_html).show();}
if(opts.slideNavBar){$("#imageData").slideDown(opts.navBarSlideSpeed);}else{$("#imageData").show();}
var arrayPageSize=$.fn.lightbox.getPageSize();$('#overlay').height(arrayPageSize[1]);$.fn.lightbox.updateNav();};$.fn.lightbox.updateNav=function(){$('#hoverNav').show();$('#prevLink,#prevLinkText,#nextLink,#nextLinkText').unbind('click');if(opts.activeImage!=0){$('#prevLink,#prevLinkText').show().click(function(){$.fn.lightbox.changeImage(opts.activeImage-1);return false;});}
if(opts.activeImage!=(opts.imageArray.length-1)){$('#nextLink,#nextLinkText').show().click(function(){$.fn.lightbox.changeImage(opts.activeImage+1);return false;});}
$.fn.lightbox.enableKeyboardNav();};function keyboardAction(e){var o=e.data.opts
var keycode=e.keyCode;var escapeKey=27;var key=String.fromCharCode(keycode).toLowerCase();if((key=='x')||(key=='o')||(key=='c')||(keycode==escapeKey)){end();}else if((key=='p')||(keycode==37)){if(o.loopImages){$.fn.lightbox.disableKeyboardNav();$.fn.lightbox.changeImage((o.activeImage==0)?(o.imageArray.length-1):o.activeImage-1);}
else if(o.activeImage!=0){$.fn.lightbox.disableKeyboardNav();$.fn.lightbox.changeImage(o.activeImage-1);}}else if((key=='n')||(keycode==39)){if(opts.loopImages){$.fn.lightbox.disableKeyboardNav();$.fn.lightbox.changeImage((o.activeImage==(o.imageArray.length-1))?0:o.activeImage+1);}
else if(o.activeImage!=(o.imageArray.length-1)){$.fn.lightbox.disableKeyboardNav();$.fn.lightbox.changeImage(o.activeImage+1);}}};$.fn.lightbox.enableKeyboardNav=function(){$(document).bind('keydown',{opts:opts},keyboardAction);};$.fn.lightbox.disableKeyboardNav=function(){$(document).unbind('keydown');};$.fn.lightbox.defaults={fileLoadingImage:'/Images/LightBox/loading.gif',fileBottomNavCloseImage:'/Images/LightBox/closelabel.gif',overlayOpacity:0.9,borderSize:0,imageArray:new Array,activeImage:null,inprogress:false,resizeSpeed:100,widthCurrent:250,heightCurrent:250,topCurrent:25,xScale:1,yScale:1,displayTitle:true,navbarOnTop:false,slideNavBar:false,navBarSlideSpeed:350,displayHelp:false,strings:{help:' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery',prevLinkTitle:'previous image',nextLinkTitle:'next image',prevLinkText:'&laquo; Previous',nextLinkText:'Next &raquo;',closeTitle:'close image gallery',image:'Image ',of:' of '},fitToScreen:true,justOpened:true,imageStripMode:true};})(jQuery);
function Queue(){var _1=[];var _2=0;this.getSize=function(){return _1.length-_2;};this.isEmpty=function(){return(_1.length==0);};this.enqueue=function(_3){_1.push(_3);};this.dequeue=function(){var _4=undefined;if(_1.length){_4=_1[_2];if(++_2*2>=_1.length){_1=_1.slice(_2);_2=0;}}return _4;};this.getOldestElement=function(){var _5=undefined;if(_1.length){_5=_1[_2];}return _5;};}
function point(){this.x=0;this.y=0;this.clone=function(){var clone=new point();clone.x=this.x;clone.y=this.y;return clone;}
this.toString=function(){return'x='+this.x+'; y='+this.y;}}
var dragging=false;var intervalId=0;var lastPosition=new point();var realtimePosition=new point();var samplingRate=5;var mdT=null;var muT=null;function startDrag(e,ui){$(e.helper).data('suspendEvents',true);dragging=true;realtimePosition.x=e.pageX;realtimePosition.y=e.pageY;mdT=new Date().getTime();}
function stopDrag(e,ui){muT=new Date().getTime();dragging=false;lastPosition.x=e.pageX;lastPosition.y=e.pageY;var distance=distanceBetweenPoints(realtimePosition,lastPosition);var direction=draggingDirection(realtimePosition,lastPosition);samplingRate=muT-mdT;if(distance>80){rollOut($(e.target),distance/samplingRate,direction);}
$(ui.helper).data('suspendEvents',false);}
function rollOut(element,speed,direction){var amount=Math.floor(Math.pow(speed,5));if(direction=='left'){if(parseInt(element.css('left'))-amount<(element[0].offsetWidth*-1)+element.parent()[0].offsetWidth){element.animate({left:(element[0].offsetWidth*-1+element.parent()[0].offsetWidth)+'px'},300,'easeOutQuad');}else{element.animate({left:'-='+amount+'px'},300,'easeOutQuad');}}else if(direction=='right'){if(parseInt(element.css('left'))+amount>0){element.animate({left:'0px'},300,'easeOutQuad');}else{element.animate({left:'+='+amount+'px'},300,'easeOutQuad');}}}
function distanceBetweenPoints(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2));}
function draggingDirection(reference,target){normalisedX=target.x-reference.x;normalisedY=target.y-reference.y;if(normalisedX>0){return'right';}else if(normalisedX<0){return'left';}}
$.ajaxSetup({cache:false});var ajaxUrl='AjaxHandler.ashx';var connManager=null;var stripeWidth=3;var currentMode=null;$(document).ready(function(){connManager=new ConnectionManager();currentMode=$('body').attr('class');$("div.isExpandable, div.hasFlyer").click(toggleEvent);$("div.isExpandable, div.hasFlyer").bind('mouseover',function(){$(this).css('cursor','pointer');});$("div.isExpandable, div.hasFlyer").bind('mouseout',function(){$(this).css('cursor','auto');});$(".flyer a").lightbox();initializeThumbStrips();updateMonthNavigation();$("#prevMonth").click(function(){var year=parseInt(currentMonth.toString().substr(0,4),10);var month=parseInt(currentMonth.toString().substr(4,2),10);month--;if(month==0){year--;month=12;}
changeMonth(year.toString()+zeroPad(month,2));});$("#nextMonth").click(function(){var year=parseInt(currentMonth.toString().substr(0,4),10);var month=parseInt(currentMonth.toString().substr(4,2),10);month++;if(month==13){year++;month=1;}
changeMonth(year.toString()+zeroPad(month,2));});$("#ajaxLoading").bind('ajaxSend',function(){$(this).fadeIn();}).bind('ajaxComplete',function(){$(this).fadeOut();});});function initializeThumbStrips(){calculateThumbstripWidths();$(".images a").lightbox();$(".scrollLeft").hover(scrollThumbStripLeft,stopScrollThumbstrip);$(".scrollRight").hover(scrollThumbStripRight,stopScrollThumbstrip);$(".images .draggableHelper").draggable({axis:'x',delay:0,containment:'self',start:startDrag,stop:stopDrag});loadThumbnails();}
function loadThumbnails(){var queue=new Queue();var preBuffer=[];var maxBufferWidth=0;$(".images").each(function(index,element){var date=element.id;var stripeCount=Math.ceil($(element).find(".draggableHelper").children().length/stripeWidth);if(stripeCount>maxBufferWidth)maxBufferWidth=stripeCount;var buffer=[];for(i=0;i<stripeCount;i++){buffer[i]={date:date,stripeIndex:i};}
preBuffer[index]=buffer;});var chunkSize=Math.ceil($(".images").eq(0).width()/(200*stripeWidth));var chunkCount=Math.ceil(maxBufferWidth/chunkSize);for(chunk=0;chunk<=chunkCount;chunk++){for(line=0;line<preBuffer.length;line++){for(i=0;i<chunkSize;i++){if(typeof(preBuffer[line][chunk*chunkSize+i])!='undefined'){queue.enqueue(preBuffer[line][chunk*chunkSize+i]);}}}}
loadThumbnailStripes(queue);}
function loadThumbnailStripes(queue){if(!connManager.isPaused()&&!queue.isEmpty()){if(connManager.AcquireConnection()){var strip=queue.dequeue();var url='Media/';url+=strip.date+'/';url+='_thumbstripe'+zeroPad(strip.stripeIndex+1,2)+'.jpg';var loader=new Image();loader.onerror=function(){connManager.ReleaseConnection();}
loader.onload=function(){var stripeLinks=$("#"+strip.date).find(".draggableHelper").children().slice(strip.stripeIndex*stripeWidth,(strip.stripeIndex*stripeWidth)+stripeWidth);stripeLinks.each(function(index,element){$(element).css('background-image',"url('"+url+"')");$(element).css('background-position','-'+(index*200)+'px 0px');});connManager.ReleaseConnection();}
loader.src=url;loadThumbnailStripes(queue);}else{connManager.getEventObject().bind('connReleased',function(e){window.setTimeout(function(){loadThumbnailStripes(queue);},50);connManager.getEventObject().unbind('connReleased',arguments.callee);});}}}
function changeMonth(date){if((availableMonths=='prevOnly'&&date<currentMonth)||(availableMonths=='nextOnly'&&date>currentMonth)||(availableMonths=='both')){connManager.Pause();var data={mode:currentMode,command:'GetMonthData',date:date};$.post(ajaxUrl,data,changeMonthCallback,'xml');$(".monthGroup").css('height',$(".monthGroup").height());$(".monthGroup").empty();}}
function changeMonthCallback(response,status){currentMonth=parseInt($("root",response).attr('currentMonth'),10);availableMonths=$("root",response).attr('availableMonths');updateMonthNavigation();connManager.Reset();$("#ajaxLoaderTarget").empty();if($.browser.msie){$("root",response).children().each(function(){$("#ajaxLoaderTarget").append(this.xml);});}else{$("#ajaxLoaderTarget").append($("root",response)[0].innerHTML);}
initializeThumbStrips();}
function updateMonthNavigation(){if(availableMonths=='prevOnly'){$("#prevMonth").css('display','block');$("#nextMonth").css('display','none');}else if(availableMonths=='nextOnly'){$("#prevMonth").css('display','none');$("#nextMonth").css('display','block');}else{$("#prevMonth").css('display','block');$("#nextMonth").css('display','block');}}
function calculateThumbstripWidths(){$(".draggableHelper").each(function(){var totalWidth=$(this).find('a').length*200;$(this).css('width',totalWidth);});}
var intervalId=0;function scrollThumbStripLeft(){var container=$(this).parent().children('.images');var scroller=container.children('.draggableHelper');if(!scroller.data('suspendEvents')){if(parseInt(scroller.css('left'),10)!=0&&!isNaN(parseInt(scroller.css('left'),10))){var time=Math.floor(parseInt(scroller.css('left'),10)-parseInt(container.css('width'),10))*-1;scroller.animate({left:'0px'},time,'easeInOutQuad');}}}
function scrollThumbStripRight(){var container=$(this).parent().children('.images');var scroller=container.children('.draggableHelper');if(!scroller.data('suspendEvents')){var leftCoord=(scroller.css('left')=='auto')?'0':scroller.css('left');var time=Math.floor(parseInt(scroller.css('width'),10)+parseInt(leftCoord,10));var endPos=(parseInt(scroller.css('width'),10)-parseInt(container.css('width'),10))*-1
scroller.animate({left:endPos+'px'},time,'easeInOutQuad');}}
function stopScrollThumbstrip(){var scroller=$(this).parent().children('.images').children('.draggableHelper');if(!scroller.data('suspendEvents')){$(this).parent().children('.images').children('.draggableHelper').stop(true)}}
var originalEventHeight=0;var originalEventWidth=0;var expandedEvent=null;function toggleEvent(){if(expandedEvent==null){expandEvent(this)
expandedEvent=this;}else if(expandedEvent==this){contractEvent(this);expandedEvent=null;}else{contractEvent(expandedEvent);expandEvent(this)
expandedEvent=this;}}
function expandEvent(element){originalEventHeight=$(element).height();originalEventWidth=$(element).width();if($(element).hasClass('hasFlyer')){$(element).animate({height:$(element).height()*3+66,width:$(element).width()*2+119},500);$(element).children('.flyer').fadeIn(500);}else{$(element).animate({height:$(element).height()*3+66},500);}
$(element).addClass('highlighted');}
function contractEvent(element){$(element).removeClass('highlighted');$(element).animate({width:'209px',height:originalEventHeight+'px'},500);}
function toggleMonth(){var element=$(this).parent()[0];if(element.id.indexOf('_contracted')==-1){element.id+='_contracted:'+$(element).height();contractMonth(element)}else{expandMonth(element,element.id.substring(element.id.indexOf(':')+1,element.id.length))
element.id=element.id.substring(0,element.id.indexOf('_contracted'));}}
function contractMonth(element){$(element).animate({height:'90px'});}
function expandMonth(element,height){$(element).animate({height:height+'px'});}
function zeroPad(num,count){var numZeropad=num+'';while(numZeropad.length<count){numZeropad="0"+numZeropad;}
return numZeropad;}
function ConnectionManager(){var eventObject=$('<span id="ConnectionManager"></span>').appendTo("body");var activeConnections=0;var maxConnections=4;var pause=false;this.getEventObject=function(){return eventObject;}
this.isConnectionAvailable=function(){return activeConnections<maxConnections;}
this.isPaused=function(){return pause;}
this.AcquireConnection=function(){if(activeConnections<maxConnections&&!pause){activeConnections++;return true;}else{return false;}}
this.ReleaseConnection=function(){activeConnections--;eventObject.trigger('connReleased');}
this.Pause=function(){pause=true;}
this.Resume=function(){pause=false;}
this.Reset=function(){activeConnections=0;pause=false;eventObject.unbind();}}
