/* *****
 * 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 5000 milliseconds (5 seconds) when
 *   fading in; this means the message will remain visible for about 5
 *   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();
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 : 20000);

  // 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;
}

fader[2] = new fadeObject('fade2', 'ffffff', '000000', 100, 100);
fader[2].msg[1] = "\"Hess Europe Ltd receives excellent service from ZIONSFX on our foreign currency transactions.  Their people are great to work with, and the rates they provide are better than we have been able to find anywhere else.\"<br />Curt Elcock - Accountant<br /><em>Hess Europe Ltd.</em>";
fader[2].msg[2] = "\"ZIONSFX's fixed fee pricing gives significant cost savings compared to their spread based fee competitors.\"<br />Duane Knapp - Director of Treasury<br /><em>SkyWest Airlines, Inc.</em>";
fader[2].msg[3] = "\"ZIONSFX is great for my needs here at International Armoring Corporation as it provides me with a fast transaction ability, best pricing,  the ability for me to transact anywhere that I am outside of the office and the service, when in need, is really great.\"<br />Mike Burton - Finance <br /><em>International Armoring Corporation</em>";

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