$(document).ready(function(){
  tweakLayout();
  $(window).resize(function() {tweakLayout();});
});

function tweakLayout()
{
  if ($('body').width() >= 700)
  {
    $('.mainHeading').css('marginLeft', '350px');
  }
  else
  {
    $('.mainHeading').css('marginLeft', '0px');
  }
}

function showTweet(data)
{
  if (data.length > 0)
  {
    var tweet = data[0];
    
    $(document).ready(function() {
      var username = tweet.user.screen_name;
      var status = tweet.text.replace(/((https?|s?ftp|ssh)\:\/\/[^"\s\<\>]*[^.,;'">\:\s\<\>\)\]\!])/g, function(url) {
        return '<a href="'+url+'">'+url+'</a>';
      }).replace(/\B@([_a-z0-9]+)/ig, function(reply) {
        return reply.charAt(0)+'<a href="http://twitter.com/'+reply.substring(1)+'">'+reply.substring(1)+'</a>';
      });
      
      $('#twitter #tweet').html(status).show();  
      $('#twitter #time').html(relative_time(tweet.created_at)).show();  
    });                                
  }
}                          

