(function($){$.slideshow=function(el,options){var base=this;base.$el=$(el).addClass('slideshowbase').wrap('<div class="slideshow"><div class="slideshowwindow" /></div>');base.$el.data("slideshow",base);base.$window=base.$el.closest(".slideshowwindow");base.$base=$(el);base.init=function(){base.options=$.extend({},$.slideshow.defaults,options);base.currentIndex=base.options.startAtIndex;base.total=base.$base.children().length;if(base.options.width===null){base.options.width=base.$base.children()[0].outerWidth();}
base.$window.css({"display":"block","width":(base.options.width*base.total)});base.$base.children().css({"display":"block","float":"left"});};base.goToIndex=function(ind){if(ind<0)ind=0;if(ind>=base.total)ind=base.total-1;base.$el.trigger("pre-slide",ind);base.$window.animate({"margin-left":(-1*ind*base.options.width)},base.options.duration,function(){base.$el.trigger("post-slide",ind);});base.currentIndex=ind;};base.nextIndex=function(){base.goToIndex(base.currentIndex+1);};base.prevIndex=function(){base.goToIndex(base.currentIndex-1);};base.init();};$.slideshow.defaults={"width":null,"height":null,"duration":600,"startAtIndex":0};$.fn.slideshow=function(options,callback){return this.each(function(i){var slideshow=$(this).data('slideshow');if((typeof(options)).match('object|undefined')){if(!slideshow){new $.slideshow(this,options);}}});};})(jQuery);jQuery.extend(jQuery.easing,{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($){$.anythingSlider=function(el,options){var base=this;base.$el=$(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');base.$el.data("AnythingSlider",base);base.init=function(){base.options=$.extend({},$.anythingSlider.defaults,options);if($.isFunction(base.options.onBeforeInitialize)){base.$el.bind('before_initialize',base.options.onBeforeInitialize);}
base.$el.trigger('before_initialize',base);base.$wrapper=base.$el.parent().closest('div.anythingSlider').addClass('anythingSlider-'+base.options.theme);base.$window=base.$el.closest('div.anythingWindow');base.$controls=$('<div class="anythingControls"></div>').appendTo($(base.options.appendControlsTo).length?$(base.options.appendControlsTo):base.$wrapper);base.$nav=$('<ul class="thumbNav" />').appendTo(base.$controls);base.timer=null;base.flag=false;base.playing=false;base.hovered=false;base.panelSize=[];base.currentPage=base.options.startPanel;if(base.options.playRtl){base.$wrapper.addClass('rtl');}
base.original=[base.options.autoPlay,base.options.buildNavigation,base.options.buildArrows];base.updateSlider();base.$currentPage=base.$items.eq(base.currentPage);base.$lastPage=base.$currentPage;base.runTimes=$('div.anythingSlider').index(base.$wrapper)+1;base.regex=new RegExp('panel'+base.runTimes+'-(\\d+)','i');if(!$.isFunction($.easing[base.options.easing])){base.options.easing="swing";}
if(base.options.theme!='default'&&!$('link[href*='+base.options.theme+']').length){$('body').append('<link rel="stylesheet" href="'+base.options.themeDirectory.replace(/\{themeName\}/g,base.options.theme)+'" type="text/css" />');}
if(base.options.pauseOnHover){base.$wrapper.hover(function(){if(base.playing){base.$el.trigger('slideshow_paused',base);base.clearTimer(true);}},function(){if(base.playing){base.$el.trigger('slideshow_unpaused',base);base.startStop(base.playing,true);}});}
var startPanel=(base.options.hashTags)?base.gotoHash()||base.options.startPanel:base.options.startPanel;base.setCurrentPage(startPanel,false);base.slideControls(false);base.$wrapper.hover(function(e){base.hovered=(e.type=="mouseenter")?true:false;base.slideControls(base.hovered,false);});if(base.options.enableKeyboard){$(document).keyup(function(e){if(base.$wrapper.is('.activeSlider')){switch(e.which){case 39:base.goForward();break;case 37:base.goBack();break;}}});}
if($.isFunction(base.options.onShowPause)){base.$el.bind('slideshow_paused',base.options.onShowPause);}
if($.isFunction(base.options.onShowUnpause)){base.$el.bind('slideshow_unpaused',base.options.onShowUnpause);}
if($.isFunction(base.options.onSlideInit)){base.$el.bind('slide_init',base.options.onSlideInit);}
if($.isFunction(base.options.onSlideBegin)){base.$el.bind('slide_begin',base.options.onSlideBegin);}
if($.isFunction(base.options.onShowStop)){base.$el.bind('slideshow_stop',base.options.onShowStop);}
if($.isFunction(base.options.onShowStart)){base.$el.bind('slideshow_start',base.options.onShowStart);}
if($.isFunction(base.options.onInitialized)){base.$el.bind('initialized',base.options.onInitialized);}
if($.isFunction(base.options.onSWFComplete)){base.$el.bind('swf_completed',base.options.onSWFComplete);}
if($.isFunction(base.options.onSlideComplete)){base.$el.bind('slide_complete',function(){setTimeout(function(){base.options.onSlideComplete(base);},0);});}
base.$el.trigger('initialized',base);};base.updateSlider=function(){base.$el.find('li.cloned').remove();base.$nav.empty();base.$items=base.$el.find('> li');base.pages=base.$items.length;if(base.options.resizeContents){if(base.options.width){base.$wrapper.add(base.$items).css('width',base.options.width);}
if(base.options.height){base.$wrapper.add(base.$items).css('height',base.options.height);}}
if(base.pages===1){base.options.autoPlay=false;base.options.buildNavigation=false;base.options.buildArrows=false;base.$controls.hide();base.$nav.hide();if(base.$forward){base.$forward.add(base.$back).hide();}}else{base.options.autoPlay=base.original[0];base.options.buildNavigation=base.original[1];base.options.buildArrows=base.original[2];base.$controls.show();base.$nav.show();if(base.$forward){base.$forward.add(base.$back).show();}}
base.buildNavigation();if(base.options.autoPlay){base.playing=!base.options.startStopped;base.buildAutoPlay();}
if(base.options.buildArrows){base.buildNextBackButtons();}
base.$el.prepend(base.$items.filter(':last').clone().addClass('cloned').removeAttr('id'));base.$el.append(base.$items.filter(':first').clone().addClass('cloned').removeAttr('id'));base.$el.find('li.cloned').each(function(){$(this).html(function(i,h){return h.replace(/<a/gi,'<span').replace(/\/a>/gi,'/span>');});});base.$items=base.$el.find('> li').addClass('panel');base.setDimensions();if(!base.options.resizeContents){$(window).load(function(){base.setDimensions();});}
if(base.currentPage>base.pages){base.currentPage=base.pages;base.setCurrentPage(base.pages,false);}
base.$nav.find('a').eq(base.currentPage-1).addClass('cur');base.hasEmb=base.$items.find('embed[src*=youtube]').length;base.hasSwfo=(typeof(swfobject)!=='undefined'&&swfobject.hasOwnProperty('embedSWF')&&$.isFunction(swfobject.embedSWF))?true:false;if(base.hasEmb&&base.hasSwfo){base.$items.find('embed[src*=youtube]').each(function(i){var $tar=($(this).parent()[0].tagName=="OBJECT")?$(this).parent():$(this);$tar.wrap('<div id="ytvideo'+i+'"></div>');swfobject.embedSWF($(this).attr('src')+'&enablejsapi=1&version=3&playerapiid=ytvideo'+i,'ytvideo'+i,$tar.attr('width'),$tar.attr('height'),'10',null,null,{allowScriptAccess:"always",wmode:base.options.addWmodeToObject},{'class':$tar.attr('class'),'style':$tar.attr('style')},function(){if(i>=base.hasEmb-1){base.$el.trigger('swf_completed',base);}});});}
base.$items.find('a').unbind('focus').bind('focus',function(e){base.$items.find('.focusedLink').removeClass('focusedLink');$(this).addClass('focusedLink');var panel=$(this).closest('.panel');if(!panel.is('.activePage')){base.gotoPage(base.$items.index(panel));e.preventDefault();}});};base.buildNavigation=function(){if(base.options.buildNavigation&&(base.pages>1)){base.$items.filter(':not(.cloned)').each(function(i,el){var index=i+1,klass=((index==1)?'first':'')+((index==base.pages)?'last':''),$a=$('<a href="#"></a>').addClass('panel'+index).wrap('<li class="'+klass+'" />');base.$nav.append($a.parent());if($.isFunction(base.options.navigationFormatter)){var tmp=base.options.navigationFormatter(index,$(this));$a.html(tmp);if(parseInt($a.css('text-indent'),10)<0){$a.addClass(base.options.tooltipClass).attr('title',tmp);}}else{$a.text(index);}
$a.bind(base.options.clickControls,function(e){if(!base.flag&&base.options.enableNavigation){base.flag=true;setTimeout(function(){base.flag=false;},100);base.gotoPage(index);if(base.options.hashTags){base.setHash(index);}}
e.preventDefault();});});}};base.buildNextBackButtons=function(){if(base.$forward){return;}
base.$forward=$('<span class="arrow forward"><a href="#">'+base.options.forwardText+'</a></span>');base.$back=$('<span class="arrow back"><a href="#">'+base.options.backText+'</a></span>');base.$back.bind(base.options.clickArrows,function(e){base.goBack();e.preventDefault();});base.$forward.bind(base.options.clickArrows,function(e){base.goForward();e.preventDefault();});base.$back.add(base.$forward).find('a').bind('focusin focusout',function(){$(this).toggleClass('hover');});base.$wrapper.prepend(base.$forward).prepend(base.$back);base.$arrowWidth=base.$forward.width();};base.buildAutoPlay=function(){if(base.$startStop){return;}
base.$startStop=$("<a href='#' class='start-stop'></a>").html(base.playing?base.options.stopText:base.options.startText);base.$controls.prepend(base.$startStop);base.$startStop.bind(base.options.clickSlideshow,function(e){if(base.options.enablePlay){base.startStop(!base.playing);if(base.playing){if(base.options.playRtl){base.goBack(true);}else{base.goForward(true);}}}
e.preventDefault();}).bind('focusin focusout',function(){$(this).toggleClass('hover');});base.startStop(base.playing);};base.setDimensions=function(){var w,h,c,cw,dw,leftEdge=0,bww=base.$window.width(),winw=$(window).width();base.$items.each(function(i){c=$(this).children('*');if(base.options.resizeContents){w=parseInt(base.options.width,10)||bww;h=parseInt(base.options.height,10)||base.$window.height();$(this).css({width:w,height:h});if(c.length==1){c.css({width:'100%',height:'100%'});if(c[0].tagName=="OBJECT"){c.find('embed').andSelf().attr({width:'100%',height:'100%'});}}}else{w=$(this).width();dw=(w>=winw)?true:false;if(c.length==1&&dw){cw=(c.width()>=winw)?bww:c.width();$(this).css('width',cw);c.css('max-width',cw);w=cw;}
w=(dw)?base.options.width||bww:w;$(this).css('width',w);h=$(this).outerHeight();$(this).css('height',h);}
base.panelSize[i]=[w,h,leftEdge];leftEdge+=w;});base.$el.css('width',(leftEdge<base.options.maxOverallWidth)?leftEdge:base.options.maxOverallWidth);};base.gotoPage=function(page,autoplay,callback){if(base.pages===1){return;}
base.$lastPage=base.$items.eq(base.currentPage);if(typeof(page)==="undefined"||page===null){page=base.options.startPage;base.setCurrentPage(base.options.startPage);}
if(base.hasEmb&&base.checkVideo(base.playing)){return;}
if(page>base.pages+1){page=base.pages;}
if(page<0){page=1;}
base.$currentPage=base.$items.eq(page);base.currentPage=page;base.$el.trigger('slide_init',base);base.slideControls(true,false);if(autoplay!==true){autoplay=false;}
if(!autoplay||(base.options.stopAtEnd&&page==base.pages)){base.startStop(false);}
base.$el.trigger('slide_begin',base);if(!base.options.resizeContents){base.$wrapper.filter(':not(:animated)').animate({width:base.panelSize[page][0],height:base.panelSize[page][1]},{queue:false,duration:base.options.animationTime,easing:base.options.easing});}
base.$window.filter(':not(:animated)').animate({scrollLeft:base.panelSize[page][2]},{queue:false,duration:base.options.animationTime,easing:base.options.easing,complete:function(){base.endAnimation(page,callback);}});};base.endAnimation=function(page,callback){if(page===0){base.$window.scrollLeft(base.panelSize[base.pages][2]);page=base.pages;}else if(page>base.pages){base.$window.scrollLeft(base.panelSize[1][2]);page=1;}
base.setCurrentPage(page,false);base.$items.removeClass('activePage').eq(page).addClass('activePage');if(!base.hovered){base.slideControls(false);}
if(base.hasEmb){var emb=base.$currentPage.find('object[id*=ytvideo], embed[id*=ytvideo]');if(emb.length&&$.isFunction(emb[0].getPlayerState)&&emb[0].getPlayerState()>0&&emb[0].getPlayerState()!=5){emb[0].playVideo();}}
base.$el.trigger('slide_complete',base);if(typeof callback==='function'){callback(base);}
if(base.options.autoPlayLocked&&!base.playing){setTimeout(function(){base.startStop(true);},base.options.resumeDelay-base.options.delay);}};base.setCurrentPage=function(page,move){if(page>base.pages+1){page=base.pages;}
if(page<0){page=1;}
if(base.options.buildNavigation){base.$nav.find('.cur').removeClass('cur');base.$nav.find('a').eq(page-1).addClass('cur');}
if(!move){base.$wrapper.css({width:base.panelSize[page][0],height:base.panelSize[page][1]});base.$wrapper.scrollLeft(0);base.$window.scrollLeft(base.panelSize[page][2]);}
base.currentPage=page;if(!base.$wrapper.is('.activeSlider')){$('.activeSlider').removeClass('activeSlider');base.$wrapper.addClass('activeSlider');}};base.goForward=function(autoplay){if(autoplay!==true){autoplay=false;base.startStop(false);}
base.gotoPage(base.currentPage+1,autoplay);};base.goBack=function(autoplay){if(autoplay!==true){autoplay=false;base.startStop(false);}
base.gotoPage(base.currentPage-1,autoplay);};base.gotoHash=function(){var n=window.location.hash.match(base.regex);return(n===null)?'':parseInt(n[1],10);};base.setHash=function(n){var s='panel'+base.runTimes+'-',h=window.location.hash;if(typeof h!=='undefined'){window.location.hash=(h.indexOf(s)>0)?h.replace(base.regex,s+n):h+"&"+s+n;}};base.slideControls=function(toggle,playing){var dir=(toggle)?'slideDown':'slideUp',t1=(toggle)?0:base.options.animationTime,t2=(toggle)?base.options.animationTime:0,sign=(toggle)?0:1;if(base.options.toggleControls){base.$controls.stop(true,true).delay(t1)[dir](base.options.animationTime/2).delay(t2);}
if(base.options.buildArrows&&base.options.toggleArrows){if(!base.hovered&&base.playing){sign=1;t2=0;}
base.$forward.stop(true,true).delay(t1).animate({right:sign*base.$arrowWidth,opacity:t2},base.options.animationTime/2);base.$back.stop(true,true).delay(t1).animate({left:sign*base.$arrowWidth,opacity:t2},base.options.animationTime/2);}};base.clearTimer=function(paused){if(base.timer){window.clearInterval(base.timer);if(!paused){base.$el.trigger('slideshow_stop',base);}}};base.startStop=function(playing,paused){if(playing!==true){playing=false;}
if(playing&&!paused){base.$el.trigger('slideshow_start',base);}
base.playing=playing;if(base.options.autoPlay){base.$startStop.toggleClass('playing',playing).html(playing?base.options.stopText:base.options.startText);if(parseInt(base.$startStop.css('text-indent'),10)<0){base.$startStop.addClass(base.options.tooltipClass).attr('title',playing?'Stop':'Start');}}
if(playing){base.clearTimer(true);base.timer=window.setInterval(function(){if(!(base.hasEmb&&base.checkVideo(playing))){if(base.options.playRtl){base.goBack(true);}else{base.goForward(true);}}},base.options.delay);}else{base.clearTimer();}};base.checkVideo=function(playing){var emb,ps,stopAdvance=false;base.$items.find('object[id*=ytvideo], embed[id*=ytvideo]').each(function(){emb=$(this);if(emb.length&&$.isFunction(emb[0].getPlayerState)){ps=emb[0].getPlayerState();if(playing&&(ps==1||ps>2)&&base.$items.index(emb.closest('li.panel'))==base.currentPage&&base.options.resumeOnVideoEnd){stopAdvance=true;}else{if(ps>0){emb[0].pauseVideo();}}}});return stopAdvance;};base.init();};$.anythingSlider.defaults={width:null,height:null,resizeContents:true,tooltipClass:'tooltip',theme:'default',themeDirectory:'css/theme-{themeName}.css',startPanel:1,hashTags:true,enableKeyboard:true,buildArrows:true,toggleArrows:false,buildNavigation:true,enableNavigation:true,toggleControls:false,appendControlsTo:null,navigationFormatter:null,forwardText:"&raquo;",backText:"&laquo;",enablePlay:true,autoPlay:true,autoPlayLocked:false,startStopped:false,pauseOnHover:true,resumeOnVideoEnd:true,stopAtEnd:false,playRtl:false,startText:"Start",stopText:"Stop",delay:3000,resumeDelay:15000,animationTime:600,easing:"swing",onBeforeInitialize:null,onInitialized:null,onSWFComplete:null,onShowStart:null,onShowStop:null,onShowPause:null,onShowUnpause:null,onSlideInit:null,onSlideBegin:null,onSlideComplete:null,clickArrows:"click",clickControls:"click focusin",clickSlideshow:"click",addWmodeToObject:"opaque",maxOverallWidth:32766};$.fn.anythingSlider=function(options,callback){return this.each(function(i){var anySlide=$(this).data('AnythingSlider');if((typeof(options)).match('object|undefined')){if(!anySlide){(new $.anythingSlider(this,options));}else{anySlide.updateSlider();}}else if(/\d/.test(options)&&!isNaN(options)&&anySlide){var page=(typeof(options)=="number")?options:parseInt($.trim(options),10);if(page>=1&&page<=anySlide.pages){anySlide.gotoPage(page,false,callback);}}});};})(jQuery);
