/** menus **/

function Menus()
{
}

Menus.activeElement = null;
Menus.activeSrc = null;
Menus.hider = null;

Menus.prototype.mouseOver = function(element)
{
    if( (element == Menus.activeElement) || (element == Menus.activeSrc) ) {
		if( Menus.hider != null ) {
		    clearTimeout( Menus.hider );
		    Menus.hider = null;
		}
		return;
    }

    if( Menus.activeElement != null ) {
		if( Menus.hider != null )
		    clearTimeout( Menus.hider );
		Menus.hider = null;
		this.finalCleanup();
    }

    var subId = element.getAttribute( "subid" );
    var child = document.getElementById( "sub_" + subId );

    if( !child ) return;

    var pos = getPageCoords( element );

    child.style.left = (pos.x - 10) + "px";
    child.style.top = (pos.y + 55) + "px";
    child.style.display = "block";
    child.style.width = (element.offsetWidth + 20) + "px";
    element.style.color = "#0965ae";
    Menus.activeSrc = element;
    Menus.activeElement = child;
}

Menus.prototype.mouseOut = function(element)
{
    if( Menus.hider != null ) return;
    if( Menus.activeElement == null ) return;

    Menus.hider = setTimeout( this.finalCleanup, 800 );
}

Menus.prototype.finalCleanup = function()
{
    if( Menus.activeElement == null ) return;
	    Menus.activeElement.style.display = "none";
    
    if( Menus.activeSrc != null) {
		Menus.activeSrc.style.color = "";
    }
    
    Menus.activeSrc = null;
    Menus.hider = null;
}

