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