<!--
/*
   Feel free to use this code for your own personal use but please
   leave this comment in.  A link back to Bugimus' page would be much
   appreciated.  www.bugimus.com
   version 2.2 12/23/99 Bug fixed from last mod.  If the images were not
   						on a div, then the switch would not occur.  I 
						added logic to detect whether images were on a 
						div or not.  Again this only applies to the 
						Netscape part of the code.
   version 2.1  10/9/99 Modified series, rise, fall, & showimage to work 
   						with multiple layers in Netscape.  IE didn't 
						require any changes.
   version 2.01	4/22/99	Modified showimage to be backward compatible with
						Netscape Navigator 3.
   version 2.0	4/07/99 Re-written using more object oriented design.
   version 1.2	4/01/99 Added enhanced javascript browser compatibility 
						and error message bulletproofing.
   version 1.1	2/22/99 Added imgidx tracking in showImage
*/

// Animation falls - The higher the image number, the lower the elevation.
// This script was designed with the convention of an object floating and
// sinking into the page.  That's how the names came about.  You could also
// substitute start and end imagery for the animations if that works better
// for you.
//
// image0  Highest (start)
// image1  .
// image2  .
// image3  .
// image4  Lowest (end)
//
// Each animation is called a 'series', series of images successively 
// switched to create an animation effect.
//
// 'placement' refers to the name of the img tag on the page.
//

// determine the type of browser you're dealing with
NN4 = (document.layers);
IE4 = (document.all);
GN4 = (NN4 || IE4);

function series( name, rate, divName ) {
	this.name  = name;
	this.rate = rate;
	this.divname = divName;
	this.imageindex = -1;
	this.numimages = 0;
	this.stopall = false;
	this.goingup = false;
	this.timer = null;
	this.img = new Array();
	this.loadimage = loadImg;
	this.showimage = showImg;
	this.rise = Rise;
	this.fall = Fall;
	this.fallrise = fallRise;
	this.stop = Stop;
	this.incimage = incImg;
	this.decimage = decImg;
	this.loop = Loop;
	this.bounce = Bounce;
}

function Loop( placement, direction ) {
	if( direction=="UP" ) this.decimage(); else this.incimage();
	this.showimage( placement, this.imageindex );
	if( !this.stopall ) this.timer=setTimeout( this.name+".loop('"+placement+"','"+direction+"')", this.rate );
	else this.stopall=false;
}

function Bounce( placement ) {
	if( this.goingup && this.imageindex >= this.numimages-1 ) this.goingup=false;
	else if( !this.goingup && this.imageindex <= 0 ) this.goingup=true;
	if( this.goingup ) this.incimage(); else this.decimage();
	this.showimage( placement, this.imageindex );
	if( !this.stopall ) this.timer=setTimeout( this.name+".bounce('"+placement+"')", this.rate );
	else this.stopall=false;
}

function Stop() {
	this.stopall=true;
}

function incImg() {
  if( this.imageindex >= this.numimages-1 ) this.imageindex=0;
  else this.imageindex++;
}

function decImg() {
  if( this.imageindex <= 0 ) this.imageindex=this.numimages-1;
  else this.imageindex--;
}

function fallRise( placement, delay ) {
	this.rise( placement, this.fall( placement, delay ) );
	return delay;
}

function Fall( placement, delay ) {
	for( k=1; k<this.numimages; k++, delay++ ) {
		if( NN4 && this.divName ) this.timer=setTimeout( "document."+this.divname+".document."+placement+".src='"+this.img[k].src+"'\;", delay*this.rate );
		else this.timer=setTimeout( "document."+placement+".src='"+this.img[k].src+"'\;", delay*this.rate );
		this.imageindex=k;
	}
	return delay;
}

function Rise( placement, delay ) {
	for( k=this.numimages-2; k>=0; k--, delay++ ) {
		if( NN4 && this.divName ) this.timer=setTimeout( "document."+this.divname+".document."+placement+".src='"+this.img[k].src+"'\;", delay*this.rate );
		else this.timer=setTimeout( "document."+placement+".src='"+this.img[k].src+"'\;", delay*this.rate );
		this.imageindex=k;
	}
	return delay;
}

function showImg( placement, imagenum ) {
	if( imagenum<this.numimages )
		if( GN4 ) {
			if( NN4 && this.divName ) eval("document."+this.divname+".document."+placement+".src = this.img[imagenum].src");
			else eval("document."+placement+".src = this.img[imagenum].src");
		} else 
			this.timer=setTimeout( "document."+placement+".src='"+this.img[imagenum].src+"'\;", 0 );
	this.imageindex=imagenum;
}

function loadImg( source ) {
	this.img[this.numimages] = new Image();
	this.img[this.numimages].src = source;
	this.numimages++;
}

//-->