/*
 * Script to animate the bug on the DEBUGGED home page.
 *
 * Written by Stephen Battey    July 1997
 * (taken from debugged home page)
 * See  http://www.lucidviews.net/software/debugged
 *
 * Script may be copied and modified, but the original author notice must remain
 * and the modification & author noted below.
 */


var BlinkNames = new Array("2","3","2","1")
var BlinkFrameNo = 1
var BlinkFrameLoading = true

function NextBlinkFrame()
//			Procedure to animate Edna the bug
{
	if (BlinkFrameNo < 3)
		BlinkFrameNo++
	else
		BlinkFrameNo = 0

	BlinkFrameLoading = true
	document.bugpic.src = "Bug"+BlinkNames[BlinkFrameNo]+".gif"
}

function BlinkFrameLoaded()
{
	if ( BlinkFrameLoading )
	{
		if (BlinkFrameNo == 3)
			BlinkTimer=window.setTimeout('NextBlinkFrame()', Math.round(Random(500,6800)))
		else
			BlinkTimer=window.setTimeout('NextBlinkFrame()', 100)
		BlinkFrameLoading = false
	}
}

function MouseOverBlink()
{
	if (!BlinkFrameLoading)
	{
		clearTimeout(BlinkTimer)
		NextBlinkFrame()
	}

	window.status='Mail DeBugged'
}

function InitBlink()
// 	Procedure to check for the logo image and then initialise the swirl process.
{
	if (document.bugpic)
	{
		document.bugpic.onload = BlinkFrameLoaded;
		BlinkFrameLoaded();
	}
	else
	{
		// wait for the page to load and the bugpic image to become available
		window.setTimeout( "InitBlink();", 300 );
	}
}

InitBlink();
