﻿(function(a){a.fn.imgCycle=function(f,j){var c={startRandom:true,interval:5E3,speedOut:1E3,speedIn:1250};c=a.extend(c,j);return this.each(function(){if(f.length>0){var d=f.length,h=a(this).id(),g=a(this),b;g.css("position","relative");if(c.startRandom){b=Math.floor(Math.random()*d);for(var e=0;e<d;e++){if(b>=d)b-=d;a("<img/>").src(f[b++]).css("position","absolute").hide().appendTo(g)}b=1}else{b=1;for(e=0;e<d;e++)a("<img/>").src(f[e]).css("position","absolute").hide().appendTo(g)}var i=a("#"+h+" img:first").show();function k(){i.fadeOut(c.speedOut);if(++b>d)b=1;a("#"+h+" img:eq("+(b-1)+")").fadeIn(c.speedIn,function(){i=a(this)})}setInterval(k,c.interval)}else window.console&&console.log&&console.log("No images provided.")})}})(jQuery);