﻿var state = StateHandler.getInstance();
$(document).ready(function() {
    state.readUrl();
    $.ajax({
        type: "POST",
        url: "/Service/Community.asmx/GetNewestCustomLists",
        data: "{'count':'9'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            var json = eval('(' + msg.d + ')');
            
            $("#widgetUserCollections").setTemplate($("#CommunityCustomListTemplate").html());
            $("#widgetUserCollections").processTemplate(json);
        }
    });  
    $.ajax({
        type: "POST",
        url: "/Service/Community.asmx/GetNewestVideos",
        data: "{'genreID':'0','count':'9'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            var json = eval('(' + msg.d + ')');            
            $("#widgetVideos").setTemplate($("#CommunityVideoTemplate").html());
            $("#widgetVideos").processTemplate(json);
        }
    });  
     $.ajax({
        type: "POST",
        url: "/Service/Community.asmx/GetNewestComments",
        data: "{'genreID':'0','count':'9'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            var json = eval('(' + msg.d + ')');            
            $("#widgetComments").setTemplate($("#CommunityCommentTemplate").html());
            $("#widgetComments").processTemplate(json);
        }
    });  
    $.ajax({
        type: "POST",
        url: "/Service/Charts.asmx/GetItunesTop20",
        data: "{'genreID':'0','type':'Paid','sort':'Position'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            var json = eval('(' + msg.d + ')');          
            $("#top100").setTemplate($("#Top100ListTemplate").html());
            $("#top100").processTemplate(json);           
        }
    });
});
