﻿ menuOver = function() {

          // run menuOver only for IE < 7
          if (typeof document.body.style.maxHeight != 'undefined') {
            return false
          }

          var listItems = document.getElementById('navigation').getElementsByTagName('LI')

          for (var i = 0; i < listItems.length; i++) {
            
            listItems[i].onmouseout = function() { this.className = this.className.replace(new RegExp(' hover\\b'), '') }
            listItems[i].onmousemove = function() { this.className += ' hover' }
          }
          
        }

        // run for IE only
        if (window.attachEvent) window.attachEvent('onload', menuOver)

    function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
    {
       var arVersion = navigator.appVersion.split("MSIE")
       var version = parseFloat(arVersion[1])
       if ((version >= 5.5) && (document.body.filters)) 
       {
          for(var i=0; i<document.images.length; i++)
          {
             var img = document.images[i]
             var imgName = img.src.toUpperCase()
             if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
             {
                var imgID = (img.id) ? "id='" + img.id + "' " : ""
                var imgClass = (img.className) ? "class='" + img.className + "' " : ""
                var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
                var imgStyle = "display:inline-block;" + img.style.cssText 
                if (img.align == "left") imgStyle = "float:left;" + imgStyle
                if (img.align == "right") imgStyle = "float:right;" + imgStyle
                if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
                var strNewHTML = "<span " + imgID + imgClass + imgTitle
                + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
                + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
                img.outerHTML = strNewHTML
                i = i-1
             }
          }
       }    
    }
    if (window.attachEvent) window.attachEvent('onload', correctPNG)
    
    function hideMenu()
    {
        // run for IE6 only
        if (typeof document.body.style.maxHeight != 'undefined' || !document.all) {
            return false
        }
        menuLIs = document.getElementById('navigation').getElementsByTagName('LI');
        targetObj = window.event.srcElement;
        // if object firing event is not LI then hide menu
        for (var i = 0; i < menuLIs.length; i++) {
            if (menuLIs[i].className.indexOf("hover") != -1 && targetObj.parentNode.tagName.toUpperCase() != "LI") {
                menuLIs[i].className = menuLIs[i].className.replace(new RegExp(' hover\\b'), '');
                break;
            }
        }
        // if object firing event is a top level LI
        // but not one currently showing menu then hide these menus (but not its own)
        if (targetObj.parentNode && targetObj.parentNode.parentNode && targetObj.parentNode.parentNode.parentNode && targetObj.parentNode.parentNode.parentNode.id == "navigation")
        {
            topMenuLIs = targetObj.parentNode.parentNode.childNodes
            for (var i = 0; i < topMenuLIs.length; i++) {
                if (topMenuLIs[i] != targetObj.parentNode) {
                    topMenuLIs[i].className = topMenuLIs[i].className.replace(new RegExp(' hover\\b'), '');
                }
            }
        }
    }