// show()
//
// Function: This function opens the menu and sets its position
function show( div, refpoint )
{
	var dom;
	if ( objElement ) hide(); // hide all other menus
	
	if ( NS4 ) { // Netscape 4 browser family..
		dom = d.layers[div];
		/* DROP THE FOLLOWING TWO LINES IF YOU POSITION THE MENU IN CSS */
		/* If you would like to change the refpoint id:s change it here also */
		dom.left = d.layers['VSMRefPointNS'+refpoint].pageX - 3; // you have to calculate these adjustment values by yourself
		dom.top = d.layers['VSMRefPointNS'+refpoint].pageY + 17;
		dom.visibility = "show";
	}
	else if ( NS6 ) { // Netscape 6 and Dom level 2 compatible browsers
		dom = d.getElementById( div );
		/* DROP THE FOLLOWING TWO LINES IF YOU POSITION THE MENU IN CSS */
		/* If you would like to change the refpoint id:s change it here also */
		dom.style.left = d.getElementById('VSMRefPointIE'+refpoint).offsetLeft - 3; // you have to calculate these adjustment values by yourself
		dom.style.top = d.getElementById('VSMRefPointIE'+refpoint).offsetTop + 6;
		dom.style.visibility = "visible";
	}
	else if ( IE4 || IE5 ) {
		dom = d.all[div];
		/* DROP THE FOLLOWING TWO LINES IF YOU POSITION THE MENU IN CSS */
		/* If you would like to change the refpoint id:s change it here also */
		dom.style.pixelLeft = d.all['VSMRefPointIE'+refpoint].offsetLeft - 3; // you have to calculate these adjustment values by yourself
		dom.style.pixelTop = d.all['VSMRefPointIE'+refpoint].offsetTop + 19;
		dom.style.visibility = "visible";
	}
	
	dom.onmouseover = function(){if(nTimerID>-1){clearTimeout(nTimerID);nTimerID=-1;}}; // hook the timer
	dom.onmouseout = function(){spawnHide(div);};
}

// spawnHide()
//
// Function: This function starts the timer which eventually closes the menu
function spawnHide( div )
{
	if ( nTimerID > -1 ) {
		clearTimeout( nTimerID );
		nTimerID = -1;
	}
	
	if ( NS4 ) objElement = d.layers[div];
		else if ( NS6 ) objElement = d.getElementById(div);
		else if ( IE4 || IE5 ) objElement = d.all[div];
		
	nTimerID = setTimeout( "hide()", nTimerRate );
}

// hide()
//
// Function: This function hides the menu and destroys the timer that was set in spawnHide()
function hide()
{
	if ( nTimerID > -1 ) {
		clearTimeout( nTimerID );
		nTimerID = -1;
	}
	
	if ( NS4 ) objElement.visibility = "hidden";
		else if ( NS6 ) objElement.style.visibility = "hidden";
		else if ( IE4 || IE5 ) objElement.style.visibility = "hidden";
}
