﻿/*Copyright © 2010 
*
*Licensed under the GPL license:
*   http://www.gnu.org/licenses/gpl.html
*
*URL:
*   http://midnightprogrammer.net
*
*Author:
*   Prashant Khandelwal
*
*/

function GetLastTweet(UserName) {
    url = 'http://api.twitter.com/1/statuses/user_timeline/' + UserName + '.json?callback=?';
    $.getJSON(url, function (tweet) {
        $("#tweet").html(tweet[0].text);
    });
}

function GetTweets(UserName, NoOfTweets) {
    url = 'http://api.twitter.com/1/statuses/user_timeline/' + UserName + '.json?include_rts=true&callback=?';
    $.getJSON(url, function (tweets) {
        $("#tweet").append("<ul>");
        for (var i = 0; i < NoOfTweets; i++) {
            $("#tweet").append("<li>" + tweets[i].text + "</li>");
        }
        $("#tweet").append("</ul>");
    });
}

function GetProfileImage(UserName) {
    url = 'http://api.twitter.com/1/statuses/user_timeline/' + UserName + '.json?callback=?';
    $.getJSON(url, function (image) {
        $("#ProfileImage").attr('src', image[0].user.profile_image_url);
    });
}

