(function(a){a.fn.orbit=function(b){var c={animation:"horizontal-slide",animationSpeed:1e3,timer:true,advanceSpeed:6e3,pauseOnHover:false,startClockOnMouseOut:false,startClockOnMouseOutAfter:1e3,afterSlideChange:function(){}};var b=a.extend(c,b);return this.each(function(){function x(a){function i(){j.eq(f).css({"z-index":1});k();b.afterSlideChange.call(this)}var f=c,h=a;if(f==h){return false}if(j.length=="1"){return false}if(!g){l();if(a=="next"){c++;if(c==d){c=0}}else if(a=="prev"){c--;if(c<0){c=d-1}}else{c=a;if(f<c){h="next"}else if(f>c){h="prev"}}j.eq(f).css({"z-index":2});if(b.animation=="fade"){j.eq(c).css({opacity:0,"z-index":3}).animate({opacity:1},b.animationSpeed,i)}if(b.animation=="horizontal-slide"){if(h=="next"){j.eq(f).css({left:0,opacity:1,"z-index":2}).animate({left:-e,opacity:0},b.animationSpeed,i);j.eq(c).css({left:e,opacity:1,"z-index":3}).animate({left:0},b.animationSpeed,i)}}if(b.animation=="horizontal-push"){if(h=="next"){j.eq(c).css({left:e,opacity:1,"z-index":3}).animate({left:0},b.animationSpeed,i);j.eq(f).animate({left:-e},b.animationSpeed)}}}}function n(){if(!b.timer||b.timer=="false"){return false}else{q=false;clearInterval(v);t.addClass("active")}}function m(){if(!b.timer||b.timer=="false"){return false}else if(p.is(":hidden")){v=setInterval(function(a){x("next")},b.advanceSpeed)}else{q=true;t.removeClass("active");v=setInterval(function(a){var b="rotate("+u+"deg)";u+=2;r.css({"-webkit-transform":b,"-moz-transform":b,"-o-transform":b});if(u>180){r.addClass("move");s.addClass("move")}if(u>360){r.removeClass("move");s.removeClass("move");u=0;x("next")}},b.advanceSpeed/180)}}function l(){g=true}function k(){g=false}var c=0,d=0,e,f,g;var h=a(this).addClass("orbit"),i=h.wrap('<div class="orbit-wrapper" />').parent();h.add(e).width("1px").height("1px");var j=h.children("img, a, div");j.each(function(){var b=a(this),c=b.width(),g=b.height();if(c>h.width()){h.add(i).width(c);e=h.width()}if(g>h.height()){h.add(i).height(g);f=h.height()}j.css({opacity:0});d++});if(j.length==1){b.timer=false}j.eq(c).css({"z-index":3,opacity:1}).fadeIn(function(){j.css({display:"block"})});if(b.timer){var o='<div class="timer"><span class="mask"><span class="rotator"></span></span><span class="pause"></span></div>';i.append(o);var p=a("div.timer"),q;if(p.length!=0){var r=a("div.timer span.rotator"),s=a("div.timer span.mask"),t=a("div.timer span.pause"),u=0,v;m();p.click(function(){if(!q){m()}else{n()}});if(b.startClockOnMouseOut){var w;i.mouseleave(function(){w=setTimeout(function(){if(!q){m()}},b.startClockOnMouseOutAfter)});i.mouseenter(function(){clearTimeout(w)})}}}if(b.pauseOnHover){i.mouseenter(function(){n()})}})}})(jQuery)
