;(function($){var n='2.26';var q=$.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);function log(){if(window.console&&window.console.log)window.console.log('[cycle] '+Array.prototype.join.call(arguments,''))};$.fn.cycle=function(m){return this.each(function(){if(m===undefined||m===null)m={};if(m.constructor==String){switch(m){case'stop':if(this.cycleTimeout)clearTimeout(this.cycleTimeout);this.cycleTimeout=0;$(this).data('cycle.opts','');return;case'pause':this.cyclePause=1;return;case'resume':this.cyclePause=0;return;default:m={fx:m}}}else if(m.constructor==Number){var c=m;m=$(this).data('cycle.opts');if(!m){log('options not found, can not advance slide');return}if(c<0||c>=m.elements.length){log('invalid slide index: '+c);return}m.nextSlide=c;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);this.cycleTimeout=0}go(m.elements,m,1,c>=m.currSlide);return}if(this.cycleTimeout)clearTimeout(this.cycleTimeout);this.cycleTimeout=0;this.cyclePause=0;var d=$(this);var e=m.slideExpr?$(m.slideExpr,this):d.children();var f=e.get();if(f.length<2){log('terminating; too few slides: '+f.length);$(m.pager).hide();return}var g=$.extend({},$.fn.cycle.defaults,m||{},$.metadata?d.metadata():$.meta?d.data():{});if(g.autostop)g.countdown=g.autostopCount||f.length;d.data('cycle.opts',g);g.container=this;g.elements=f;g.before=g.before?[g.before]:[];g.after=g.after?[g.after]:[];g.after.unshift(function(){g.busy=0});if(g.continuous)g.after.push(function(){go(f,g,0,!g.rev)});if(q&&g.cleartype&&!g.cleartypeNoBg)clearTypeFix(e);var h=this.className;g.width=parseInt((h.match(/w:(\d+)/)||[])[1])||g.width;g.height=parseInt((h.match(/h:(\d+)/)||[])[1])||g.height;g.timeout=parseInt((h.match(/t:(\d+)/)||[])[1])||g.timeout;if(d.css('position')=='static')d.css('position','relative');if(g.width)d.width(g.width);if(g.height&&g.height!='auto')d.height(g.height);if(g.random){g.randomMap=[];for(var i=0;i<f.length;i++)g.randomMap.push(i);g.randomMap.sort(function(a,b){return Math.random()-0.5});g.randomIndex=0;g.startingSlide=g.randomMap[0]}else if(g.startingSlide>=f.length)g.startingSlide=0;var j=g.startingSlide||0;e.css({position:'absolute',top:0,left:0}).hide().each(function(i){var z=j?i>=j?f.length-(i-j):j-i:f.length-i;$(this).css('z-index',z)});$(f[j]).css('opacity',1).show();if($.browser.msie)f[j].style.removeAttribute('filter');if(g.fit&&g.width)e.width(g.width);if(g.fit&&g.height&&g.height!='auto')e.height(g.height);if(g.pause)d.hover(function(){this.cyclePause=1},function(){this.cyclePause=0});var k=$.fn.cycle.transitions[g.fx];if($.isFunction(k))k(d,e,g);else if(g.fx!='custom')log('unknown transition: '+g.fx);e.each(function(){var a=$(this);this.cycleH=(g.fit&&g.height)?g.height:a.height();this.cycleW=(g.fit&&g.width)?g.width:a.width()});g.cssBefore=g.cssBefore||{};g.animIn=g.animIn||{};g.animOut=g.animOut||{};e.not(':eq('+j+')').css(g.cssBefore);if(g.cssFirst)$(e[j]).css(g.cssFirst);if(g.timeout){if(g.speed.constructor==String)g.speed={slow:600,fast:200}[g.speed]||400;if(!g.sync)g.speed=g.speed/2;while((g.timeout-g.speed)<250)g.timeout+=g.speed}if(g.easing)g.easeIn=g.easeOut=g.easing;if(!g.speedIn)g.speedIn=g.speed;if(!g.speedOut)g.speedOut=g.speed;g.slideCount=f.length;g.currSlide=j;if(g.random){g.nextSlide=g.currSlide;if(++g.randomIndex==f.length)g.randomIndex=0;g.nextSlide=g.randomMap[g.randomIndex]}else g.nextSlide=g.startingSlide>=(f.length-1)?0:g.startingSlide+1;var l=e[j];if(g.before.length)g.before[0].apply(l,[l,l,g,true]);if(g.after.length>1)g.after[1].apply(l,[l,l,g,true]);if(g.click&&!g.next)g.next=g.click;if(g.next)$(g.next).bind('click',function(){return advance(f,g,g.rev?-1:1)});if(g.prev)$(g.prev).bind('click',function(){return advance(f,g,g.rev?1:-1)});if(g.pager)buildPager(f,g);g.addSlide=function(a){var b=$(a),s=b[0];if(!g.autostopCount)g.countdown++;f.push(s);if(g.els)g.els.push(s);g.slideCount=f.length;b.css('position','absolute').appendTo(d);if(q&&g.cleartype&&!g.cleartypeNoBg)clearTypeFix(b);if(g.fit&&g.width)b.width(g.width);if(g.fit&&g.height&&g.height!='auto')e.height(g.height);s.cycleH=(g.fit&&g.height)?g.height:b.height();s.cycleW=(g.fit&&g.width)?g.width:b.width();b.css(g.cssBefore);if(g.pager)$.fn.cycle.createPagerAnchor(f.length-1,s,$(g.pager),f,g);if(typeof g.onAddSlide=='function')g.onAddSlide(b)};if(g.timeout||g.continuous)this.cycleTimeout=setTimeout(function(){go(f,g,0,!g.rev)},g.continuous?10:g.timeout+(g.delay||0))})};function go(a,b,c,d){if(b.busy)return;var p=b.container,curr=a[b.currSlide],next=a[b.nextSlide];if(p.cycleTimeout===0&&!c)return;if(!c&&!p.cyclePause&&((b.autostop&&(--b.countdown<=0))||(b.nowrap&&!b.random&&b.nextSlide<b.currSlide))){if(b.end)b.end(b);return}if(c||!p.cyclePause){if(b.before.length)$.each(b.before,function(i,o){o.apply(next,[curr,next,b,d])});var e=function(){if($.browser.msie&&b.cleartype)this.style.removeAttribute('filter');$.each(b.after,function(i,o){o.apply(next,[curr,next,b,d])})};if(b.nextSlide!=b.currSlide){b.busy=1;if(b.fxFn)b.fxFn(curr,next,b,e,d);else if($.isFunction($.fn.cycle[b.fx]))$.fn.cycle[b.fx](curr,next,b,e);else $.fn.cycle.custom(curr,next,b,e,c&&b.fastOnEvent)}if(b.random){b.currSlide=b.nextSlide;if(++b.randomIndex==a.length)b.randomIndex=0;b.nextSlide=b.randomMap[b.randomIndex]}else{var f=(b.nextSlide+1)==a.length;b.nextSlide=f?0:b.nextSlide+1;b.currSlide=f?a.length-1:b.nextSlide-1}if(b.pager)$.fn.cycle.updateActivePagerLink(b.pager,b.currSlide,b.activeSlideCSSName)}if(b.timeout&&!b.continuous)p.cycleTimeout=setTimeout(function(){go(a,b,0,!b.rev)},b.timeout);else if(b.continuous&&p.cyclePause)p.cycleTimeout=setTimeout(function(){go(a,b,0,!b.rev)},10)};$.fn.cycle.updateActivePagerLink=function(a,b,c){$(a).find('a').removeClass(c).filter('a:eq('+b+')').addClass(c)};function advance(a,b,c){var p=b.container,timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0}if(b.random&&c<0){b.randomIndex--;if(--b.randomIndex==-2)b.randomIndex=a.length-2;else if(b.randomIndex==-1)b.randomIndex=a.length-1;b.nextSlide=b.randomMap[b.randomIndex]}else if(b.random){if(++b.randomIndex==a.length)b.randomIndex=0;b.nextSlide=b.randomMap[b.randomIndex]}else{b.nextSlide=b.currSlide+c;if(b.nextSlide<0){if(b.nowrap)return false;b.nextSlide=a.length-1}else if(b.nextSlide>=a.length){if(b.nowrap)return false;b.nextSlide=0}}if(b.prevNextClick&&typeof b.prevNextClick=='function')b.prevNextClick(c>0,b.nextSlide,a[b.nextSlide]);go(a,b,1,c>=0);return false};function buildPager(a,b){var c=$(b.pager);$.each(a,function(i,o){$.fn.cycle.createPagerAnchor(i,o,c,a,b)});$.fn.cycle.updateActivePagerLink(b.pager,b.startingSlide,b.activeSlideCSSName)};$.fn.cycle.createPagerAnchor=function(i,a,b,c,d){var e=(typeof d.pagerAnchorBuilder=='function')?$(d.pagerAnchorBuilder(i,a)):$('<a href="#">'+(i+1)+'</a>');if(e.parents('body').length==0)e.appendTo(b);e.bind(d.pagerEvent,function(){d.nextSlide=i;var p=d.container,timeout=p.cycleTimeout;if(timeout){clearTimeout(timeout);p.cycleTimeout=0}if(typeof d.pagerClick=='function')d.pagerClick(d.nextSlide,c[d.nextSlide]);go(c,d,1,d.currSlide<i);return false})};function clearTypeFix(b){function hex(s){var s=parseInt(s).toString(16);return s.length<2?'0'+s:s};function getBg(e){for(;e&&e.nodeName.toLowerCase()!='html';e=e.parentNode){var v=$.css(e,'background-color');if(v.indexOf('rgb')>=0){var a=v.match(/\d+/g);return'#'+hex(a[0])+hex(a[1])+hex(a[2])}if(v&&v!='transparent')return v}return'#ffffff'};b.each(function(){$(this).css('background-color',getBg(this))})};$.fn.cycle.custom=function(a,b,c,d,e){var f=$(a),$n=$(b);$n.css(c.cssBefore);var g=e?1:c.speedIn;var h=e?1:c.speedOut;var i=e?null:c.easeIn;var j=e?null:c.easeOut;var k=function(){$n.animate(c.animIn,g,i,d)};f.animate(c.animOut,h,j,function(){if(c.cssAfter)f.css(c.cssAfter);if(!c.sync)k()});if(c.sync)k()};$.fn.cycle.transitions={fade:function(a,b,c){b.not(':eq('+c.startingSlide+')').css('opacity',0);c.before.push(function(){$(this).show()});c.animIn={opacity:1};c.animOut={opacity:0};c.cssBefore={opacity:0};c.cssAfter={display:'none'}}};$.fn.cycle.ver=function(){return n};$.fn.cycle.defaults={fx:'fade',timeout:4000,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,pager:null,pagerClick:null,pagerEvent:'click',pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:'auto',startingSlide:0,sync:1,random:0,fit:0,pause:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:0,nowrap:0,fastOnEvent:0,activeSlideCSSName:'activeSlide'}})(jQuery);
