(function(e){e.skdslider=function(t,n){var r={delay:2e3,animationspeed:500,shownav:true,autoslide:true,shownextprev:false,pauseonhover:false,numericnav:false,showplaybutton:false,animationtype:"fading"};if(n){e.extend(r,n)}var i="ontouchstart"in window||window.documenttouch&&document instanceof documenttouch;e(t).wrap('
');var s=e(t).closest("div.skdslider");s.find("ul").addclass("slides");var o=s.find("ul.slides li");var u=0;r.currentslide=0;r.currentstate="pause";r.running=false;if(r.animationtype=="fading"){o.each(function(){e(this).css({position:"absolute",left:"0",top:"0",bottom:"0",right:"0"})})}if(r.animationtype=="sliding"){o.each(function(){e(this).css({"float":"left",display:"block",position:"relative"})});var a=s.outerwidth()*o.size();s.find("ul.slides").css({position:"absolute",left:"0",width:a});o.css({width:s.outerwidth(),height:s.outerheight()});e(window).resize(function(){var e=s.outerwidth()*o.size();s.find("ul.slides").css({position:"absolute",left:"0",width:e});o.css({width:s.outerwidth(),height:s.outerheight()})})}e.skdslider.enabletouch(s,o,r);e.skdslider.createnav(s,o,r);o.eq(u).show();if(r.autoslide==true){r.currentstate="play";r.interval=settimeout(function(){e.skdslider.playslide(s,o,r)},r.delay)}if(r.pauseonhover==true){o.hover(function(){if(r.autoslide==true){r.currentstate="pause";cleartimeout(r.interval)}},function(){if(r.autoslide==true){r.currentstate="play";if(r.autoslide==true)e.skdslider.playslide(s,o,r)}})}};e.skdslider.createnav=function(t,n,r){var s=' ";if(r.shownav==true){t.append(s);var u=t.find(".slide-navs")[0].offsetwidth;u=parseint(u/2);u=-1*u;t.find(".slide-navs").css("margin-left",u);t.find(".slide-navs li").click(function(){index=t.find(".slide-navs li").index(this);targetslide=index;cleartimeout(r.interval);r.currentstate="play";r.running=false;e.skdslider.playslide(t,n,r,targetslide);return false})}if(r.shownextprev==true){var a='';a+='';t.append(a);t.find("a.prev").click(function(){e.skdslider.prev(t,n,r)});t.find("a.next").click(function(){e.skdslider.next(t,n,r)})}if(r.showplaybutton==true){var f=r.currentstate=="play"||r.autoslide==true?'':'';t.append(f);t.hover(function(){t.find("a.play-control").css("display","block")},function(){t.find("a.play-control").css("display","none")});t.find("a.play-control").click(function(){if(r.autoslide==true){cleartimeout(r.interval);r.autoslide=false;r.currentstate="pause";e(this).addclass("play");e(this).removeclass("pause")}else{r.currentstate="play";r.autoslide=true;e(this).addclass("pause");e(this).removeclass("play");if(r.currentslide+1==n.length)targetslide=0;else targetslide=r.currentslide+1;cleartimeout(r.interval);e.skdslider.playslide(t,n,r,targetslide)}return false})}};e.skdslider.next=function(t,n,r){if(r.currentslide+1==n.length)targetslide=0;else targetslide=r.currentslide+1;cleartimeout(r.interval);r.currentstate="play";e.skdslider.playslide(t,n,r,targetslide);return false};e.skdslider.prev=function(t,n,r){if(r.currentslide==0)targetslide=n.length-1;else targetslide=r.currentslide-1;cleartimeout(r.interval);r.currentstate="play";r.running=false;e.skdslider.playslide(t,n,r,targetslide);return true};e.skdslider.prev=function(t,n,r){if(r.currentslide==0)targetslide=n.length-1;else targetslide=r.currentslide-1;cleartimeout(r.interval);r.currentstate="play";r.running=false;e.skdslider.playslide(t,n,r,targetslide);return true};e.skdslider.playslide=function(t,n,r,i){if(r.currentstate=="play"&&r.running==false){t.find(".slide-navs li").removeclass("current-slide");if(typeof i=="undefined"){i=r.currentslide+1==n.length?0:r.currentslide+1}if(r.animationtype=="fading"){r.running=true;n.eq(r.currentslide).fadeout(r.animationspeed);n.eq(i).fadein(r.animationspeed,function(){e.skdslider.removeiefilter(e(this)[0]);r.running=false})}if(r.animationtype=="sliding"){var s=i*t.outerwidth()*-1;r.running=true;t.find("ul.slides").animate({left:s},r.animationspeed,function(){r.running=false})}t.find(".slide-navs li").eq(i).addclass("current-slide");r.currentslide=i}if(r.autoslide==true&&r.currentstate=="play"){r.interval=settimeout(function(){e.skdslider.playslide(t,n,r)},r.delay)}};e.skdslider.enabletouch=function(t,n,r){function a(e){i=e.touches[0].pagex;s=e.touches[0].pagey;t[0].addeventlistener("touchmove",f,false);t[0].addeventlistener("touchend",l,false)}function f(e){e.preventdefault();var t=e.touches[0].pagex;var n=e.touches[0].pagey;o=i-t;u=s-n}function l(i){t[0].removeeventlistener("touchmove",f,false);if(o>0){e.skdslider.next(t,n,r)}else{e.skdslider.prev(t,n,r)}t[0].removeeventlistener("touchend",l,false)}t[0].addeventlistener("touchstart",a,false);var i;var s;var o;var u};e.skdslider.removeiefilter=function(e){if(e.style.removeattribute){e.style.removeattribute("filter")}};e.fn.skdslider=function(t){return this.each(function(){new e.skdslider(this,t)})}})(jquery)