/* <![CDATA[ */

// Stores the currently visible menu and its content
var visibleMenu;
var visibleMenuX;
var visibleSubMenu;
var visibleProductType;

// Store the timeout index
var timeout;

// Initialise the visible text with a default text box to display
function setup()
{
	visibleMenu = 7;
	visibleMenuX = "";
	visibleSubMenu = 7;
	visibleProductType = 7;
	timeout = 0;
}

// This function sets a time delay before running functions (one at a time)
function timedelay(func, delay)
{
	setTimeout("handletimedelay('" + escape(func) + "'," + ++timeout + ")", delay);
}

// This function handles a time delay before running functions (one at a time)
function handletimedelay(func,index)
{
	if(timeout == index)
	{
		eval(unescape(func));
	}
}

// This function cancels a time delay
function canceltimedelay()
{
	++timeout;
}

// This function changes which piece of menu/content is visible
function menufocus(id)
{
	// Cancel any time delay
	canceltimedelay();

	// Reset any product types, products and submenus to its default position
	producttypeunfocus();
	submenuunfocus();

	// Reset any content to its default position
	var tag = document.getElementById("tag" + visibleMenu);
	var icon = document.getElementById("menuicon" + visibleMenu);
	var content = document.getElementById("content" + visibleMenu);

	if( tag )
	{
		tag.style.zIndex = visibleMenu;
		content.style.visibility = "hidden";

		tag.style.top = "120px";
		tag.style.marginLeft = visibleMenuX;
		icon.style.visibility = "hidden";
	}

	// Activate the new content
	tag = document.getElementById("tag" + id);
	icon = document.getElementById("menuicon" + id);
	content = document.getElementById("content" + id);

	tag.style.zIndex = "7";
	icon.style.visibility = "visible";
	

	visibleMenuX = tag.style.marginLeft;

	tag.style.top = "162px";
	tag.style.marginLeft = "-343px";

	content.style.visibility = "visible";

	// Store the passed id as the current visible menu
	visibleMenu = id;

	// Activate the default product type, product and submenu
	producttypefocus( "1" );
	submenufocus( "1" );
}

// This function changes which piece of subcontent is visible
function submenuunfocus()
{
	// Cancel any time delay
	canceltimedelay();

	// Hide the currently showing content and return icons to their default setting
	var subIcon = document.getElementById("submenuicon" + visibleMenu + visibleSubMenu);
	var subContent = document.getElementById("subcontent" + visibleMenu + visibleSubMenu);
	
	if( subIcon )
	{
		subIcon.style.listStyleType = "disc";
		subContent.style.visibility = "hidden";
	}

	// Reset the current visible submenu
	visibleSubMenu = 7;
}

// This function changes which piece of subcontent is visible
function submenufocus(id)
{
	// Cancel any time delay
	canceltimedelay();

	// Hide the currently showing content and return icons to their default setting
	submenuunfocus();

	// Get the new sub content and icon objects from the passed id
	var subIcon = document.getElementById("submenuicon" + visibleMenu + id);
	var subContent = document.getElementById("subcontent" + visibleMenu + id);
	
	if( subIcon && subContent )
	{
		// Change the new subicon style and unhide the new subcontent
		subIcon.style.listStyleType = "circle";
		subContent.style.visibility = "visible";

		// Store the passed id as the current visible submenu
		visibleSubMenu = id;
	}	
}

// This function makes the current product type invisible
function producttypeunfocus()
{
	// Cancel any time delay
	canceltimedelay();

	// Hide the currently showing product types
	var productType = document.getElementById( "producttype" + visibleMenu + visibleProductType );
	var productTypeIcon = document.getElementById( "producttypeicon" + visibleMenu + visibleProductType + "title" );
	
	if( productType && productTypeIcon )
	{
		productType.style.visibility = "hidden";
		productTypeIcon.style.backgroundColor = "transparent";
	}

	// Reset the current visible product type
	visibleProductType = 7;
}

// This function changes which product line is visible
function producttypefocus(id)
{
	// Cancel any time delay
	canceltimedelay();

	// Hide the currently showing product types
	producttypeunfocus();

	// Activate the new product type
	var productType = document.getElementById( "producttype" + visibleMenu + id );
	var productTypeIcon = document.getElementById( "producttypeicon" + visibleMenu + id + "title" );

	if( productType && productTypeIcon )
	{
		productType.style.visibility = "visible";
		productTypeIcon.style.backgroundColor = "#210105";

		// Store the passed id as the current visible product type
		visibleProductType = id;
	}
}

function openwindow(href)
{
	window.open(href,'_blank','height=480,width=490,location=no,menubar=no,resizable=no,toolbar=no');
}

/* ]]> */