/* * jQuery Cycle Lite Plugin * http://malsup.com/jquery/cycle/lite/ * Copyright (c) 2008-2011 M. Alsup * Version: 1.3.1 (07-OCT-2011) * 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.3.2 or later */ (function(d){var a="Lite-1.3";d.fn.cycle=function(e){return this.each(function(){e=e||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var l=d(this);var i=e.slideExpr?d(e.slideExpr,this):l.children();var g=i.get();if(g.length<2){window.console&&console.log("terminating; too few slides: "+g.length);return}var f=d.extend({},d.fn.cycle.defaults,e||{},d.metadata?l.metadata():d.meta?l.data():{});var m=d.isFunction(l.data)?l.data(f.metaAttr):null;if(m){f=d.extend(f,m)}f.before=f.before?[f.before]:[];f.after=f.after?[f.after]:[];f.after.unshift(function(){f.busy=0});var n=this.className;f.width=parseInt((n.match(/w:(\d+)/)||[])[1])||f.width;f.height=parseInt((n.match(/h:(\d+)/)||[])[1])||f.height;f.timeout=parseInt((n.match(/t:(\d+)/)||[])[1])||f.timeout;if(l.css("position")=="static"){l.css("position","relative")}if(f.width){l.width(f.width)}if(f.height&&f.height!="auto"){l.height(f.height)}var h=0;i.css({position:"absolute",top:0,left:0}).each(function(o){d(this).css("z-index",g.length-o)});d(g[h]).css("opacity",1).show();if(d.browser.msie){g[h].style.removeAttribute("filter")}if(f.fit&&f.width){i.width(f.width)}if(f.fit&&f.height&&f.height!="auto"){i.height(f.height)}if(f.pause){l.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}var j=d.fn.cycle.transitions[f.fx];j&&j(l,i,f);i.each(function(){var o=d(this);this.cycleH=(f.fit&&f.height)?f.height:o.height();this.cycleW=(f.fit&&f.width)?f.width:o.width()});if(f.cssFirst){d(i[h]).css(f.cssFirst)}if(f.timeout){if(f.speed.constructor==String){f.speed={slow:600,fast:200}[f.speed]||400}if(!f.sync){f.speed=f.speed/2}while((f.timeout-f.speed)<250){f.timeout+=f.speed}}f.speedIn=f.speed;f.speedOut=f.speed;f.slideCount=g.length;f.currSlide=h;f.nextSlide=1;var k=i[h];if(f.before.length){f.before[0].apply(k,[k,k,f,true])}if(f.after.length>1){f.after[1].apply(k,[k,k,f,true])}if(f.click&&!f.next){f.next=f.click}if(f.next){d(f.next).bind("click",function(){return c(g,f,f.rev?-1:1)})}if(f.prev){d(f.prev).bind("click",function(){return c(g,f,f.rev?1:-1)})}if(f.timeout){this.cycleTimeout=setTimeout(function(){b(g,f,0,!f.rev)},f.timeout+(f.delay||0))}})};function b(j,e,i,k){if(e.busy){return}var h=j[0].parentNode,n=j[e.currSlide],l=j[e.nextSlide];if(h.cycleTimeout===0&&!i){return}if(i||!h.cyclePause){if(e.before.length){d.each(e.before,function(p,q){q.apply(l,[n,l,e,k])})}var f=function(){if(d.browser.msie){this.style.removeAttribute("filter")}d.each(e.after,function(p,q){q.apply(l,[n,l,e,k])});m()};if(e.nextSlide!=e.currSlide){e.busy=1;d.fn.cycle.custom(n,l,e,f)}var g=(e.nextSlide+1)==j.length;e.nextSlide=g?0:e.nextSlide+1;e.currSlide=g?j.length-1:e.nextSlide-1}function m(){if(e.timeout){h.cycleTimeout=setTimeout(function(){b(j,e,0,!e.rev)},e.timeout)}}}function c(e,f,i){var h=e[0].parentNode,g=h.cycleTimeout;if(g){clearTimeout(g);h.cycleTimeout=0}f.nextSlide=f.currSlide+i;if(f.nextSlide<0){f.nextSlide=e.length-1}else{if(f.nextSlide>=e.length){f.nextSlide=0}}b(e,f,1,i>=0);return false}d.fn.cycle.custom=function(k,h,i,e){var j=d(k),g=d(h);g.css(i.cssBefore);var f=function(){g.animate(i.animIn,i.speedIn,i.easeIn,e)};j.animate(i.animOut,i.speedOut,i.easeOut,function(){j.css(i.cssAfter);if(!i.sync){f()}});if(i.sync){f()}};d.fn.cycle.transitions={fade:function(f,g,e){g.not(":eq(0)").hide();e.cssBefore={opacity:0,display:"block"};e.cssAfter={display:"none"};e.animOut={opacity:0};e.animIn={opacity:1}},fadeout:function(f,g,e){e.before.push(function(k,i,j,h){d(k).css("zIndex",j.slideCount+(h===true?1:0));d(i).css("zIndex",j.slideCount+(h===true?0:1))});g.not(":eq(0)").hide();e.cssBefore={opacity:1,display:"block",zIndex:1};e.cssAfter={display:"none",zIndex:0};e.animOut={opacity:0}}};d.fn.cycle.ver=function(){return a};d.fn.cycle.defaults={animIn:{},animOut:{},fx:"fade",after:null,before:null,cssBefore:{},cssAfter:{},delay:0,fit:0,height:"auto",metaAttr:"cycle",next:null,pause:0,prev:null,speed:1000,slideExpr:null,sync:1,timeout:4000}})(jQuery);