var GLOBAL_ACCOUNT_MENU = GLOBAL_ACCOUNT_MENU || { }; GLOBAL_ACCOUNT_MENU.init = function(userName) { if(userName == null || userName == "" || userName == "undefined") return; try { var html = ""; html += ("Hello, " + userName + "! "); html += ("My Account ▼"); html += (""); $("#global-header-controls-account").html(html); $("#global-header-controls-account-link").click(GLOBAL_ACCOUNT_MENU.show); $("#global-header-controls-account-menu").mouseleave(GLOBAL_ACCOUNT_MENU.hide); } catch(err) { } } GLOBAL_ACCOUNT_MENU.show = function() { if(! $("#global-header-controls-account-menu").is(":visible")) { $("#global-header-controls-account-menu").slideDown(); } else { GLOBAL_ACCOUNT_MENU.hide(); } return false; } GLOBAL_ACCOUNT_MENU.hide = function() { if($("#global-header-controls-account-menu").is(":visible")) $("#global-header-controls-account-menu").slideUp(); else $("#global-header-controls-account-menu").slideDown(); return false; } $(document).ready(function() { GLOBAL_ACCOUNT_MENU.init(""); });