/*!
 * 	Easy Slider 1.8 - jQuery plugin
 *  
 *  further modified by Adritech Software for Website Realizer
 *   
 *	written by Alen Grakalic (modified by Kyle Florence - kyle.florence@gmail.com)
 *	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
 *
 */
(function(a){a.fn.easySlider=function(c){var e={prevId:"prevBtn",prevText:"Previous",nextId:"nextBtn",nextText:"Next",controlsShow:false,controlsBefore:"",controlsAfter:"",controlsFade:true,insertAfter:true,firstId:"firstBtn",firstText:"First",firstShow:false,lastId:"lastBtn",lastText:"Last",lastShow:false,vertical:false,speed:800,ease:"swing",auto:false,pause:2000,continuous:false,prevNext:true,numeric:false,numericId:"controls",pngbtn:false};var b=a.extend(e,c);var d=false;this.each(function(){var v=a(this);if(a.browser.msie&&(a.browser.version>=5.5)&&(a.browser.version<7)){if(b.pngbtn){d=true}a("a",v).css("display","block")}v.css("overflow","hidden");a("ul,li",v).css({margin:"0",padding:"0","list-style":"none"});var z=v.children("ul");var y=z.children("li");var A=y.length;var o=v.width();var F=v.height();var r=0;var f=A-1;var x=r;var B=true;var l;var g=a("#"+b.prevId);var n=a("#"+b.nextId);var D=a("#"+b.firstId);var u=a("#"+b.lastId);y.each(function(){if(b.vertical){a(this).height(F)}else{a(this).width(o)}});y.css("float","left");if(b.vertical){z.height(A*F)}else{z.width(A*o)}if(b.continuous){r=1;f=f+1;x=r;if(b.vertical){z.prepend(y.filter(":last-child").clone());z.append(y.filter(":nth-child(2)").clone());z.height((A+2)*F)}else{z.prepend(y.filter(":last-child").clone());z.append(y.filter(":nth-child(2)").clone());z.width((A+2)*o)}C()}if(b.controlsShow){var q=b.controlsBefore;if(b.numeric){q+='<ol id="'+b.numericId+'"></ol>'}if(b.firstShow){q+='<span id="'+b.firstId+'"><a href="#">'+b.firstText+"</a></span>"}if(b.prevNext){q+='<span id="'+b.prevId+'"><a href="#">'+b.prevText+"</a></span>";q+='<span id="'+b.nextId+'"><a href="#">'+b.nextText+"</a></span>"}if(b.lastShow){q+='<span id="'+b.lastId+'"><a href="#">'+b.lastText+"</a></span>"}q+=b.controlsAfter;if(b.insertAfter){a(v).after(q)}else{a(v).before(q)}}if(b.numeric){for(var E=0;E<A;E++){a(document.createElement("li")).attr("id",b.numericId+(E+1)).html('<a rel="'+E+'" href="#"><span>'+(E+1)+"</span></a>").appendTo(a("#"+b.numericId)).click(function(){j(a("a",a(this)).attr("rel"),true);return false})}}if(b.prevNext){n.click(function(){j("next",true);return false}).css("cursor","pointer");g.click(function(){j("prev",true);return false}).css("cursor","pointer");D.click(function(){j("first",true);return false}).css("cursor","pointer");u.click(function(){j("last",true);return false}).css("cursor","pointer")}if(b.auto&&b.hoverPause){v.mouseenter(function(){B=true;j("stop",true)}).mouseleave(function(){if(b.continuous){j("next",false);return false}else{j("next",true);return false}})}function k(h){h=parseInt(h,10)+1;a("li","#"+b.numericId).removeClass("current");a("li#"+b.numericId+h).addClass("current")}function C(){if(x>f){x=r}if(x<r){x=f}if(!b.continuous&&b.controlsFade){if(l==f&&x==r){if(d){n.show();u.show()}else{n.fadeIn("slow");u.fadeIn("slow")}}else{if(l==r&&x==f){if(d){g.show();D.show()}else{g.fadeIn("slow");D.fadeIn("slow")}}}}if(!b.vertical){z.css("margin-left",(x*o*-1))}else{z.css("margin-top",(x*F*-1))}B=true;if(b.numeric){k(x)}}function j(h,i){if(B){B=false;l=x;switch(h){case"next":x=(l>=f)?(b.continuous?x+1:f):x+1;break;case"prev":x=(x<=r)?(b.continuous?x-1:r):x-1;break;case"first":x=r;break;case"last":x=f;break;case"stop":x=x;break;default:x=parseInt(h,10);break}var t=Math.abs(l-x);var s=t*b.speed;if(!b.vertical){p=(x*o*-1);z.animate({marginLeft:p},{queue:false,duration:s,easing:b.ease,complete:C})}else{p=(x*F*-1);z.animate({marginTop:p},{queue:false,duration:s,easing:b.ease,complete:C})}if(!b.continuous&&b.controlsFade){if(x==r){if(d){g.hide();D.hide()}else{g.fadeOut("slow");D.fadeOut("slow")}}else{if(x==f){if(d){n.hide();u.hide()}else{n.fadeOut("slow");u.fadeOut("slow")}}else{if(d){g.show();D.show();n.show();u.show()}else{g.fadeIn("slow");D.fadeIn("slow");n.fadeIn("slow");u.fadeIn("slow")}}}}if(i){clearTimeout(m)}if(b.auto&&h=="next"&&!i){m=setTimeout(function(){j("next",false)},t*b.speed+b.pause)}}}var m;if(b.auto){m=setTimeout(function(){j("next",false)},b.pause)}if(b.numeric){k(r)}if(!b.continuous&&b.controlsFade){g.hide();D.hide()}})}})(jQuery);
