/*
 * jQuery Cycle Plugin for light-weight slideshows
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version: 2.10 (02/10/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.1.3.1 or later
 *
 * Based on the work of:
 *  1) Matt Oakes (http://portfolio.gizone.co.uk/applications/slideshow/)
 *  2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
 *  3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
 */
(function(F){var A="2.10";var B=F.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);F.fn.cycle=function(H){return this.each(function(){H=H||{};if(H.constructor==String){switch(H){case"stop":if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;return ;case"pause":this.cyclePause=1;return ;case"resume":this.cyclePause=0;return ;default:H={fx:H}}}var Q=F(this);var N=H.slideExpr?F(H.slideExpr,this):Q.children();var J=N.get();if(J.length<2){return }var I=F.extend({},F.fn.cycle.defaults,H||{},F.metadata?Q.metadata():F.meta?Q.data():{});if(I.autostop){I.countdown=I.autostopCount||J.length}I.before=I.before?[I.before]:[];I.after=I.after?[I.after]:[];I.after.unshift(function(){I.busy=0});if(B&&I.cleartype&&!I.cleartypeNoBg){C(N)}var S=this.className;var P=parseInt((S.match(/w:(\d+)/)||[])[1])||I.width;var M=parseInt((S.match(/h:(\d+)/)||[])[1])||I.height;I.timeout=parseInt((S.match(/t:(\d+)/)||[])[1])||I.timeout;if(Q.css("position")=="static"){Q.css("position","relative")}if(P){Q.width(P)}if(M&&M!="auto"){Q.height(M)}if(I.random){I.randomMap=[];for(var K=0;K<J.length;K++){I.randomMap.push(K)}I.randomMap.sort(function(U,T){return Math.random()-0.5});I.randomIndex=0;I.startingSlide=I.randomMap[0]}else{if(I.startingSlide>=J.length){I.startingSlide=0}}var L=I.startingSlide||0;N.css("position","absolute").hide().each(function(T){var U=L?T>=L?J.length-(T-L):L-T:J.length-T;F(this).css("z-index",U)});F(J[L]).show();if(I.fit&&P){N.width(P)}if(I.fit&&M&&M!="auto"){N.height(M)}if(I.pause){Q.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}var R=F.fn.cycle.transitions[I.fx];if(F.isFunction(R)){R(Q,N,I)}N.each(function(){var T=F(this);this.cycleH=(I.fit&&M)?M:T.height();this.cycleW=(I.fit&&P)?P:T.width()});I.cssBefore=I.cssBefore||{};I.animIn=I.animIn||{};I.animOut=I.animOut||{};N.not(":eq("+L+")").css(I.cssBefore);if(I.cssFirst){F(N[L]).css(I.cssFirst)}if(I.timeout){if(I.speed.constructor==String){I.speed={slow:600,fast:200}[I.speed]||400}if(!I.sync){I.speed=I.speed/2}while((I.timeout-I.speed)<250){I.timeout+=I.speed}}if(I.easing){I.easeIn=I.easeOut=I.easing}if(!I.speedIn){I.speedIn=I.speed}if(!I.speedOut){I.speedOut=I.speed}I.slideCount=J.length;I.currSlide=L;if(I.random){I.nextSlide=I.currSlide;if(++I.randomIndex==J.length){I.randomIndex=0}I.nextSlide=I.randomMap[I.randomIndex]}else{I.nextSlide=I.startingSlide>=(J.length-1)?0:I.startingSlide+1}var O=N[L];if(I.before.length){I.before[0].apply(O,[O,O,I,true])}if(I.after.length>1){I.after[1].apply(O,[O,O,I,true])}if(I.click&&!I.next){I.next=I.click}if(I.next){F(I.next).bind("click",function(){return E(J,I,I.rev?-1:1)})}if(I.prev){F(I.prev).bind("click",function(){return E(J,I,I.rev?1:-1)})}if(I.pager){G(J,I)}if(I.timeout){this.cycleTimeout=setTimeout(function(){D(J,I,0,!I.rev)},I.timeout+(I.delay||0))}})};function D(M,H,L,N){if(H.busy){return }var K=M[0].parentNode,P=M[H.currSlide],O=M[H.nextSlide];if(K.cycleTimeout===0&&!L){return }if(!L&&!K.cyclePause&&((H.autostop&&(--H.countdown<=0))||(H.nowrap&&!H.random&&H.nextSlide<H.currSlide))){return }if(L||!K.cyclePause){if(H.before.length){F.each(H.before,function(Q,R){R.apply(O,[P,O,H,N])})}var I=function(){if(F.browser.msie&&H.cleartype){this.style.removeAttribute("filter")}F.each(H.after,function(Q,R){R.apply(O,[P,O,H,N])})};if(H.nextSlide!=H.currSlide){H.busy=1;if(H.fxFn){H.fxFn(P,O,H,I,N)}else{if(F.isFunction(F.fn.cycle[H.fx])){F.fn.cycle[H.fx](P,O,H,I)}else{F.fn.cycle.custom(P,O,H,I)}}}if(H.random){H.currSlide=H.nextSlide;if(++H.randomIndex==M.length){H.randomIndex=0}H.nextSlide=H.randomMap[H.randomIndex]}else{var J=(H.nextSlide+1)==M.length;H.nextSlide=J?0:H.nextSlide+1;H.currSlide=J?M.length-1:H.nextSlide-1}if(H.pager){F(H.pager).find("a").removeClass("activeSlide").filter("a:eq("+H.currSlide+")").addClass("activeSlide")}}if(H.timeout){K.cycleTimeout=setTimeout(function(){D(M,H,0,!H.rev)},H.timeout)}}function E(H,I,L){var K=H[0].parentNode,J=K.cycleTimeout;if(J){clearTimeout(J);K.cycleTimeout=0}I.nextSlide=I.currSlide+L;if(I.nextSlide<0){if(I.nowrap){return false}I.nextSlide=H.length-1}else{if(I.nextSlide>=H.length){if(I.nowrap){return false}I.nextSlide=0}}if(I.prevNextClick&&typeof I.prevNextClick=="function"){I.prevNextClick(L>0,I.nextSlide,H[I.nextSlide])}D(H,I,1,L>=0);return false}function G(I,J){var H=F(J.pager);F.each(I,function(K,M){var L=(typeof J.pagerAnchorBuilder=="function")?F(J.pagerAnchorBuilder(K,M)):F('<a href="#">'+(K+1)+"</a>");if(L.parents("body").length==0){L.appendTo(H)}L.bind("click",function(){J.nextSlide=K;var O=I[0].parentNode,N=O.cycleTimeout;if(N){clearTimeout(N);O.cycleTimeout=0}if(typeof J.pagerClick=="function"){J.pagerClick(J.nextSlide,I[J.nextSlide])}D(I,J,1,!J.rev);return false})});H.find("a").filter("a:eq("+J.startingSlide+")").addClass("activeSlide")}function C(J){function I(K){var K=parseInt(K).toString(16);return K.length<2?"0"+K:K}function H(M){for(;M&&M.nodeName.toLowerCase()!="html";M=M.parentNode){var K=F.css(M,"background-color");if(K.indexOf("rgb")>=0){var L=K.match(/\d+/g);return"#"+I(L[0])+I(L[1])+I(L[2])}if(K&&K!="transparent"){return K}}return"#ffffff"}J.each(function(){F(this).css("background-color",H(this))})}F.fn.cycle.custom=function(N,K,L,H){var M=F(N),J=F(K);J.css(L.cssBefore);var I=function(){J.animate(L.animIn,L.speedIn,L.easeIn,H)};M.animate(L.animOut,L.speedOut,L.easeOut,function(){if(L.cssAfter){M.css(L.cssAfter)}if(!L.sync){I()}});if(L.sync){I()}};F.fn.cycle.transitions={fade:function(I,J,H){J.not(":eq("+H.startingSlide+")").css("opacity",0);H.before.push(function(){F(this).show()});H.animIn={opacity:1};H.animOut={opacity:0};H.cssAfter={display:"none"}}};F.fn.cycle.ver=function(){return A};F.fn.cycle.defaults={fx:"fade",timeout:4000,speed:1000,speedIn:null,speedOut:null,click:null,next:null,prev:null,prevNextClick:null,pager:null,pagerClick:null,pagerAnchorBuilder:null,before:null,after: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,delay:0,slideExpr:null,cleartype:0,nowrap:0}})(jQuery);jQuery.fn.cycle.transitions.scrollUp=function(B,C,A){B.css("overflow","hidden");A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.top=D.offsetHeight;E.animOut.top=0-F.offsetHeight});A.cssFirst={top:0};A.animIn={top:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.scrollDown=function(B,C,A){B.css("overflow","hidden");A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.top=0-D.offsetHeight;E.animOut.top=F.offsetHeight});A.cssFirst={top:0};A.animIn={top:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.scrollLeft=function(B,C,A){B.css("overflow","hidden");A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.left=D.offsetWidth;E.animOut.left=0-F.offsetWidth});A.cssFirst={left:0};A.animIn={left:0}};jQuery.fn.cycle.transitions.scrollRight=function(B,C,A){B.css("overflow","hidden");A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.left=0-D.offsetWidth;E.animOut.left=F.offsetWidth});A.cssFirst={left:0};A.animIn={left:0}};jQuery.fn.cycle.transitions.scrollHorz=function(B,C,A){B.css("overflow","hidden").width();A.before.push(function(H,F,G,E){jQuery(this).show();var D=H.offsetWidth,I=F.offsetWidth;G.cssBefore=E?{left:I}:{left:-I};G.animIn.left=0;G.animOut.left=E?-D:D;C.not(H).css(G.cssBefore)});A.cssFirst={left:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.scrollVert=function(B,C,A){B.css("overflow","hidden");A.before.push(function(I,F,G,E){jQuery(this).show();var H=I.offsetHeight,D=F.offsetHeight;G.cssBefore=E?{top:-D}:{top:D};G.animIn.top=0;G.animOut.top=E?H:-H;C.not(I).css(G.cssBefore)});A.cssFirst={top:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.slideX=function(B,C,A){A.animIn={width:"show"};A.animOut={width:"hide"}};jQuery.fn.cycle.transitions.slideY=function(B,C,A){A.animIn={height:"show"};A.animOut={height:"hide"}};jQuery.fn.cycle.transitions.shuffle=function(D,E,C){var A=D.css("overflow","visible").width();E.css({left:0,top:0});C.before.push(function(){jQuery(this).show()});C.speed=C.speed/2;C.random=0;C.shuffle=C.shuffle||{left:-A,top:15};C.els=[];for(var B=0;B<E.length;B++){C.els.push(E[B])}for(var B=0;B<C.startingSlide;B++){C.els.push(C.els.shift())}C.fxFn=function(K,I,J,F,H){var G=H?jQuery(K):jQuery(I);G.animate(J.shuffle,J.speedIn,J.easeIn,function(){H?J.els.push(J.els.shift()):J.els.unshift(J.els.pop());if(H){for(var M=0,L=J.els.length;M<L;M++){jQuery(J.els[M]).css("z-index",L-M)}}else{var N=jQuery(K).css("z-index");G.css("z-index",parseInt(N)+1)}G.animate({left:0,top:0},J.speedOut,J.easeOut,function(){jQuery(H?this:K).hide();if(F){F()}})})}};jQuery.fn.cycle.transitions.turnUp=function(B,C,A){A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.top=D.cycleH;E.animIn.height=D.cycleH});A.cssFirst={top:0};A.cssBefore={height:0};A.animIn={top:0};A.animOut={height:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.turnDown=function(B,C,A){A.before.push(function(F,D,E){jQuery(this).show();E.animIn.height=D.cycleH;E.animOut.top=F.cycleH});A.cssFirst={top:0};A.cssBefore={top:0,height:0};A.animOut={height:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.turnLeft=function(B,C,A){A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore.left=D.cycleW;E.animIn.width=D.cycleW});A.cssBefore={width:0};A.animIn={left:0};A.animOut={width:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.turnRight=function(B,C,A){A.before.push(function(F,D,E){jQuery(this).show();E.animIn.width=D.cycleW;E.animOut.left=F.cycleW});A.cssBefore={left:0,width:0};A.animIn={left:0};A.animOut={width:0};A.cssAfter={display:"none"}};jQuery.fn.cycle.transitions.zoom=function(B,C,A){A.cssFirst={top:0,left:0};A.cssAfter={display:"none"};A.before.push(function(F,D,E){jQuery(this).show();E.cssBefore={width:0,height:0,top:D.cycleH/2,left:D.cycleW/2};E.animIn={top:0,left:0,width:D.cycleW,height:D.cycleH};E.animOut={width:0,height:0,top:F.cycleH/2,left:F.cycleW/2}})};jQuery.fn.cycle.transitions.fadeZoom=function(B,C,A){A.before.push(function(F,D,E){E.cssBefore={width:0,height:0,opacity:1,left:D.cycleW/2,top:D.cycleH/2,zIndex:1};E.animIn={top:0,left:0,width:D.cycleW,height:D.cycleH}});A.animOut={opacity:0};A.cssAfter={zIndex:0}};
