jQuery(document).ready(function($){
  $.fn.tweetify = function() {
          this.each(function() {
                  $(this).html(
                          $(this).html()
                                  .replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,'<a href="$1">$1</a>')
                                  .replace(/(^|\s)#(\w+)/g,'$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>')
                                  .replace(/(^|\s)@(\w+)/g,'$1<a href="http://twitter.com/$2">@$2</a>')
                  );
          });
          return $(this);
  }
  if($('#twitter').length) {
    $.jTwitter('chasetek', 10, function(data){
      $('#twitter').empty();
        $.each(data, function(i, post){
          $('#twitter').append(
            '<div class="tweet">'
              +' <div class="txt">'
              +    post.text
              +' </div>'
              +'</div>'
          );
      });
      $('#twitter').tweetify();
    });
  }
  
  if ($('#nav ul li ul').length) {
    $('#nav ul li').hover(
      function(){
        $('ul',this).show();
      }, function() {
        $('ul',this).hide();
      });
  }
});
