var oAnim;  // Animation instance

function RenderNavigation(id)
{
	var YahooMenu = new YAHOO.widget.MenuBar(id, { autosubmenudisplay:true, showdelay:100, hidedelay:200, lazyload:true });
	if (YAHOO.env.ua.ie != 6) {
		YahooMenu.subscribe("beforeShow", onSubmenuBeforeShow);
		YahooMenu.subscribe("show", onSubmenuShow);
	}
	YahooMenu.render();
}

function onSubmenuBeforeShow(p_sType, p_sArgs) {

    var oBody, oElement, oUL;

    if (this.parent) {

        oElement = this.element;

        if (oAnim && oAnim.isAnimated()) {
        
            oAnim.stop();
            oAnim = null;
        
        }

        oBody = this.body;
        oBody.style.overflow = "hidden";
        oUL = oBody.getElementsByTagName("ul")[0];
        oUL.style.marginTop = ("-" + oUL.offsetHeight + "px");
    
    }

}

function onSubmenuShow(p_sType, p_sArgs) {

    var oElement, oUL;

    if (this.parent) {

        oElement = this.element;
        oUL = this.body.getElementsByTagName("ul")[0];

        oAnim = new YAHOO.util.Anim(oUL, { marginTop: { to: 0 } }, .5, YAHOO.util.Easing.easeOut);
        oAnim.animate();
    
    }

}
