/*
 * 	Easy Slider - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
 *
 *	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($){$.fn.easySlider=function(options){var defaults={prevId:'prevBtn',prevText:'Previous',nextId:'nextBtn',nextText:'Next',orientation:'',speed:300,offset:0};var options=$.extend(defaults,options);var vars=[],hash;var hashes=window.location.href.slice(window.location.href.indexOf('?')+1).split('&');for(var i=0;i<hashes.length;i++){hash=hashes[i].split('=');vars.push(hash[0]);vars[hash[0]]=hash[1];}
var lock=false;this.each(slide);$(window).load(function(){if('n' in vars&&vars.n>1&&$("ul > li",obj).length>=vars.n){var w=0;for(var i=0;i<vars.n-1;i++){w+=$("ul > li",obj)[i].clientWidth;}
$("ul",obj).animate({marginLeft:w*-1},{duration:options.speed,easing:"easeOutExpo"});}});function slide(){obj=$(this);var s=$("ul > li",obj).length;var w=obj.width();var h=obj.height();var ts=s-1;var t=0;var vertical=(options.orientation=='vertical');$("ul",obj).css('width',s*w);$(obj).after('<span id="'+options.prevId+'"><a href=\"javascript:void(0);\">'+'<img src=\"images/prev.png\">'+'</a></span> <span id="'+options.nextId+'"><a href=\"javascript:void(0);\">'+'<img src=\"images/next.png\">'+'</a></span>');$("a","#"+options.prevId).hide();$("a","#"+options.nextId).hide();if('n' in vars&&vars.n>1&&s>=vars.n){t=vars.n-1;if(vars.n>1)$("a","#"+options.prevId).fadeIn();}
$("a","#"+options.nextId).click(function(){if(lock)return;animate("next");if(t>=ts)$(this).fadeOut();$("a","#"+options.prevId).fadeIn();});$("a","#"+options.prevId).click(function(){if(lock)return;animate("prev");if(t<=0)$(this).fadeOut();$("a","#"+options.nextId).fadeIn();});function animate(dir){lock=true;if(dir=="next"){t=(t>=ts)?ts:t+1;}else{t=(t<=0)?0:t-1;};if(!vertical){var pl=parseInt($("ul",obj).css("margin-left"));var pn=(dir=="next")?1:-1;var pt=(dir=="next")?t-1:t;w=$("ul > li",obj)[pt].clientWidth;p=(pl+(w*pn*-1));if(pt==0)p=p-(options.offset*pn);if(t==0)p=0;$("ul",obj).animate({marginLeft:p},{duration:options.speed,easing:"easeOutExpo",complete:function(){lock=false;}});}else{p=(t*h*-1);$("ul",obj).animate({marginTop:p},{duration:options.speed,easing:"easeOutExpo",complete:function(){lock=false;}});}};if(s>1&&s>t+1)$("a","#"+options.nextId).fadeIn();}};})(jQuery);
