/* =========================================================

// jquery.innerfade.js

// Datum: 2008-02-14
// Firma: Medienfreunde Hofmann & Baldes GbR
// Author: Torsten Baldes
// Mail: t.baldes@medienfreunde.com
// Web: http://medienfreunde.com

// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/
// and Ralf S. Engelschall http://trainofthoughts.org/

*
*  <ul id="news"> 
*      <li>content 1</li>
*      <li>content 2</li>
*      <li>content 3</li>
*  </ul>
*  
*  $('#news').innerfade({ 
*	  animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
*	  speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
*	  timeout: Time between the fades in milliseconds (Default: '2000'), 
*	  type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
* 		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
*	  runningclass: CSS-Class which the container get’s applied (Default: 'innerfade'),
*	  children: optional children selector (Default: null)
*  }); 
*

// ========================================================= */


(function(b) { b.fn.innerfade = function(d) { return this.each(function() { b.innerfade(this, d) }) }; b.innerfade = function(d, e) { var a = { animationtype: "fade", speed: "normal", type: "sequence", timeout: 2E3, containerheight: "auto", runningclass: "innerfade", children: null }; e && b.extend(a, e); var c = a.children === null ? b(d).children() : b(d).children(a.children); if (c.length > 0) { b(d).css("position", "relative").css("height", a.containerheight).addClass(a.runningclass); for (var g = 0; g < c.length; g++) b(c[g]).css("z-index", String(c.length - g)).css("position", "absolute").hide(); if (a.type == "sequence") { setTimeout(function() { b.innerfade.next(c, a, 1, 0) }, a.timeout); b(c[0]).show() } else if (a.type == "random") { var h = Math.floor(Math.random() * c.length); setTimeout(function() { do f = Math.floor(Math.random() * c.length); while (h == f); b.innerfade.next(c, a, f, h) }, a.timeout); b(c[h]).show() } else if (a.type == "random_start") { a.type = "sequence"; var f = Math.floor(Math.random() * c.length); setTimeout(function() { b.innerfade.next(c, a, (f + 1) % c.length, f) }, a.timeout); b(c[f]).show() } else alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'") } }; b.innerfade.next = function(d, e, a, c) { if (d.length > 1) { if (e.animationtype == "slide") { b(d[c]).slideUp(e.speed); b(d[a]).slideDown(e.speed) } else if (e.animationtype == "fade") { b(d[c]).fadeOut(e.speed); b(d[a]).fadeIn(e.speed, function() { removeFilter(b(this)[0]) }) } else alert("Innerfade-animationtype must either be 'slide' or 'fade'"); if (e.type == "sequence") if (a + 1 < d.length) { a += 1; c = a - 1 } else { a = 0; c = d.length - 1 } else if (e.type == "random") for (c = a; a == c; ) a = Math.floor(Math.random() * d.length); else alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'"); setTimeout(function() { b.innerfade.next(d, e, a, c) }, e.timeout) } } })(jQuery); function removeFilter(b) { b.style.removeAttribute && b.style.removeAttribute("filter") };

