﻿
var Twitter =
{
	Username: "delfinoroofing",

	LoadTweet: function () {
		var format = 'json'; // set format, you really don't have an option on this one
		var url = 'http://api.twitter.com/1/statuses/user_timeline/' + Twitter.Username + '.' + format + '?callback=?';

		$.getJSON(url, Twitter.HandleGetLastTweet);
	},

	HandleGetLastTweet: function (tweet) { // get the tweets
		var txt = tweet[0].text;
		$("#latest-tweet").html('&ldquo;' + txt + '&rdquo;');
	},

	Init: function () {
		Twitter.LoadTweet();
	}
}


var ExternalizeLinks =
{
	Init: function () {
		$('a[href^=http://]').click(function () {
			window.open($(this).attr("href"), "newWin");
			return false;
		});
	}
}

$(document).ready(function () {
	Twitter.Init();
	ExternalizeLinks.Init();
});
