﻿//Scripts that are loaded on every page
if (!ActiveHealthyKids)
{
    var ActiveHealthyKids = {};
}

ActiveHealthyKids.GlobalScripts = {
    InitializeMenu: function () {
        // Create div to simulate menu hover effect
        $('.MenuItemGroup').parent().append("<div class='MenuArrow' style='display: none;'></div>");
        
        // Add arrow effect to menu on hover
        $('.MenuItemGroup>tbody>tr>td').each( function (i) {
            $(this).hover( function () {
            
                // Set arrow position and display
                var offset = $(this).offset(),
                    $MenuArrow = $('.MenuArrow'),
                    top = offset.top + $(this).height(),
                    left =  offset.left + 7;
                $MenuArrow.css( { top: top, left: left, display: 'block' } );
                
            }, function () {
            
                // Hide arrow
                $('.MenuArrow').hide();
                
            });
        });
    }
};