function SwapImages(imageid, imagepath)
{
    document.getElementById(imageid).src = imagepath;
}

function captureEnterKey(e, buttonid)
{
    if(navigator.appName.indexOf("Netscape")>(-1))
    {
        if (e.keyCode == 13)
        {
            window.document.getElementById(buttonid).click();
            return false;
        }    
    }
    if(navigator.appName.indexOf("Microsoft Internet Explorer")>(-1))
    {
        if(event.keyCode == 13)
        {
            if (window.document.getElementById(buttonid) != null)
            {
                window.document.getElementById(buttonid).click();
            }
            else
            {
                //must use getElementsByTagName() because getElementByID is not reliable
                //as the ClientID written in some nested controls changes.                
                //window.alert('looking for = ' + buttonid);
                
                var elementsArray = window.document.getElementsByTagName('input');
            
                //window.alert(elementsArray.length);
            
                if (elementsArray.length > 0)
                {
                    for(i=0; i< elementsArray.length; i++)
                    {
                        if (elementsArray[i].id.indexOf(buttonid) > 0)
                        {
                            //window.alert('we found id: ' + elementsArray[i].id + ' here');
                            elementsArray[i].click();
                        }
                    }
                }
            }               
            
            return false;
            
        }
    }
}

function fixDropDownList(ListID) 
{
    if (document.all && document.getElementById) {
        
        navRoot = document.getElementById(ListID);
        
        if (navRoot != null)
            for (i=0; i < navRoot.childNodes.length; i++)
            {
                node = navRoot.childNodes[i];
                    
                if (node.nodeName == "LI")
                {
                    node.onmouseover=function()
                    {
                        this.className += " over";
                    }
                    
                    node.onmouseout=function()
                    {
                        this.className = this.className.replace(" over", "");
                    }
                }
            }
    }
}

window.onload = function()
{
    fixDropDownList("mainNav");
    fixDropDownList("userNavOn");
    fixDropDownList("articleMedia");
}
