﻿function UpdateUserElements() {
    var rq = g_StatusDoc;
    var count = parseInt(rq.find("#CartItems").text());
    $("#CartItemCount").text(count.toString());
    var isAuthenticated = parseInt(rq.find("#IsAuthenticated").text()) == 1;
    if (isAuthenticated) {
        $("#SignInText").text(rq.find("#LoginText").text());
        $("#SignInLink").text(" [Sign Out]");
    } else {
        $("#SignInText").text("");
        $("#SignInLink").text("Sign In");
    }            
    $("#UserMenuItems").html(rq.find("#MenuItems").html());
}
function UpdateBottomPanelPosition() {
    if ($("#aspnetForm").height() < ($(document).height() - 20)) {
        $("#ctl00_BottomMenuPanel").addClass("bmstatic");
    }
}
function UpdateMasterElements() {
    $.post('webservices/getCartStatus.aspx', '', function(response, status, req) {
        g_StatusDoc = $(response);
        UpdateUserElements();
    });
    UpdateBottomPanelPosition();
}
//$(document).ready(function() {
//    g_IsReady = true;
//    if (g_StatusDoc != null)
//        UpdateUserElements();
//});
$(window).load(function() {
    UpdateBottomPanelPosition();
});
function checkSearch() {
    var isSearch = g_IsSearch;
    g_IsSearch = false;
    return !isSearch;
}
