// GifAnim Object
// an object which allows JavaScript to animate gifs by swapping through them quickly
// 19990326

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynapi/

function GifAnim(layer,imgName,imgSeries,end,speed,startFrame) {
	this.layer = layer
	this.imgName = imgName
	this.frame = new Array()
	for (var i=0; i<=end; i++) this.frame[i] = imgSeries+i
	this.end = end
	this.speed = speed
	this.active = false
	this.count = (startFrame)? startFrame : 0
	this.obj = imgName + "GifAnim"
	eval(this.obj + "=this")
	this.play = GifAnimPlay
	this.run = GifAnimRun
	this.stop = GifAnimStop
	this.goToFrame = GifAnimGoToFrame
}
function GifAnimPlay(loop,reset,fn) {
	if (!this.active) {
		this.active = true
		if (!loop) loop = false
		if (!reset) reset = false
		if (!fn) fn = null
		this.run(loop,reset,fn)
	}
}
function GifAnimRun(loop,reset,fn) {
	if (this.active && this.count <= this.end) {
		changeImage(this.layer,this.imgName,this.frame[this.count])
		this.count += 1
		if(this.frame[this.count]=="M14" || this.frame[this.count]=="M21" || this.frame[this.count]=="M28" || this.frame[this.count]=="L14" || this.frame[this.count]=="L21" || this.frame[this.count]=="L28" || this.frame[this.count]=="T14" || this.frame[this.count]=="T21" || this.frame[this.count]=="T28")
		{
				if(this.frame[this.count]=="M14")
				{
				document.all.data.innerHTML = fortune[getRandom()];
				}
				else if(this.frame[this.count]=="M21")
				{
				document.all.data.innerHTML = fortune[getRandom()];
				}
				else if(this.frame[this.count]=="M28")
				{
				document.all.data.innerHTML = fortune[getRandom()];
				}
		setTimeout(this.obj+".run("+loop+","+reset+",\""+fn+"\")",4600)
		
		}
		else if((this.frame[this.count]=="L5" || this.frame[this.count]=="M5" || this.frame[this.count]=="T5") || (this.frame[this.count]=="L6" || this.frame[this.count]=="M6" || this.frame[this.count]=="T6") || (this.frame[this.count]=="L7" || this.frame[this.count]=="M7" || this.frame[this.count]=="T7") || (this.frame[this.count]=="L32" || this.frame[this.count]=="M32" || this.frame[this.count]=="T32"))
		{
		setTimeout(this.obj+".run("+loop+","+reset+",\""+fn+"\")",50)
		document.all.data.innerHTML = "";
				if(this.frame[this.count]=="L32" || this.frame[this.count]=="M32" || this.frame[this.count]=="T32")
				{
				links.style.visibility = "hidden";		
				}
		}
		else
		{
		setTimeout(this.obj+".run("+loop+","+reset+",\""+fn+"\")",this.speed)
		document.all.data.innerHTML = "";
		}

	}
	else {
		if (loop && this.active) {
			this.count = 0
			this.run(loop,reset,fn)
		}
		else {
			this.active = false
			if (reset) this.goToFrame(0)
			eval(fn)
		}
	}
}
function GifAnimStop() {
	this.active = false
}
function GifAnimGoToFrame(index) {
	this.count = index
	changeImage(this.layer,this.imgName,this.frame[this.count])
}
