var aMenuImages = new Array();
aMenuImages[0] = new Array("../../images/bt1home.gif", "../../images/bt1home_ov.gif");
aMenuImages[1] = new Array("../../images/bt2projects.gif", "../../images/bt2projects_ov.gif");
aMenuImages[2] = new Array("../../images/bt4specialoffers.gif", "../../images/bt4specialoffers_ov.gif");
aMenuImages[3] = new Array("../../images/bt6aboutus.gif", "../../images/bt6aboutus_ov.gif");
aMenuImages[4] = new Array("../../images/bt7contact.gif", "../../images/bt7contact_ov.gif");
aMenuImages[5] = new Array("../../images/bt8sellus.gif", "../../images/bt8sellus_ov.gif");

// Execute functions onload.
function onBodyLoad()
{
	document.getElementById("inuitklap").onclick = function() { showSubMenu(); }
	preloadImages();
	startList();
}

// Preload images.
function preloadImages()
{
	
	for(var i = 0; i < aMenuImages.length; i++)
	{
		var oImage1 = new Image();
		var oImage2 = new Image();
		oImage1.src = aMenuImages[i][0];
		oImage2.src = aMenuImages[i][1];
	}
}

// Add onmouseover to the menu items and pagenavigation.
function startList()
{
	if (document.getElementById)
	{
		
		// Add mouseonver to the menu items.
		navRoot = document.getElementById("navigation");
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") 
			{				
				imgNode = node.childNodes[0].childNodes[0];
				imgNode.onmouseover = function()
				{
					this.src = '../../images/' + this.name + '_ov.gif';
				}

				imgNode.onmouseout = function()
				{
					this.src = '../../images/' + this.name + '.gif';
				}
			}
		}

		// Add mouseonver to the pagenavigation items.
		if (document.getElementById("pagenavigation"))
		{
			ePageNavigation = document.getElementById("pagenavigation");
			for (i = 0; i < ePageNavigation.childNodes.length; i++)
			{
				eNode = ePageNavigation.childNodes[i];
				if (eNode.nodeName == "A")
				{
					eNode.onmouseover = function()
					{
						this.style.backgroundImage = 'url(\'../../images/pagenavigation_ov.gif\')';
					}

					eNode.onmouseout = function()
					{
						this.style.backgroundImage = 'url(\'../../images/pagenavigation.gif\')';
					}
				}
			}
		}
		
		// Add mouseover to the language flags.
		eLanguages = document.getElementById("languages");
		for (i = 0; i < eLanguages.childNodes.length; i++)
		{
			if (eLanguages.childNodes[i].nodeName == "A")
			{
				eImgNode = eLanguages.childNodes[i].childNodes[0];
				eImgNode.onmouseover = function()
				{
					this.src = '../../images/' + this.name + '.gif';
				}

				eImgNode.onmouseout = function()
				{
					this.src = '../../images/' + this.name + '_grijs.gif';
				}
				
			}
		}

	}
}

var bShown = false;
function showSubMenu()
{
	var eMenu = document.getElementById("floating-menu");
	var eSubMenu = document.getElementById('floating-menu-products');

	if (!bShown)
	{
		eMenu.style.backgroundColor = '#CFD3DD';
		eSubMenu.style.display = 'block';
		document.images["inuitklap"].src = '../images/menu_collapse.gif';
		bShown = true;
	}
	else
	{
		eMenu.style.backgroundColor = '';
		eSubMenu.style.display = 'none';
		document.images["inuitklap"].src = '../images/menu_expand.gif';
		bShown = false;
	}				
}

function switchSubmenu(p_iGroupId)
{
	if(document.getElementById('pm_group'+p_iGroupId).style.display != 'block')
	{
		document.getElementById('pm_group'+p_iGroupId).style.display = 'block';
	}
	else
	{
		document.getElementById('pm_group'+p_iGroupId).style.display = 'none';
	}
}

function loadSubMenu( p_iSubMenu )
{
	var eMenu = document.getElementById("floating-menu");
	var eSubMenu = document.getElementById('floating-menu-products');

	eMenu.style.backgroundColor = '#CFD3DD';
	eSubMenu.style.display = 'block';
	document.images["inuitklap"].src = '../../images/menu_collapse.gif';
	bShown = true;

	switchSubmenu (p_iSubMenu);
}