﻿var _asyncContent = null;

function loadContent(showCartDetails, showAds, showArticles, showFeedback) {

    var contentRequest = { "__type": "CometX.CommerceCommander.Json.Content.ContentRequest",
        "ShowCartDetails": showCartDetails,
        "ShowAds": showAds,
        "ShowArticles": showArticles,
        "ShowFeedback": showFeedback
    }

    Sys.Net.WebServiceProxy.invoke('/webservices/ContentService.asmx', 'GetContent', false, { "request": contentRequest }, contentReceived, contentRequestError, contentRequest, 5000);
}

function contentReceived(result, originalRequest) {
    _asyncContent = result;

    if (originalRequest.ShowCartDetails) {
        if (typeof window.loadCartDetails == 'function') {
            loadCartDetails();
        }
    }
    
    if (originalRequest.ShowArticles) {
        if (typeof window.loadAsyncArticles == 'function') {
            loadAsyncArticles();
        }
    }

    if (originalRequest.ShowAds) {
        if (typeof window.loadAsyncAds == 'function') {
            loadAsyncAds();
        }
    }
}

function contentRequestError(sender, args) {

}


