window.status = "www.fighterz.net";

/* Javascript functions */
function fetch(id) 
{
		if (document.getElementById)
				return document.getElementById(id);
		else if (document.all)
				return document.all[id];
		else 
				return null;
}
function init()
{
		return;
		var maintable = fetch("main");
		if (!maintable) return;
		maintable.width = ( amountoflinks * linkwidth ) + amountoflinks + 1;
}
function change(obj, arg)
{
		if (arg == 1)
				obj.style.backgroundColor = "#FBFF9A";
		else if (arg == 0)
				obj.style.backgroundColor = "#FFFFFF";
}

var done = 0;
function doeffect()
{
	if (!in_progress)
	{
		if (done == 0)
			nightrider(1);
		else if (done == 1)
			nightrider2();
	
		done++;	
		if (done > 1)
			done = 0;
	}
}
var in_progress = false;
var current;
var towards;
var times;
function nightrider(arg)
{
	var itemzero = fetch("item0");
	if (itemzero)
	{
		if (!in_progress)
		{
			current = 0;
			times = arg;
			towards = true;
			in_progress = true;
			itemzero.style.backgroundColor = "#FBFF9A";
			setTimeout('next();', 100);
		}
	}
}
function next()
{
	var oldobj = fetch("item"+current);
	
	if (towards)
		current++;
	else
		current--;
		
	var obj = fetch("item"+current);
	if (oldobj)
		oldobj.style.backgroundColor = "#FFFFFF";
	if (obj)
	{
		obj.style.backgroundColor = "#FBFF9A";
		setTimeout('next();', 100);
	}
	else
	{
		if (towards)
		{
			towards = false;
			next();
		}
		else
		{
			if (times > 0)
			{
				times--;
				towards = true;
				next();
			} else {
				in_progress = false;
			}
		}
	
	}	
}
var color;
var maximum;
var should_end;
function nightrider2()
{
	var itemzero = fetch("item0");
	if (itemzero)
	{
		if (!in_progress)
		{
			current = 0;
			towards = true;
			should_end = false;
			in_progress = true;
			maximum = 0;
			color = 1; /* blue (0=white) */
			itemzero.style.backgroundColor = "#FBFF9A";
			setTimeout('next2();', 100);
		}
	}
}
function next2()
{	
	if (towards)
		current++;
	else
		current--;

	var obj = fetch("item"+current);
			
	if (obj)
	{
		if (current > maximum)
			maximum = current;
		obj.style.backgroundColor = (color?"#FBFF9A":"#FFFFFF");
		setTimeout('next2();', 100);
	} else {
		if (color == 1)
		{
			if (towards)
			{
				color = 0;
				current = -1;
				setTimeout('next2();', 100);			
			} else {
				should_end = true;
				color = 0;
				current = maximum + 1;
				setTimeout('next2();', 100);
			}
		}
		else
		{
			if (towards)
			{
				color = 1;
				// current = -1;
				towards = false;
				setTimeout('next2();', 100);
			} else {
				if (should_end)	
				{
					in_progress	= false;
					return;
				}
				towards = false;
				current = maximum;
				setTimeout('next2();', 100);
			}
		}


	}
}