// JavaScript Document
jQuery(document).ready(function() {
										  
	//get latest twitter tweet									  
										  
    // set your twitter id
    var user = 'paulgoodenough';
    // using jquery built in get json method with twitter api, return only one result
    jQuery.getJSON('http://twitter.com/statuses/user_timeline.json?screen_name=' + user + '&count=1&callback=?', function(data)      {
          
        // result returned
        var tweet = data[0].text;
      
        // process links and reply
        tweet = tweet.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, function(url) {
            return '<a href="'+url+'" target="_blank">'+url+'</a>';
        }).replace(/B@([_a-z0-9]+)/ig, function(reply) {
            return  reply.charAt(0)+'<a href="http://twitter.com/%27+reply.substring%281%29+%27">'+reply.substring(1)+'</a>';
        });
      
        // output the result
        jQuery("#tweet").html(tweet);
    });
	 
	 
	 jQuery('.clear_field').one("focus", function() {
	  jQuery(this).val("");
	});
	 
	 
      
});


