﻿$(document).ready(function() {
    var searchList = new Array();
    /*The twitter search list has a limited number of characters,
    when there are too many characters, the twitter returns an error.
    The digits below indicate the valid size for search string
    */
                   //1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
    searchList[0] = "mspartner,msuspartner,wmpartner,wpc10,wpcdc,InfraWPC,bldg121,MSWindows,EverythingMS,MicrosoftS2B,win7,mpnkr";
    searchList[1] = "Office_Live,SharePoint,Azure,bizspark,MicrosoftWave,office2010,oemsystembuildr,IE8,vfiorg,MSCaseStudies";
    searchList[2] = "ucteam,MSOnline,WindowsAzure,WindowsPhone,Windowsmobile,MSEurope,PartenairesMS,mspartneruc,wpc10us";

    $.Juitter.start({
        searchType: "searchWord",
        juitterSearchList: searchList,
        live: "live-90", // the number after "live-" indicates the time in seconds to wait before request the Twitter API for updates.
        placeHolder: "juitterContainer",
        loadMSG: "loading twitter feed...",
        imgName: "/content/images/main/loader.gif",
        total: 20,
        readMore: "view this tweet",
        nameUser: "image"
    });
    $("body#home-mpn #feeds").css("overflow-y", "auto");

    $("#twitter-All").click(function() {
        $("body#home-mpn #feeds").css("overflow-y", "hidden");
        $(".jLinks").removeClass("on");
        $(this).addClass("on");
        $.Juitter.start({
            searchType: "searchWord",
            juitterSearchList: searchList,
            live: "live-90",
            placeHolder: "juitterContainer",
            loadMSG: "loading...",
            imgName: "/content/images/main/loader.gif",
            total: 20,
            readMore: "view this tweet",
            nameUser: "image"
        });
        $("body#home-mpn #feeds").css("overflow-y", "auto");
    });

    $("#twitterNavDiv a:not(#twitter-All)").click(function() {
        $("body#home-mpn #feeds").css("overflow-y", "hidden");
        $(".jLinks").removeClass("on");
        $(this).addClass("on");

        var searchObject = new Array();
        searchObject[0] = this.hash.replace("#", "");

        $.Juitter.start({
            searchType: "searchWord",
            juitterSearchList: searchObject,
            live: "live-90",
            placeHolder: "juitterContainer",
            loadMSG: "loading...",
            imgName: "/content/images/main/loader.gif",
            total: 20,
            readMore: "view this tweet",
            nameUser: "image"
        });
        $("body#home-mpn #feeds").css("overflow-y", "auto");
    });
});
