/*
	Copyright DTDigital         :: www.dtdigital.com.au ::
	Unauthorised modification / use is a criminal offence, and
	will be prosecuted to the fullest extent permitted by law.
	All Rights Reserved
*/

function CreateRollover($links)
{
	var $inactive = $links.getElementsByTagName("img")[0];
	$inactive.style.display = "block";
	
	if(!$inactive.src.match(/hover/))
	{
		var $hover = document.createElement("img");
		$hover.src = $inactive.src.replace("_inactive", "_hover");
		$hover.alt = $inactive.alt;
		$hover.width = $inactive.width;
		$hover.height = $inactive.height;
		$hover.style.display = "none";
		
		$links.onmouseover = function()
		{
			$inactive.style.display = "none";
			$hover.style.display = "block";
		};
		
		$links.onmouseout = function()
		{
			$inactive.style.display = "block";
			$hover.style.display = "none";
		};
		
		$links.appendChild($hover);
	}
}

function RegisterMenu()
{
	if(document.getElementById("menu"))
	{
		var $menu = document.getElementById("menu");
		var $links = $menu.getElementsByTagName("a");
		
		for(var i = 0; i < $links.length; i++)
		{
			CreateRollover($links[i]);
		}
	}
}

function RegisterProducts()
{
	if(document.getElementById("products"))
	{
		var $menu = document.getElementById("products");
		var $links = $menu.getElementsByTagName("a");
		
		for(var i = 0; i < $links.length; i++)
		{
			CreateRollover($links[i]);
		}
	}
}

window.onload = function()
{
	RegisterMenu();
	RegisterProducts();
}


