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