/*
 * jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version: 2.32 (21-DEC-2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
;(function(G){var H="2.32";var C=G.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);function D(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments,""))}}G.fn.cycle=function(J){if(this.length==0){D("terminating; zero elements found by selector"+(G.isReady?"":" (DOM not ready)"));return this}var K=arguments[1];return this.each(function(){if(J===undefined||J===null){J={}}if(J.constructor==String){switch(J){case"stop":if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;G(this).data("cycle.opts","");return ;case"pause":this.cyclePause=1;return ;case"resume":this.cyclePause=0;if(K===true){J=G(this).data("cycle.opts");if(!J){D("options not found, can not resume");return }if(this.cycleTimeout){clearTimeout(this.cycleTimeout);this.cycleTimeout=0}B(J.elements,J,1,1)}return ;default:J={fx:J}}}else{if(J.constructor==Number){var S=J;J=G(this).data("cycle.opts");if(!J){D("options not found, can not advance slide");return }if(S<0||S>=J.elements.length){D("invalid slide index: "+S);return }J.nextSlide=S;if(this.cycleTimeout){clearTimeout(this.cycleTimeout);this.cycleTimeout=0}B(J.elements,J,1,S>=J.currSlide);return }}if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var X=G(this);var T=J.slideExpr?G(J.slideExpr,this):X.children();var O=T.get();if(O.length<2){D("terminating; too few slides: "+O.length);return }var L=G.extend({},G.fn.cycle.defaults,J||{},G.metadata?X.metadata():G.meta?X.data():{});if(L.autostop){L.countdown=L.autostopCount||O.length}X.data("cycle.opts",L);L.container=this;L.elements=O;L.before=L.before?[L.before]:[];L.after=L.after?[L.after]:[];L.after.unshift(function(){L.busy=0});if(L.continuous){L.after.push(function(){B(O,L,0,!L.rev)})}if(C&&L.cleartype&&!L.cleartypeNoBg){E(T)}var Z=this.className;L.width=parseInt((Z.match(/w:(\d+)/)||[])[1])||L.width;L.height=parseInt((Z.match(/h:(\d+)/)||[])[1])||L.height;L.timeout=parseInt((Z.match(/t:(\d+)/)||[])[1])||L.timeout;if(X.css("position")=="static"){X.css("position","relative")}if(L.width){X.width(L.width)}if(L.height&&L.height!="auto"){X.height(L.height)}if(L.startingSlide){L.startingSlide=parseInt(L.startingSlide)}if(L.random){L.randomMap=[];for(var P=0;P<O.length;P++){L.randomMap.push(P)}L.randomMap.sort(function(d,c){return Math.random()-0.5});L.randomIndex=0;L.startingSlide=L.randomMap[0]}else{if(L.startingSlide>=O.length){L.startingSlide=0}}var R=L.startingSlide||0;T.css({position:"absolute",top:0,left:0}).hide().each(function(a){var b=R?a>=R?O.length-(a-R):R-a:O.length-a;G(this).css("z-index",b)});G(O[R]).css("opacity",1).show();if(G.browser.msie){O[R].style.removeAttribute("filter")}if(L.fit&&L.width){T.width(L.width)}if(L.fit&&L.height&&L.height!="auto"){T.height(L.height)}if(L.containerResize){var U=0,N=0;for(var P=0;P<O.length;P++){var M=G(O[P]),W=M.outerWidth(),Q=M.outerHeight();U=W>U?W:U;N=Q>N?Q:N}X.css({width:U+"px",height:N+"px"})}if(L.pause){X.hover(function(){this.cyclePause++},function(){this.cyclePause--})}var Y=G.fn.cycle.transitions[L.fx];if(G.isFunction(Y)){Y(X,T,L)}else{if(L.fx!="custom"){D("unknown transition: "+L.fx)}}T.each(function(){var a=G(this);this.cycleH=(L.fit&&L.height)?L.height:a.height();this.cycleW=(L.fit&&L.width)?L.width:a.width()});L.cssBefore=L.cssBefore||{};L.animIn=L.animIn||{};L.animOut=L.animOut||{};T.not(":eq("+R+")").css(L.cssBefore);if(L.cssFirst){G(T[R]).css(L.cssFirst)}if(L.timeout){L.timeout=parseInt(L.timeout);if(L.speed.constructor==String){L.speed=G.fx.speeds[L.speed]||parseInt(L.speed)}if(!L.sync){L.speed=L.speed/2}while((L.timeout-L.speed)<250){L.timeout+=L.speed}}if(L.easing){L.easeIn=L.easeOut=L.easing}if(!L.speedIn){L.speedIn=L.speed}if(!L.speedOut){L.speedOut=L.speed}L.slideCount=O.length;L.currSlide=R;if(L.random){L.nextSlide=L.currSlide;if(++L.randomIndex==O.length){L.randomIndex=0}L.nextSlide=L.randomMap[L.randomIndex]}else{L.nextSlide=L.startingSlide>=(O.length-1)?0:L.startingSlide+1}var V=T[R];if(L.before.length){L.before[0].apply(V,[V,V,L,true])}if(L.after.length>1){L.after[1].apply(V,[V,V,L,true])}if(L.click&&!L.next){L.next=L.click}if(L.next){G(L.next).bind("click",function(){return I(O,L,L.rev?-1:1)})}if(L.prev){G(L.prev).bind("click",function(){return I(O,L,L.rev?1:-1)})}if(L.pager){A(O,L)}L.addSlide=function(b,c){var a=G(b),d=a[0];if(!L.autostopCount){L.countdown++}O[c?"unshift":"push"](d);if(L.els){L.els[c?"unshift":"push"](d)}L.slideCount=O.length;a.css("position","absolute");a[c?"prependTo":"appendTo"](X);if(c){L.currSlide++;L.nextSlide++}if(C&&L.cleartype&&!L.cleartypeNoBg){E(a)}if(L.fit&&L.width){a.width(L.width)}if(L.fit&&L.height&&L.height!="auto"){T.height(L.height)}d.cycleH=(L.fit&&L.height)?L.height:a.height();d.cycleW=(L.fit&&L.width)?L.width:a.width();a.css(L.cssBefore);if(L.pager){G.fn.cycle.createPagerAnchor(O.length-1,d,G(L.pager),O,L)}if(typeof L.onAddSlide=="function"){L.onAddSlide(a)}};if(L.timeout||L.continuous){this.cycleTimeout=setTimeout(function(){B(O,L,0,!L.rev)},L.continuous?10:L.timeout+(L.delay||0))}})};function B(O,J,N,P){if(J.busy){return }var M=J.container,R=O[J.currSlide],Q=O[J.nextSlide];if(M.cycleTimeout===0&&!N){return }if(!N&&!M.cyclePause&&((J.autostop&&(--J.countdown<=0))||(J.nowrap&&!J.random&&J.nextSlide<J.currSlide))){if(J.end){J.end(J)}return }if(N||!M.cyclePause){if(J.before.length){G.each(J.before,function(S,T){T.apply(Q,[R,Q,J,P])})}var K=function(){if(G.browser.msie&&J.cleartype){this.style.removeAttribute("filter")}G.each(J.after,function(S,T){T.apply(Q,[R,Q,J,P])})};if(J.nextSlide!=J.currSlide){J.busy=1;if(J.fxFn){J.fxFn(R,Q,J,K,P)}else{if(G.isFunction(G.fn.cycle[J.fx])){G.fn.cycle[J.fx](R,Q,J,K)}else{G.fn.cycle.custom(R,Q,J,K,N&&J.fastOnEvent)}}}if(J.random){J.currSlide=J.nextSlide;if(++J.randomIndex==O.length){J.randomIndex=0}J.nextSlide=J.randomMap[J.randomIndex]}else{var L=(J.nextSlide+1)==O.length;J.nextSlide=L?0:J.nextSlide+1;J.currSlide=L?O.length-1:J.nextSlide-1}if(J.pager){G.fn.cycle.updateActivePagerLink(J.pager,J.currSlide)}}if(J.timeout&&!J.continuous){M.cycleTimeout=setTimeout(function(){B(O,J,0,!J.rev)},F(R,Q,J,P))}else{if(J.continuous&&M.cyclePause){M.cycleTimeout=setTimeout(function(){B(O,J,0,!J.rev)},10)}}}G.fn.cycle.updateActivePagerLink=function(J,K){G(J).find("a").removeClass("activeSlide").filter("a:eq("+K+")").addClass("activeSlide")};function F(N,L,M,K){if(M.timeoutFn){var J=M.timeoutFn(N,L,M,K);if(J!==false){return J}}return M.timeout}function I(J,K,N){var M=K.container,L=M.cycleTimeout;if(L){clearTimeout(L);M.cycleTimeout=0}if(K.random&&N<0){K.randomIndex--;if(--K.randomIndex==-2){K.randomIndex=J.length-2}else{if(K.randomIndex==-1){K.randomIndex=J.length-1}}K.nextSlide=K.randomMap[K.randomIndex]}else{if(K.random){if(++K.randomIndex==J.length){K.randomIndex=0}K.nextSlide=K.randomMap[K.randomIndex]}else{K.nextSlide=K.currSlide+N;if(K.nextSlide<0){if(K.nowrap){return false}K.nextSlide=J.length-1}else{if(K.nextSlide>=J.length){if(K.nowrap){return false}K.nextSlide=0}}}}if(K.prevNextClick&&typeof K.prevNextClick=="function"){K.prevNextClick(N>0,K.nextSlide,J[K.nextSlide])}B(J,K,1,N>=0);return false}function A(K,L){var J=G(L.pager);G.each(K,function(M,N){G.fn.cycle.createPagerAnchor(M,N,J,K,L)});G.fn.cycle.updateActivePagerLink(L.pager,L.startingSlide)}G.fn.cycle.createPagerAnchor=function(M,N,K,L,O){var J=(typeof O.pagerAnchorBuilder=="function")?O.pagerAnchorBuilder(M,N):'<a href="#">'+(M+1)+"</a>";if(!J){return }var P=G(J);if(P.parents("body").length==0){P.appendTo(K)}P.bind(O.pagerEvent,function(){O.nextSlide=M;var R=O.container,Q=R.cycleTimeout;if(Q){clearTimeout(Q);R.cycleTimeout=0}if(typeof O.pagerClick=="function"){O.pagerClick(O.nextSlide,L[O.nextSlide])}B(L,O,1,O.currSlide<M);return false});if(O.pauseOnPagerHover){P.hover(function(){O.container.cyclePause++},function(){O.container.cyclePause--})}};function E(L){function K(M){var M=parseInt(M).toString(16);return M.length<2?"0"+M:M}function J(O){for(;O&&O.nodeName.toLowerCase()!="html";O=O.parentNode){var M=G.css(O,"background-color");if(M.indexOf("rgb")>=0){var N=M.match(/\d+/g);return"#"+K(N[0])+K(N[1])+K(N[2])}if(M&&M!="transparent"){return M}}return"#ffffff"}L.each(function(){G(this).css("background-color",J(this))})}G.fn.cycle.custom=function(U,O,J,L,K){var T=G(U),P=G(O);P.css(J.cssBefore);var M=K?1:J.speedIn;var S=K?1:J.speedOut;var N=K?null:J.easeIn;var R=K?null:J.easeOut;var Q=function(){P.animate(J.animIn,M,N,L)};T.animate(J.animOut,S,R,function(){if(J.cssAfter){T.css(J.cssAfter)}if(!J.sync){Q()}});if(J.sync){Q()}};G.fn.cycle.transitions={fade:function(K,L,J){L.not(":eq("+J.startingSlide+")").css("opacity",0);J.before.push(function(){G(this).show()});J.animIn={opacity:1};J.animOut={opacity:0};J.cssBefore={opacity:0};J.cssAfter={display:"none"};J.onAddSlide=function(M){M.hide()}}};G.fn.cycle.ver=function(){return H};G.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,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,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:0,nowrap:0,fastOnEvent:0}})(jQuery);

