(function(A){A.fn.innerfade=function(B){this.each(function(){var D={animationtype:"fade",speed:"normal",timeout:2000,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)}}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)
