// Functions and Classes
function LinkClass(title,text,imagesrc,link,linktype)
{
	this.title = title;
	this.text = text;
	this.imagesrc = imagesrc;
	this.link = link;
	this.linktype = linktype;
}

function ShowSubMenu(ImageID,ItemNumber)
{
	var x, y;
	x = 0;
	y = 0;
	
	if (document.getElementById && document.getElementById('SubMenu') != null)
	{
		// Get Coordinate
		/*
		i="";
		me=document.getElementById('tdtest1');
		
		while (me.parentElement != null)
		{
			
			if (me.tagName != "TR" && me.tagName != "A")
			{
				x += me.offsetLeft;
				y += me.offsetTop;
			}
			
			i += me.tagName;
			i += " (" + me.offsetLeft + "," + me.offsetTop + ")";
			i += "\n";
			me=me.parentElement;
		}
		alert(i + ",x:" + x + ",y:" + y)
		*/
		//alert(document.getElementById('SubMenuLink' + ItemNumber).offsetWidth)
		// Move SubMenu
		document.getElementById('SubMenu').style.left = 116 + 8;
		
		if(document.body.scrollTop > 86)
			document.getElementById('SubMenu').style.top = document.body.scrollTop;//90 + ((ItemNumber-1) * 20);
		else
			document.getElementById('SubMenu').style.top = 86;//90 + ((ItemNumber-1) * 20);
		
		// Fill SubMenu
		FillSubMenu(ItemNumber);
		
		// Show SubMenu
		document.getElementById('SubMenu').style.visibility='visible';
	}
	else if (document.layers && document.layers['SubMenu'] != null)
	{
		//position
		document.layers['SubMenu'].left = 116 + 8;
		document.layers['SubMenu'].top = 86;
		
		
		
		// Fill SubMenu
		//alert(LinkArray.length)
		FillSubMenu(ItemNumber);
		
		// Show SubMenu
		document.layers['SubMenu'].visibility = 'visible';
	}
	else if (document.all)
	{
		alert('')
		// Get Coordinate
		i="";
		me=document.all[ImageID];
		while (me.parentElement != null)
		{
			if (me.tagName != "TR" && me.tagName != "A")
			{
				x += me.offsetLeft;
				y += me.offsetTop;
			}
			
			i += me.tagName;
			i += " (" + me.offsetLeft + "," + me.offsetTop + ")";
			i += "\n";
			me=me.parentElement;
		}
		alert(i + ",x:" + x + ",y:" + y)

		// Move SubMenu
		document.all['SubMenu'].style.left = x + 8;
		document.all['SubMenu'].style.top = y;
		
		// Show SubMenu
		document.all['SubMenu'].style.visibility = 'visible';
	}
	else
	{
		alert("")
	}
}

function HideSubMenu()
{
	if (document.getElementById && document.getElementById('SubMenu') != null)
		node = document.getElementById('SubMenu').style.visibility='hidden';
	else if (document.layers && document.layers['SubMenu'] != null)
		document.layers['SubMenu'].visibility = 'hidden';
	else if (document.all)
		document.all['SubMenu'].style.visibility = 'hidden';
}

function FillSubMenu(ItemNumber)
{
	DataValue = "";
	
	DataValue += "<table border=0 cellspacing=0 cellpadding=0 height=\"100%\" width=\"100%\">";
	DataValue += "<tr>";
	DataValue += "<td rowspan=5 class=\"Line\"><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "<td colspan=3 class=\"Line\"><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "<td rowspan=5 class=\"Line\"><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "</tr>";
	DataValue += "<tr>";
	DataValue += "<td colspan=3><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "</tr>";
	DataValue += "<tr>";
	DataValue += "<td><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "<td height=\"100%\" valign=top class=\"Menu\">";
	DataValue += "<table border=0 cellspacing=0 cellpadding=5>";
	DataValue += "<tr><td>";
	DataValue += "<table border=0 cellspacing=0 cellpadding=0>";
	DataValue += "<tr><td><img SRC=\"images/Spacer.gif\" width=300 height=1></td></tr>";
	DataValue += "<tr><td height=20 class=\"MenuTitleText\">" + LinksArray[ItemNumber].title + "</font></td></tr>";
	DataValue += "<tr><td class=\"MenuText\">" + LinksArray[ItemNumber].text + "</font></td></tr>";
	
	if(LinksArray[ItemNumber].imagesrc != "")
		DataValue += "<tr><td class=\"MenuText\"><br>Voorbeeld<br><img src=\"" + LinksArray[ItemNumber].imagesrc + "\" WIDTH=150 HEIGHT=113></td></tr>";
	
	DataValue += "</table>";
	DataValue += "</td></tr>";
	DataValue += "</table>";
	DataValue += "</td>";
	DataValue += "<td><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "</tr>";
	DataValue += "<tr>";
	DataValue += "<td colspan=3><img SRC=\"images/Spacer.gif\" width=1 height1></td>";
	DataValue += "</tr>";
	DataValue += "<tr>";
	DataValue += "<td colspan=3 class=\"Line\"><img SRC=\"images/Spacer.gif\" width=1 height=1></td>";
	DataValue += "</tr>";
	DataValue += "</table>";
	
	if (document.getElementById && document.getElementById('SubMenu') != null)
	{
		document.getElementById('SubMenu').innerHTML = DataValue;
	}
	else if (document.layers && document.layers['SubMenu'] != null)
	{
		document.layers['SubMenu'].document.open();
		document.layers['SubMenu'].document.write(DataValue);
		document.layers['SubMenu'].document.close();
	}
	else if (document.all)
	{
		document.all('SubMenu').innerHTML = DataValue;
	}
}
