/*Easy Slider 1.7 - jQuery plugin written by Alen Grakalic	
http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
Built for jQuery library http://jquery.com
Modifed 22nd Movember 2010 by Jake Nicholson (eskdale.net)-Less whitespace, different functionality, best not use this*/
(function($){$.fn.easySlider = function(options){var defaults = {prevId:'slider1prev',prevText:'Previous',nextId:'slider1next',nextText:'Next',controlsShow:true,controlsBefore:'',controlsAfter:'',controlsFade:true,firstId:'firstBtn',firstText:'First',firstShow:false,lastId:'lastBtn',lastText:'Last',lastShow:false,vertical:false,speed:1500,auto:true,pause:3000,showMultiple:true,showCount:4,fadeImage:true};var options = $.extend(defaults, options);this.each(function(){var obj = $(this);var s = $("li", obj).length;var w = $("li", obj).width();var h = $("li", obj).height();var clickable = true;obj.width(w);obj.height(h);obj.css("overflow","visible");var t = 0;$('div#slider ul:first-child > li').hover(function(){$(this).find('img').stop(true, true).fadeTo(200, 0.6);$(this).find('div.slideNote').stop(true, true).fadeIn(200);}, function(){$(this).find('img').stop(true, true).fadeTo(800, 1);$(this).find('div.slideNote').stop(true, true).fadeOut(800);});$('div#slider ul:first-child > li div.slideNote').hide();$('#slider .noteBox').css('-webkit-border-radius', '10px').css('-moz-border-radius', '10px').css('border-radius', '10px');var ts = 3;$("ul", obj).css('width',9*w).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+w+"px")).append($("ul li:nth-child(2)", obj).clone());var html = options.controlsBefore;html+= '<span id="'+options.prevId+'"><a href=\"javascript:void(0);\">'+options.prevText+'</a></span>';html+='<span id="'+options.nextId+'"><a href=\"javascript:void(0);\">'+options.nextText+'</a></span>';html+= options.controlsAfter;$(obj).after(html);$("a","#"+options.nextId).click(function(){animate("next",true);});$("a","#"+options.prevId).click(function(){animate("prev",true);});$("a","#"+options.firstId).click(function(){animate("first",true);});$("a","#"+options.lastId).click(function(){animate("last",true);});function setCurrent(i){i = parseInt(i)+1;};function adjust(){if(t>ts) t=0;if(t<0) t=ts;$("ul",obj).css("margin-left",(t*w*-1));clickable = true;};function animate(dir,clicked){if(clickable){clickable = false;var ot = t;switch(dir){case "next":t = (ot>=ts) ? (options.showMultiple ? t+1:ts):t+1;break;case "prev":t = (t<=0) ? (options.showMultiple ? t-1:0):t-1;break;case "first":t = 0;break;case "last":t = ts;break;default:t = dir;break;};var diff = Math.abs(ot-t);var speed = diff*options.speed;var p = (t*w*-1);$("ul",obj).animate({marginLeft:p},{queue:false,duration:speed,complete:adjust});if(clicked) setTimeout(3000);if(dir=="next"){;timeout = setTimeout(function(){animate("next",false);},4500);};};};var timeout = setTimeout(function(){animate("next",false);},3000);});};})(jQuery);
