// ********************************************************************************
// Coding Copyright by Mive 2007
//
// Author : H.M.van Egdom (iulius)
//
// Materials, techniques and documents available on mive.nl or any other
// of the websites owned or/and designed by Mive Communications are protected 
// by the copyright laws of the Netherlands and other contries.
//
// Third-Party Libraries or code are copyrighted by the respected owners. For
// more information regadering this software see the copyright info included 
// in that particular library or file or contact with Mive
//
// Copyright 2007 Mive	
// ********************************************************************************

var strMenuToHide = "";
var obTimer = new Array(); 

// The menu will be displayed when a user goes over a menu Item
function fnOnHoverItem(idMenu)
{
	var aPoint = fnCalculateDimension(document.getElementById(idMenu));	

	document.getElementById('sub_' + idMenu).style.top = (aPoint[0] + 19) + "px"
	document.getElementById('sub_' + idMenu).style.left = (aPoint[1] + 5) + "px"
	document.getElementById('sub_' + idMenu).style.display = "block";
	clearTimeout(obTimer[idMenu]);
}

// When a user leaves an item the menu menu must be displayed. However, since he kan enter the 
// the menu itself, it will not be hidden directly, a timer will be set which can be cleared when he
// enters an other part of the menu
function fnOutHoverItem(idMenu)
{
	strMenuToHide = idMenu;
	obTimer[idMenu] = setTimeout('fnHideMenu()',1);
}

// When a user leaves a menu the menu must be hidden. (see previous function)
function fnOutHoverMenu(idMenu)
{
	strMenuToHide = idMenu;
	obTimer[idMenu] = setTimeout('fnHideMenu()',1);
}

// Display the menu it an item, a menu or a text is hovered
function fnOnHoverMenu(idMenu)
{
	clearTimeout(obTimer[idMenu]);
}

// This function does hide the menu at instance
function fnHideMenu()
{
	document.getElementById('sub_' + strMenuToHide).style.display = "none";
}

// Deze functie rekenet (recursief) de locatie van het object waarbij 0,0 de linkerbovenhoek is
// Post	:	obElement is het object / element waarvan de hoogte bekend moet worden
// Pre	:	er word een array teruggestuurd waarbij array[0] de top van het element bevat en array[1] de linker waarde
function fnCalculateDimension(obElement) 
{
	// Defineer de hoogte van het object standaard op 0,0
    var iTopOfElement = 0, iLeftOfElement = 0;
    
    // Vraag nu de offset hoogte op en tel deze hoogte op bij de offset hoogte van het parentelement, net zo lang
    // tot er geen parentElement meer is
    while(obElement)
    {
		iTopOfElement += obElement.offsetTop  || 0;
		iLeftOfElement += obElement.offsetLeft || 0;
		obElement = obElement.offsetParent;
    }

	// Return de coordinaten
    return [iTopOfElement, iLeftOfElement];  
}


// We will send the password of the user to the server within a SHA1 hash. This is not helping preventing a onauthorized login.
// Since the text is send unecrypted over the internet a certain persoon is still able to listen to the packets. However, the 
// password itself will be encrypted. This is only for the sake of there, it's not voor the sake of the system. 
function fnSubmitInlogForm()
{
	document.forms.manLogin.submit();
}
