(function($){$.fn.slider=function(o){return this.each(function(){var p=this;if(!h.lock){return $(function(){return new h(p,o)})}else{return $(this)}})};var g={effect:'swing',items:'.items',next:'.next',prev:'.prev',play:'.play',pause:'.pause',preloader:'.preloader',navigator:'.navigator',loader:{image:'img/loader.gif',top:'50%',left:'50%',background:'#fff',width:32,height:32,frame:false},width:0,height:0,step:1,copy:1,speed:1000,interval:3000,autoscroll:true,autoplay:true,autopause:true,circular:true,vertical:false,fade:false,onCreate:function(){},onPlay:function(){},onPause:function(){},onChange:function(){},onMove:function(){}};$.slider=function(e,o){this.options=$.extend({},g,o||{});this.headElement=e;this.lock=true;this.ready=false;this.setup();return $};var h=$.slider;h.fn=h.prototype={slider:'2.1.3-effects'};h.fn.extend=h.extend=$.extend;h.fn.extend({setup:function(){var a=this;this.index=0;this.items=$(this.headElement).find(this.options.items);this.elements=$(this.items).children();if(this.elements.length<2){return false}this.tag=this.elements[0].tagName;this.options.onCreate(this);this.prevElement=$(this.headElement).find(this.options.prev);this.nextElement=$(this.headElement).find(this.options.next);this.playElement=$(this.headElement).find(this.options.play);this.pauseElement=$(this.headElement).find(this.options.pause);this.navigationElement=$(this.headElement).find(this.options.navigator);this.items.css({position:'absolute',width:'20000em',left:0,top:0});this.elements.css('float','left');$(this.elements[0]).addClass('active');if(this.options.fade==true){$(this.elements[0]).css({zIndex:3})}if(this.options.preloader!=false){this.preloader()}else{this.ready=true}if(!$(this.headElement).attr('id')){$(this.headElement).attr('id','jQuerySlider_'+this.randomChar())}$(this.prevElement).click(function(){a.prev();return false});$(this.nextElement).click(function(){a.next();return false});$(this.playElement).click(function(){a.play();return false});$(this.pauseElement).click(function(){a.pause(true);return false});this.navigation();this.circular();this.autoscroll(true);this.disable(0);return this},randomChar:function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",string_length=8,randomstring='';for(var i=0;i<string_length;i++){var b=Math.floor(Math.random()*a.length);randomstring+=a.substring(b,b+1)}return randomstring},preloader:function(){var d=this,loader=this.options.loader,preloader=$(this.headElement).children(this.options.preloader),frame=(typeof loader=='object'&&loader.frame)?((typeof loader.frame=='function')?loader.frame(d):loader.frame):false;if(!preloader.tag){preloader=$('<div/>').addClass(this.options.preloader.substr(1,this.options.preloader.length-1)).prependTo($(this.headElement));if(frame!=false){preloader.css('background','url('+frame+') top left no-repeat')}$('<div/>').addClass('background').css({width:$(d.headElement).width(),height:$(d.headElement).height(),background:((typeof loader=='object'&&loader.background)?loader.background:'#fff'),opacity:0.7}).prependTo(preloader);if(typeof loader=='object'){var f=((loader.width)?loader.width:false),l_height=((loader.height)?loader.height:false),l_background=((loader.image)?loader.image:false),l_top=((loader.top)?loader.top:false),l_left=((loader.left)?loader.left:false),l_marginLeft=((f)?-1*Math.floor(f/2):false),l_marginTop=((l_height)?-1*Math.floor(l_height/2):false)}$('<div/>').addClass('loader').css({width:(f)?f:32,height:(l_height)?l_height:32,position:'absolute',left:(l_left)?l_left:'50%',top:(l_top)?l_top:'50%',marginLeft:(l_marginLeft)?l_marginLeft:-16,marginTop:(l_marginTop)?l_marginTop:-16,background:'url('+((l_background)?l_background:'img/loader.gif')+') top left no-repeat'}).appendTo(preloader)}$(this.items).hide();$(window).bind('load',function(){var b=new Array();var c=d.elements;if(d.tag!='IMG'){c=d.elements.find('img')}c.each(function(){b.push($(this).attr("src"))});if(b.length>0){$.each(b,function(){var a=document.createElement('img');$(a).bind('load',function(){if(b[0]){this.src=b.shift()}}).trigger('load');if(b.length==0){preloader.hide();$(d.items).show();var e=d.elements,m=(d.options.circular==true)?1:0;d.options.width=e.outerWidth(true);d.options.height=e.outerHeight(true);if(d.options.vertical==false&&d.options.fade!=true){d.items.css({width:d.options.width*(d.elements.length+m),height:d.options.height})}else if(d.options.fade!=true){d.items.css({width:d.options.width,height:d.options.height*(d.elements.length+m)})}else{d.items.css({width:d.options.width,height:d.options.height});d.items.children().css({position:'absolute',top:0,left:0})}d.ready=true}})}else{d.ready=true}})},navigation:function(){if(this.options.navigator!=false){var c=this,e=this.navigationElement;e.text('');this.elements.each(function(i){var b=c.headElement.id+'_seek',a=$('<a/>').addClass(b).attr({href:'#',rel:i}).text(i+1).click(function(){c.goTo($(this).attr('rel'));return false});if(i==0)a.addClass('active');e.append(a)})}},circular:function(){if(this.options.circular==true&&this.options.fade!=true&&this.options.copy>0){for(i=0;i<this.options.copy;++i){var e=$(this.elements[i]);e.clone(true).addClass('clone').removeClass('active').appendTo(this.items)}this.elements=$(this.items).children()}},autoscroll:function(n){if(this.options.autoscroll==true&&this.options.autoplay){var a=this;if(this.timer){this.timer=window.clearInterval(this.timer)}this.timer=window.setInterval(function(){a.move()},this.options.interval);if(this.options.autopause==true&&n==true){$(this.items).bind('mouseenter',function(){a.pause()}).bind('mouseleave',function(){if(a.stop!=true){a.play()}})}}},seek:function(i){var e,parent=this;this.options.onChange(this);if(this.options.fade!=true){if(i<0){i=this.index=this.elements.length-this.options.copy;this.items.css({left:-$(this.elements[this.index]).position().left,top:-$(this.elements[this.index]).position().top})}}this.disable(i);if(this.ready==true){if(this.index>i){this.revers=true;this.index=i}else{this.revers=false;this.index=this.index+1}if(this.options.fade!=true){e=$(this.elements[i])}else{if(i>=this.elements.length){this.index=i=0}e=$(this.elements[i])}if(this.options.vertical==false&&this.options.fade!=true){this.items.animate({left:-e.position().left},parent.options.speed,parent.options.effect,function(){parent.callback();parent.options.onMove(i,this,parent)})}else if(this.options.fade!=true){this.items.animate({top:-e.position().top},parent.options.speed,parent.options.effect,function(){parent.callback();parent.options.onMove(i,this,parent)})}else if(this.options.fade==true){var p=$(this.elements[((i!=0)?(i-1):(this.elements.length-1))]);p.addClass('last-active').css('zIndex',2);e.addClass('active').css({opacity:0,zIndex:3}).animate({opacity:1},parent.options.speed,parent.options.effect,function(){p.removeClass('active last-active').css('zIndex',1);parent.callback();parent.options.onMove(i,this,parent)})}}},disable:function(i){if(i<1&&!this.options.circular){this.prevElement.addClass('disable')}else if(this.prevElement.hasClass('disable')){this.prevElement.removeClass('disable')}if(i>=this.elements.length-this.options.copy&&!this.options.circular){this.nextElement.addClass('disable')}else if(this.nextElement.hasClass('disable')){this.nextElement.removeClass('disable')}},callback:function(){var a=this;if(this.options.fade!=true&&(this.index>=this.elements.length||this.index<0||this.index==this.elements.length-this.options.copy)){this.index=0;this.items.css({left:0,top:0})}if(this.options.navigator!=false){this.navigationElement.children('a').removeClass('active');this.navigationElement.children('a.'+this.headElement.id+'_seek[rel='+this.index+']').addClass('active');this.items.children().removeClass('active');var b=this.items.children();$(b[a.index]).addClass('active')}this.disable(this.index)},move:function(){this.seek(this.index+this.options.step)},next:function(){var a=this;if(this.options.autoscroll==true&&this.options.autoplay==true&&this.stop!=true){this.pause();setTimeout(function(){a.play()},this.options.interval)}this.seek(this.index+1)},prev:function(){var a=this;if(this.options.autoscroll==true&&this.options.autoplay==true&&this.stop!=true){this.pause();setTimeout(function(){a.play()},this.options.interval)}if(this.options.circular&&this.index==0){var b=this.options.speed;this.options.speed=0;this.seek(this.elements.length-this.options.copy);this.options.speed=b;this.seek(this.elements.length-this.options.copy-1)}else if(this.index!=0){this.seek(this.index-1)}},goTo:function(i){this.index=i-1;var a=this;if(this.options.autoscroll==true&&this.options.autoplay==true&&this.stop!=true){this.pause();setTimeout(function(){a.play()},this.options.interval)}this.seek(i)},play:function(){this.options.autoplay=true;this.options.autoscroll=true;this.options.onPlay(this);this.stop=false;this.autoscroll()},pause:function(o){this.options.onPause(this);if(this.options.autoscroll==true){this.timer=window.clearInterval(this.timer)}if(o==true){this.stop=true}}});h.extend({defaults:function(d){return $.extend(g,d||{})},intval:function(v){v=parseInt(v);return isNaN(v)?0:v},version:h.prototype.slider});$.extend($.easing,{QuadIn:function(x,t,b,c,d){return c*(t/=d)*t+b},QuadOut:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},QuadInOut:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},CubicIn:function(x,t,b,c,d){return c*(t/=d)*t*t+b},CubicOut:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},CubicInOut:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},QuartIn:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},QuartOut:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},QuartInOut:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},QuintIn:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},QuintOut:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},QuintInOut:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},SineIn:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},SineOut:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},SineInOut:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},ExpoIn:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},ExpoOut:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},ExpoInOut:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},CircIn:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},CircOut:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},CircInOut:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},ElasticIn:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;s=p/4}else s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},ElasticOut:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;s=p/4}else s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},ElasticInOut:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;s=p/4}else s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},BackIn:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},BackOut:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},BackInOut:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},BounceIn:function(x,t,b,c,d){return c-$.easing.BounceOut(x,d-t,0,c,d)+b},BounceOut:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},BounceInOut:function(x,t,b,c,d){if(t<d/2)return $.easing.BounceIn(x,t*2,0,c,d)*.5+b;return $.easing.BounceOut(x,t*2-d,0,c,d)*.5+c*.5+b}})})(jQuery);
