var Functions = {

    oldLayer    : false,

    showHide : function (item)
	{
        var a = document.getElementsByClassName('people-toggle');
        
        for(var i = 0; i<a.length;i++)
        {
            if ($(a[i]).id == item)
            {
                $(a[i]).style.display = 'block';
            }
            else
            {
                $(a[i]).style.display = 'none';
            }
        }
	},
    
    showSubMenu : function (item, link)
    {
        if (Functions.oldLayer != false)
        {
            $(Functions.oldLayer).style.display = 'none';
        }

        Position.clone($(link), $(item), {
            setLeft   : true,
            setTop    : true,
            setHeight : false,
            setWidth  : false,
            offsetLeft : 0,
            offsetTop  : 21
        });

        $(item).style.display = 'block';

        Functions.oldLayer = item;        
    },
        
    hideMenu   : function(event)
    {
        a = Position.cumulativeOffset($(Functions.oldLayer));
        b = Element.getDimensions($(Functions.oldLayer));

        cIX = Event.pointerX(event);
        cIY = Event.pointerY(event);

        if ( (a[0] < cIX && a[1] < cIY) && ((a[0]+b.width) > cIX && (a[1]+b.height) > cIY)  ) 
        {
            $(Functions.oldLayer).style.display = 'block';
        }
        else 
        {
            $(Functions.oldLayer).style.display = 'none';
        }
    }
};
