/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	Written by Bugimus 
	Copyright © 2002 Bugimus, all rights reserved.
	You may use this code for your own *personal* use provided you leave this comment block intact.  
	A link back to Bugimus' page would be much appreciated.  
	http://bugimus.com/

   version 1.0	9/20/02 Got to get this working with images without the "name" attribute.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */

// 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.
//

function series( objectName, rate, divString ) {
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true

	this.objname  = objectName
	this.rate = rate
	this.divname = divString
	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.objname+".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.objname+".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++ ) {
		this.timer=setTimeout( this.objname+".showimage('"+placement+"','"+k+"')", delay*this.rate );
		this.imageindex=k;
	}
	return delay;
}

function Rise( placement, delay ) {
	for( k=this.numimages-2; k>=0; k--, delay++ ) {
		this.timer=setTimeout( this.objname+".showimage('"+placement+"','"+k+"')", delay*this.rate );
		this.imageindex=k;
	}
	return delay;
}

function showImg( placement, imagenum ) {
	if( imagenum<this.numimages ) document.getElementById(placement).src=this.img[imagenum].src;
	this.imageindex=imagenum;
}

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

//-->