﻿// JScript File

var _oldBGColor = null;
var _oldFontColor = null;
var _oldClass = null;
function MenuHover(element, bgcolor, fontcolor, link)
{
//    try
//    {
        element.style.cursor = 'pointer';
        element.onclick = function()
        {
            location.href = link;
        }
    
        //get the old color and store it
//        try
//        {
            _oldBGColor = element.style.backgroundColor;
            _oldClass = element.className;
//            _oldFontColor = element.childNodes[0].style.color;
//        }
//        catch (e)
//        {
//            _oldBGColor = element.style.backgroundColor;
//            _oldFontColor = element.style.color;
//        }
        
        //when the element loses focus
        element.onmouseout = function() 
        {
            try
            {
                //change the color back to the old one
                element.style.backgroundColor = _oldBGColor;
                element.className = _oldClass;
//                element.firstChild.style.color = _oldFontColor;
            }
            catch(e)
            {}
        }
        
        
        //change the current color to the highlight color
        element.style.backgroundColor = bgcolor;
        element.className = _oldClass + ' white';
        element.style.color = '#fff';
//        alert(element.childNodes[0]);
//        element.childNodes[0].style.color = fontcolor;
//    }
//    catch(e)
//    {}
}