/*
	jQuery cycle v2.03
	
	Wouter Beeftink
	wouter@footsteps.nl
*/
(function($){$.fn.cycle=function(f){var f=$.extend({start:0,startShown:true,rotate:true,speed:1000,interval:5000,keep:false,onLoad:null,beforePause:null,onPause:null,beforeStop:null,onStop:null,beforeCycle:null,onCycle:null,onMouseover:null,onMouseout:null,debug:false},f);function log(a){if(f.debug){try{console.log(a)}catch(e){alert(e);log=function(){}}}};function callback(a,b,c){var d=f[a];if($.isFunction(d))d.call(b,c)};this.showIndex=function(a,b){log('showIndex: '+a);callback('beforeCycle',this,{index:a});this.hide();if(b){this.eq(f.start).show()}else{if(currentIndex!=a){this.stop();if(currentIndex>=0){g.eq(currentIndex).css({'display':'block','z-index':1,'opacity':1})};callback('onCycle',this,{index:a});g.eq(a).css({'display':'block','z-index':2,'opacity':0}).animate({'opacity':1},f.speed)}};currentIndex=a;if(timer){this.stopCycle();this.startCycle()}};this.showPrevious=function(){log('showPrevious');this.showIndex(this.getPreviousIndex())};this.showNext=function(){log('showNext');this.showIndex(this.getNextIndex())};this.startCycle=function(){if(!this.isAnimated()){callback('onStart',this);log('startCycle');timer=window.setInterval(function(){g.showNext()},f.interval)};stopped=false};this.pauseCycle=function(){if(this.isAnimated()){callback('onPause',this);log('pauseCycle');window.clearInterval(timer);timer=null};stopped=false};this.stopCycle=function(){if(this.isAnimated()){callback('onStop',this);log('stopCycle');window.clearInterval(timer);timer=null};stopped=true};this.isAnimated=function(){return timer?true:false};this.getCurrentIndex=function(){return currentIndex};this.getPreviousIndex=function(){return currentIndex==0?amount-1:currentIndex-1};this.getNextIndex=function(){return currentIndex==amount-1?0:currentIndex+1};this.getAmount=function(){return amount};var g=this,amount=this.length,stopped=f.rotate,currentIndex,timer=null;callback('onLoad',this);if(amount>1){this.css('position','absolute');this.showIndex(f.start,f.startShown);if(f.rotate)this.startCycle();if(f.keep){this.hover(function(){callback(g,'mouseover',{index:currentIndex});g.pauseCycle()},function(){callback(g,'mouseout',{index:currentIndex});if(!stopped)g.startCycle()})}};return this}})(jQuery);