﻿/* menubar definition for application style menu bar */

YAHOO.util.Event.onDOMReady(function() {
    // alert("dom ready");

    // instantiate MenuBar
    try {
        var oMenuBar = new YAHOO.widget.MenuBar("navMenu"); 
    } catch (e) { alert(e); };
    
   
    try {
        oMenuBar.render();
        oMenuBar.show();
        
    } catch (e) { alert(e); };
    // alert("rendered menu");
    // add a "show" event listener
    function onSubmenuShow() {
        var oIFrame, oElement, nOffsetWidth;
        // keep left-most submenu against the left browser viewport

        if (this.id == "aboutMenu") {
            YAHOO.util.Dom.setX(this.element, 0);
        }
        oIFrame = this.iframe;

        if (oIFrame) {
            YAHOO.util.Dom.setX(oIFrame, 0);
        }
        // set width of submenus in IE to prevent the mouseout event from firing prematurely
        if ((this.id == "infomenu" || this.id == "aboutusmenu") && YAHOO.env.ua.ie) {
            oElement = this.element;
            nOffsetWidth = oElement.offsetWidth;
            // measure difference of offsetwidth before and after setting width to compute padding and borders
            oElement.style.width = nOffsetWidth + "px";
            oElement.style.width = (nOffsetWidth - (oElement.offsetWidth - nOffsetWidth) + "px");

        }
    }

    // subscribe to onSubMenuShow event
    oMenuBar.subscribe("show", onSubmenuShow);

    // alert("I made it through the menu");
});