﻿function loadWidget(wurl, tocontrol) {
    jQuery("#" + tocontrol).addClass("wait");


    $.ajax({
        type: "POST",
        url: wurl,
        cache:false,
        contentType: "application/json; charset=utf-8",
        dataType: "html",
        beforeSend: function(xhr) {

            jQuery("#" + tocontrol).removeClass("wait");
            jQuery("#" + tocontrol).addClass("wait");

        },
        success: function(msg) {

            jQuery("#" + tocontrol).removeClass("wait");
            jQuery("#" + tocontrol).html(msg);


        },
        error: function(XMLHttpRequest, textStatus, errorThrown) {
            jQuery("#" + tocontrol).removeClass("wait");
             


        }
    });
}

$(document).ready(function() {
    loadWidget('widget/XHR/getLastReview.ashx', 'divLastRev');
    loadWidget('widget/XHR/getNewBookList.ashx', 'divNewBookWidgetList');
    loadWidget('widget/XHR/getNewsList.ashx', 'divNewsListGadged');
    loadWidget('widget/XHR/getMostBook.ashx', 'mostViewBooksWidged');
}); 
