/* *****
 * The code below describes how to make a throbbing or automatic fade
 * sequence of messages.  It is important to note that this function is
 * NOT part of the Buffered Text-Fade Effect, but merely an example of
 * how it can be used.  In this example, the throb() function controls
 * the commands which are sent to the fade engine; it is called
 * repeatedly at set time intervals rather than using mouseover events
 * as triggers.
 *
 * Notes:
 * - A global array "hash" is used to keep track of where each
 *   animation is currently in the sequence.
 * - The list of messages defined in the fader *must* start at one (1)
 *   and count upwards without skipping any integers.
 * - The third line of the throb() function controls how fast
 *   commands get sent to the fade engine.  It waits only 100 milli-
 *   seconds when fading out, but 10000 milliseconds (10 seconds) when
 *   fading in; this means the message will remain visible for about 10
 *   seconds before fading out again.
 *
 * Other types of fade animation are possible simply by designing
 * different ways to control the fade-ins and fade-outs!
 */

var fader = new Array();
var hash = new Array();

fader[0] = new fadeObject('fade0', '111111', 'ffffff', 30, 30);
fader[0].msg[1] = "Bilder formen die Art und Weise, wie wir &uuml;ber unsere Welt denken.";
fader[0].msg[2] = "Bilder umgeben uns t&auml;glich.";
fader[0].msg[3] = "Bilder k&ouml;nnen uns auseinander bringen,k&ouml;nnen &Auml;ngste und Misstrauen hervorrufen.";
fader[0].msg[4] = "Ein einziges Bild kann ein komplexes Thema zu einfach erschienen lassen...";
fader[0].msg[5] = "...aber wir k&ouml;nnen Bilder auch f&uuml;r gute Zwecke verwenden.";
fader[0].msg[6] = "Bilder k&ouml;nnen auf sonst verborgene Bedingungen aufmerksam machen.";
fader[0].msg[7] = ". . .";

function throb(item) {

  // If the hash array does not have an entry for this item, initialise it at 2
  if (!hash[item]) hash[item] = 2;

  // Send a fade command, using the hash array to tell us what parameters we should use
  fader[item].fade(Math.floor(hash[item] / 2), !(hash[item] % 2));

  // Call this function again for this same item after a certain amount of time
  setTimeout(function() { throb(item); }, (hash[item] % 2) ? 100 : 10000);

  // If we have exceeded the number of messages in this fader, start over again at 2
  if (++hash[item] > fader[item].msg.length * 2 - 1) hash[item] = 2;
}

// Start this fader
setTimeout(function() { throb(0); }, 1000);
