(function($){$.fn.jSimpleGallery=function(o){o=$.extend({btnPrev:null,btnNext:null,auto:3000},o||{});return this.each(function(){var intervalId=null;var div=$(this);var its=$("ul li",div);its.hide();var curr=0;if(its.length>0){$(its[0]).show();startAuto();}
$(o.btnNext).hide();$(o.btnPrev).hide();div.bind("mouseenter",function(){$(o.btnPrev).show();$(o.btnNext).show();stopAuto();});div.bind("mouseleave",function(){$(o.btnNext).hide();$(o.btnPrev).hide();startAuto();});if(o.btnPrev){$(o.btnPrev).click(function(){return go(curr-1);});}
if(o.btnNext)
$(o.btnNext).click(function(){return go(curr+1);});function startAuto(){stopAuto();intervalId=setTimeout(function(){go1(curr+1);},o.auto);}
function stopAuto(){if(intervalId!=null){clearTimeout(intervalId);intervalId=null;}}
function go1(to){go(to);startAuto();}
function go(to){$(its[curr]).fadeOut(1000,function(){curr=to;if(curr>=its.length)curr=0;if(curr<0)curr=its.length-1;$(its[curr]).fadeIn(1000);});return false;};});};})(jQuery);