﻿startList = function(id) 
{
    if (document.getElementById && (navigator.appVersion.indexOf('MSIE 6') != -1)) 
    {
        var navRoot = document.getElementById(id);
        
        if (!navRoot)
        {
            return;
        }
        
        var iframehack = document.createElement("iframe"); 
        iframehack.setAttribute("src", document.forms[0].elements["blankhtml"].value);
        iframehack.setAttribute("frameborder", "none");
        iframehack.style.display = "none";
        iframehack.style.position="absolute";
        iframehack.style.zIndex = 0;
        iframehack.style.border="none";
        iframehack.style.margin="0";
        iframehack.style.padding="0";
            
        for (i=0; i<navRoot.childNodes.length; i++) 
        {
            node = navRoot.childNodes[i];
            if (node.nodeName.toLowerCase() == "li") 
            {
                node.iframehack = iframehack;
                
                node.onmouseover=function() 
                {
                    // IE was getting upset when appending the iframe
                    // when we created it, do it here if it isn't already
                    // added
                    if (this.iframehack.parentNode == null)
                    {
                        document.body.appendChild(this.iframehack);
                    }
                    
                    this.className+=" over";
                    
                    var child = this.firstChild;
                    while (child)
                    {
                        var name = child.nodeName.toLowerCase();
                        
                        // some menus have a panel inside
                        if (name == "div")
                        {
                            child = child.firstChild;
                        }
                        
                        if (name == "ul" || name == "ol")
                        {                                                        
                            // keep in sync with Style.css
                            var marginSize = 0;
             
                            if (!child.fixed)
                            {
                                child.style.top = child.offsetTop + "px";
                                child.fixed = true;
                            }
                            
                            var top = child.offsetTop;
                            var left = child.offsetLeft;
                            var parent = child.offsetParent;
                            while (parent)
                            {
                                top += parent.offsetTop;
                                left += parent.offsetLeft;
                                parent = parent.offsetParent;
                            }
                            
                            this.iframehack.style.display = "block";
                            this.iframehack.style.top = top - marginSize + "px";
                            this.iframehack.style.left = left + "px";
                            this.iframehack.style.width = child.offsetWidth + "px";
                            this.iframehack.style.height = child.offsetHeight + "px";              
                            child.style.display = "block";
             
                        }
                        child = child.nextSibling;
                    }
                }
                node.onmouseout=function() 
                {
                    this.className=this.className.replace(" over", "");
                    iframehack.style.display = "none";
                }
            }
        }
    }
}
window.onload=function() { startList("mainMenu"); };

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();