/* ArtSlide v0.3 - A light-weight, customizable lightbox plugin for jQuery
 *
 * Copyright (c) 2011 Sergio Toro - sergio@art4websites.com
 * Pluguin url: http://blog.art4websites.com/artslide-simple-slideshow-para-jquery/
 *
 * Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
 */
(function(a){a.fn.artslide=function(b){var c={speed:500,transitionInterval:7500,width:function(){var b=a("> *",this).width();return b?b:a(this).width()},height:function(){var b=a("> *",this).height();return b?b:a(this).height()},navLinks:true,prevControl:true,prevText:"«",nextControl:true,nextText:"»"};return this.each(function(){function A(){v.show();u.show();t.show();a("div.as-cont",e).removeClass("as-loading")}var d=c;if(b)a.extend(true,c,b);var e=a(this);var f=a("> *",e);if(f.length==0)return;var g=a.type(c.width)==="function"?c.width.apply(this,arguments):parseInt(c.width);var h=a.type(c.height)==="function"?c.height.apply(this,arguments):parseInt(c.height);var i;var j=true;if(!g)g=d.width();if(!h)h=d.height();var k=g*f.length;var l=c.prevControl?'<a href="javascript:;" data-type="previous" class="as-control as-control-prev">'+(c.prevText?c.prevText:" ")+"</a>":"";var m=c.nextControl?'<a href="javascript:;" data-type="next" class="as-control as-control-next">'+(c.nextText?c.nextText:" ")+"</a>":"";var n=0;var o='<div class="as-nav-cont '+(c.navLinks?"":"as-nav-hidden")+'">';for(var p=0;p<f.length;p++){var q="";if(p==0)q=" as-nav-sel";o+='<a href="javascript:;" class="as-nav-trig'+q+'" data-index="'+p+'"> </a>'}o+="</div>";var r={width:g+"px",height:h+"px"};f.wrap('<li class="as-list-item"></li>').parent().wrapAll('<div class="as-cont as-loading"><ul class="as-list-cont"></ul></div>').css(r).parent().css({width:k+"px",height:h+"px"}).parent().css(r).parent().css(r).addClass("as-main-cont").append(a(o)).append(l+" "+m);var t=a("ul.as-list-cont",e);var u=a("a.as-nav-trig",e);var v=a(".as-control",e);var w=a("img",t);var x=w.length;var y=0;var z;if(x){v.hide();u.hide();t.hide();a.each(w,function(a,b){if(!b.complete||typeof b.naturalWidth!="undefined"&&b.naturalWidth==0)return;y++});if(y==x){A()}else{w.load(function(){y++;if(y==x){A();clearTimeout(z)}});z=setTimeout(A,x*1e3+1500)}}e.show();u.click(function(){var b=a(this).data();if(b.index==n)return;if(c.transitionInterval&&i&&j)clearInterval(i);u.removeClass("as-nav-sel");a(this).addClass("as-nav-sel");n=b.index;t.animate({left:b.index*g*-1+"px"},c.speed)});a("a.as-control",e).click(function(){var b=a(this).data();var c=null;switch(b.type){case"previous":c=f.length-1;if(n>0)c=n-1;break;case"next":c=0;if(n<f.length-1)c=n+1;break}if(a.type(c)!="null")a(u[c],e).trigger("click")});if(c.transitionInterval){if(c.transitionInterval<=c.speed)a.error("Simpleslide: The speed of the transition can not be less than or equal to the speed of movement.");i=setInterval(function(){var b=n+1;if(n>=f.length-1)b=0;j=false;a(u[b],e).trigger("click");j=true},c.transitionInterval)}})}})(jQuery)
