(function(a){a.fn.innerfade=function(b){this.each(function(){var d={animationtype:"fade",speed:"normal",timeout:5000,type:"sequence",containerheight:"auto",runningclass:"innerfade"};if(b){a.extend(d,b)}var e=a(this).children();if(e.length>1){a(this).css("position","relative");a(this).css("height",d.containerheight);a(this).addClass(d.runningclass);for(var c=0;c<e.length;c++){a(e[c]).css("z-index",String(e.length-c)).css("position","absolute");a(e[c]).hide()}if(d.type=="sequence"){setTimeout(function(){a.innerfade.next(e,d,1,0)},d.timeout);a(e[0]).show()}else{if(d.type=="random"){setTimeout(function(){do{current=Math.floor(Math.random()*(e.length))}while(current==0);a.innerfade.next(e,d,current,0)},d.timeout);a(e[0]).show()}else{alert("type must either be 'sequence' or 'random'")}}}})};a.innerfade=function(){};a.innerfade.next=function(d,b,e,c){if(b.animationtype=="slide"){a(d[c]).slideUp(b.speed,a(d[e]).slideDown(b.speed))}else{if(b.animationtype=="fade"){a(d[c]).fadeOut(b.speed);a(d[e]).fadeIn(b.speed)}else{alert("animationtype must either be 'slide' or 'fade'")}}if(b.type=="sequence"){if((e+1)<d.length){e=e+1;c=e-1}else{e=0;c=d.length-1}}else{if(b.type=="random"){c=e;while(e==c){e=Math.floor(Math.random()*(d.length))}}else{alert("type must either be 'sequence' or 'random'")}}setTimeout((function(){a.innerfade.next(d,b,e,c)}),b.timeout)}})(jQuery);
