(function($){$.fn.simpleshow=function(options){var opts=$.extend({},$.fn.simpleshow.defaults,options);var $cont=this;var timer=null;$cont.css({position:'relative'});$cont.children().each(function(){$(this).fadeOut(0);$(this).css({position:'absolute',top:0,left:0});});var $first=$cont.children('.active');if($first.length==0)
{$first=$cont.children(':first');$first.addClass('active');}
if(opts.pagination!=null){$(opts.pagination).children(':first').addClass('active');}
$first.fadeIn(0);$.extend(this,{start:function(){if(timer==null){timer=setInterval(function(){_switchSlide($cont,opts);},opts.speed);}},pause:function($cont){clearInterval(timer);timer=null;},next:function(){this.pause();_switchSlide($cont,opts);this.start();},prev:function(){this.pause();_switchSlide($cont,opts,'prev');this.start();},goTo:function(num){this.pause();_switchSlide($cont,opts,null,num);this.start();}});return this;};function _switchSlide($cont,opts,direction,goTo){var direction=(direction==null)?"next":direction;if(opts.pagination!=null){var $contPagi=$(opts.pagination);var $activePagi=$contPagi.children('.active');if(goTo!=null){$nextPagi=$contPagi.children().eq(goTo);}else{if(direction=='next'){$nextPagi=$activePagi.next().length?$activePagi.next():$contPagi.children(':first');}else if(direction=='prev'){$nextPagi=$activePagi.prev().length?$activePagi.prev():$contPagi.children(':last');}}
$activePagi.removeClass('active');$nextPagi.addClass('active');}
var $active=$cont.children('.active');var $next=null;if(goTo!=null){$next=$cont.children().eq(goTo);}else{if(direction=='next'){$next=$active.next().length?$active.next():$cont.children(':first');}else if(direction=='prev'){$next=$active.prev().length?$active.prev():$cont.children(':last');}}
$active.fadeOut(opts.fadeSpeed,function(){$active.removeClass('active');});$next.fadeIn(opts.fadeSpeed,function(){$next.addClass('active');});}
$.fn.simpleshow.defaults={speed:5000,childType:'img',fadeSpeed:1000,pagination:null}})(jQuery);