/* Don't stop! (c) ATB */
var Rotation = {

  Start: function() {

	// get the list of images and current image
	this.imageList = $F('ClientImageList').split(';');
	this.currentImage = $F('ClientImageStart');

	// set timer for swapping
	setTimeout('Rotation.Swap();', 4500);
  },


 Swap: function() {

	// get next image in line
	this.currentImage++;
	if(this.currentImage > (this.imageList.length - 1)) { this.currentImage = 0; }

	// display it
	Effect.Fade($('ClientImage'), { afterFinish: function() {

		$('ClientImage').src = 'images/clients/' + Rotation.imageList[Rotation.currentImage];
		Effect.Appear($('ClientImage'));
	}});

	// overloop, neverending stooooryyyyyyyy
	setTimeout('Rotation.Swap();', 4500);
 }

};

/* Sys(tem|the)Message */
var MessageBoxImageDir = 'images/MessageBox/'; // where does MessageBox have it's images?
var MessageBox = {

  /* ## MESSAGE BOX: Preload message images */
  Preload: function() {

        var images = new Array('loading', 'error', 'ok');
        var preloaded = new Array();

        images.each( function(image) {

                preloaded[image] = new Image;
                preloaded[image].src = MessageBoxImageDir + image + '.gif';
        });

  },

  /* ## MESSAGE BOX: Update the text and the icon */
  Appear: function(image,alt,text,delay) {

	// Put correct HTML in the message box
	$('MessageBox').innerHTML = '<p><img src="' + MessageBoxImageDir + image + '.gif" alt="' + alt + '" /><br />' + text + '</p>';

	// Check if we need to show the message box or is it already visible
	if($('MessageBox').style.display == 'none') { new Effect.Appear('MessageBox'); }

	// Hide the messagebox if any delay is set
	if(delay) { setTimeout("Effect.DropOut('MessageBox');", delay); }
  }
};

/* Time to run! Runtime time! */
//window.onload = function() { Rotation.Start(); }

