(function($){$.fn.easySlider=function(k){var l={prevId:'prevBtn',prevText:'Previous',nextId:'nextBtn',nextText:'Next',controlsShow:true,controlsBefore:'<span id="slider_toolbar">',controlsAfter:'</span>',controlsFade:false,vertical:false,speed:1000,auto:true,pause:4000,continuous:true,};var k=$.extend(l,k);this.each(function(){var f=$(this);var s=$("li",f).length;var w=$("li",f).width();var h=$("li",f).height();f.width(w);f.height(h);f.css("overflow","hidden");var g=s-1;var t=0;$("ul",f).css('width',s*w);if(!k.vertical)$("li",f).css('float','left');if(k.controlsShow){var i=k.controlsBefore;i+=' <span id="'+k.prevId+'"><a title=\"Предущее изображение\" href=\"javascript:void(0);\">'+k.prevText+'</a></span>';i+=' <span id="'+k.nextId+'"><a title=\"Следующее изображение\" href=\"javascript:void(0);\">'+k.nextText+'</a></span>';i+=k.controlsAfter;$(f).after(i)};$("a","#"+k.nextId).click(function(){animate("next",true)});$("a","#"+k.prevId).click(function(){animate("prev",true)});function animate(a,b){var c=t;switch(a){case"next":t=(c>=g)?(k.continuous?0:g):t+1;break;case"prev":t=(t<=0)?(k.continuous?g:0):t-1;break;case"first":t=0;break;case"last":t=g;break;default:break};var d=Math.abs(c-t);var e=d*k.speed;if(!k.vertical){p=(t*w*-1);$("ul",f).animate({marginLeft:p},e)}else{p=(t*h*-1);$("ul",f).animate({marginTop:p},e)};if(!k.continuous&&k.controlsFade){if(t==g){$("a","#"+k.nextId).hide()}else{$("a","#"+k.nextId).show()};if(t==0){$("a","#"+k.prevId).hide()}else{$("a","#"+k.prevId).show()}};if(b)clearTimeout(j);if(k.auto&&a=="next"&&!b){;j=setTimeout(function(){animate("next",false)},d*k.speed+k.pause)}};var j;if(k.auto){;j=setTimeout(function(){animate("next",false)},k.pause)};if(!k.continuous&&k.controlsFade){$("a","#"+k.prevId).hide()}})}})(jQuery);$(function(){$("#slider").easySlider();});$(function(){$("#slider_toolbar").css("opacity","0");$("#slider").hover(function(){$("#slider_toolbar").stop().animate({opacity:1},'slow');},function(){$("#slider_toolbar").stop().animate({opacity:0},'slow');});$("#slider_toolbar").hover(function(){$("#slider_toolbar").stop().animate({opacity:1},'slow');},function(){$("#slider_toolbar").stop().animate({opacity:0},'slow');});});
