var colors = new Array(	"#7b7b7b", "#7b7b7b" , "#ffffff");

//	Set the basic color
var basicColor = "#FFCC00";

//	Set the global vars to their initial state
var curColIdx = 0;
var curElem;

var	mousePosX = 0;
var mousePosY = 0;

//	Set the glow speed
var speed = 1;

//	Initialize glower scripts
function init()
{
	//	ie only :p

	if (!document.layers)
	{
		document.onmouseover = determine_tag;
		document.onmouseout = end_glow;
		check_state();
	}
}

//	Stop the glowing of a link
function end_glow()
{
	if (curElem)
	{
		//	Reset values
		curElem.style.color = basicColor;
		curColIdx = 0;
		curElem = false;
	}
}

//	Stop the glowing of a link
function start_glow(ev)
{
		// If element does not exist, return
		if (!curElem) return;
		ev = curElem;

		//	determine which color is being used
		tempCol = ev.style.color;
		if (tempCol == basicColor)
		{
			//	Reset colorindex
			curColIdx = 0;
		}
		if (!tempCol)
		{
			//	Color not yet set, set index to 0
			curColIdx = 0;
			tempCol = basicColor;
		}
		else
		{
			// 	Search current color
			itemN = colors.length;
			for (f = 0; f < itemN; f++)
			{
				if (colors[f] == tempCol)
				{
					//	Color found, update counter
					if (f >= (itemN-1))
					{
						// Jump to first color
						curColIdx = 0;
					}
					else
					{
						//	Increase color index with one
						curColIdx = f + 1;
					}

				} // end if: check for color

			}//	end if: search color

		}//	end if: initiate search

		//	set color
		ev.style.color = colors[curColIdx];

}

function determine_tag()
{
	ev = window.event.srcElement;
	mousePosX = window.event.offsetX;
	mousePosY = window.event.offsetY;

	tag = ev.tagName;

	//	Respond to anchor tags only
	if (tag == "A")
	{
		if (curElem)
		{
			curElem = false;
			return;
		}
		curElem = ev;
	}
	else
	{
		curElem = false;
	}
}

function check_state()
{
	if (curElem)
	{
		start_glow();
	}

		//	Object is selected, glow
	if (!curElem) end_glow();//	Object is not selected, do not glow


	//	Set timer
	window.setTimeout("check_state()", speed);
}