var alertTimeoutId = null; var isPostback = false; $(function() { $("#logoutLink").bind("click", asynLogout); $("ul#mainNav>li:last").addClass("current"); $("ul#mainNav>li>a").click(function() { if (!$(this).hasClass("direct")) { if ($(this).parent().hasClass("current")) { return false } $("li", $(this).parent().parent()).removeClass("current"); $(this).parent().addClass("current"); $(this).blur(); parent.left.location = $(this).parent().attr("subHref"); parent.main.location = $(this).parent().attr("href"); return false } }) }); function hideAlert() { if (isPostback == false) { $("#alertContainer>label").fadeOut(); if (alertTimeoutId != null) { clearTimeout(alertTimeoutId); alertTimeoutId = null } } } function displayAlert(sender, e) { $("#alertContainer>label").removeClass(); $("#alertContainer>label").addClass(e.type); if (alertTimeoutId != null) { clearTimeout(alertTimeoutId); alertTimeoutId = null } $("#alertContainer>label").html(e.message).show(); if (e.autoHide == true) { alertTimeoutId = setTimeout(function(e) { $("#alertContainer>label").fadeOut() }, 5000) } } function asynLogout(e) { displayAlert(null, { message: "", type: "loading", autoHide: false }); EnjooSite.Web.WebServices.AsynLogout.Logout(function(result, userContext, methodName) { result = eval("(" + result + ")"); if (result.type == "success") { top.location = result.customData.redirectPath } displayAlert(null, result) }, function(error, userContext, methodName) { displayAlert(null, { message: error.get_message, type: "error", autoHide: true }) }, null); return false };