// $Id: animation.js,v 1.3 2007/10/31 16:17:39 pwh Exp $

function Preload ( baseName, fileCount )

{
   this.images = new Array()
   this.images[0] = new Image()
   this.images[0].src = "images/" + baseName + ".gif"

   for ( i = 1; i < fileCount; i++ ) {

        this.images[i] = new Image()
        this.images[i].src = "images/" + baseName + i + ".gif"
   }
}


function updateImage ()

{
   var newIndex = this.index + this.increment

   if ( newIndex < this.preload.images.length && newIndex > -1 ) {

	document.getElementById(this.id).src = this.preload.images[newIndex].src
	this.index = newIndex

	if ( newIndex > 0 && newIndex < ( this.preload.images.length ) ) {

		this.timer=setTimeout( this.id + ".update()", 50 )
	}
   }
}


function runForward ()

{
   this.increment = 1
   this.update ()
}


function runBackward ()

{
   this.increment = -1
   this.update ()
}


function Animation ( id, preload )

{
   this.id = id
   this.index=0
   this.increment=1
   this.mouseOver = runForward
   this.mouseOut = runBackward
   this.update = updateImage
   this.preload = preload
}


var Four = new Preload ( "Four", 7 )
var Nine = new Preload ( "Nine", 7 )

var MDscan = new Animation ( "MDscan", Nine )
var Xhatch1 = new Animation ( "Xhatch1", Four )
var Xhatch2 = new Animation ( "Xhatch2", Four )
var simpleX = new Animation ( "simpleX", Four )
var columnX = new Animation ( "columnX", Four )
var RIA = new Animation ( "RIA", Four )


function XhatchOn()

{
   Xhatch1.mouseOver()
   Xhatch2.mouseOver()
}


function XhatchOff()

{
   Xhatch1.mouseOut()
   Xhatch2.mouseOut()
}

function MDscanOn()

{
   MDscan.mouseOver()
}

function MDscanOff()

{
   MDscan.mouseOut()
}

function simpleXon()

{
   simpleX.mouseOver()
}

function simpleXoff()

{
   simpleX.mouseOut()
}

function columnXon()

{
   columnX.mouseOver()
}

function columnXoff()

{
   columnX.mouseOut()
}


function RIAon()

{
   RIA.mouseOver()
}

function RIAoff()

{
   RIA.mouseOut()
}

