﻿var menuRules = 
{
    '#menuItemHome' : function (element)
    {
        element.onmouseover = function ()
        {
            Element.removeClassName(element, "header_menu_color");
            Element.addClassName(element, "menuItemHome_color");
        }
        
        element.onmouseout = function ()
        {
            Element.removeClassName(element, "menuItemHome_color");
            Element.addClassName(element, "header_menu_color");
        }
        
        element.onclick = function ()
        {
            location.href = "LeadForm.aspx";
        }
    },
    
    '#menuItemResources' : function (element)
    {
        element.onmouseover = function ()
        {
            Element.removeClassName(element, "header_menu_color");
            Element.addClassName(element, "menuItemResources_color");
        }
        
        element.onmouseout = function ()
        {
            Element.removeClassName(element, "menuItemResources_color");
            Element.addClassName(element, "header_menu_color");
        }
        
        
        element.onclick = function ()
        {
            location.href = "Resources.aspx";
        }
    },
    
    '#menuItemNews' : function (element)
    {
        element.onmouseover = function ()
        {
            Element.removeClassName(element, "header_menu_color");
            Element.addClassName(element, "menuItemNews_color");
        }
        
        element.onmouseout = function ()
        {
            Element.removeClassName(element, "menuItemNews_color");
            Element.addClassName(element, "header_menu_color");
        }
        
        
        element.onclick = function ()
        {
            location.href = "News.aspx";
        }
    },
    
    '#menuItemAdmin' : function (element)
    {
        element.onmouseover = function ()
        {
            Element.removeClassName(element, "header_menu_color");
            Element.addClassName(element, "menuItemAdmin_color");
        }
        
        element.onmouseout = function ()
        {
            Element.removeClassName(element, "menuItemAdmin_color");
            Element.addClassName(element, "header_menu_color");
        }
        
        
        element.onclick = function ()
        {
            location.href = "Admin.aspx";
        }
    },
    
    '#menuItemSignOut' : function (element)
    {
        element.onmouseover = function ()
        {
            Element.removeClassName(element, "header_menu_color");
            Element.addClassName(element, "menuItemLogin_color");
        }
        
        element.onmouseout = function ()
        {
            Element.removeClassName(element, "menuItemLogin_color");
            Element.addClassName(element, "header_menu_color");
        }
        
        
        element.onclick = function ()
        {
            location.href = "SignOut.aspx";
        }
    },
    
    '#menu_table' : function (element)
    {
        if (location.href.indexOf("RegisterNewUser.aspx") != -1 ||
            location.href.indexOf("Approvals.aspx") != -1 ||
            location.href.indexOf("CreatePassword.aspx") != -1 ||
            location.href.indexOf("ForgotPassword.aspx") != -1)
        {
            element.style.display = "none";
            $("noMenu_table").style.display = "inline";
        }
        else
        {
             element.style.display = "inline";
            $("noMenu_table").style.display = "none";
        }
    }
}

Behaviour.register (menuRules);


