   $(document).ready(function() {
 
        var $tweetForm = $('#TweetForm');
        var $statusTextArea = $('#status', $tweetForm);
        var $charsUsedLabel = $('.chars-used', $tweetForm);
        var $charsRemainingLabel = $('.chars-unused', $tweetForm);
 
        $('#submitButton').click(function() {
            var url = $tweetForm.attr('action') + '?' + $statusTextArea.attr('name') + '=' + encodeURIComponent($statusTextArea.val());
            window.open(url);
            return false;
        });
        
        $statusTextArea.keyup(function() {
            var charsMax = 140;
            var charsUsed = $statusTextArea.val().length;
            var charsRemaining = charsMax - charsUsed;
            $charsUsedLabel.text(charsUsed).toggleClass('over-limit', charsRemaining < 0);
            $charsRemainingLabel.text(charsRemaining).toggleClass('over-limit', charsRemaining < 0);
        });
        
        // lets make the current URL, a bit.ly address
        BitlyCB.shortenResponse = function(data) {
            var result;
            for (var r in data.results) {
	            result = data.results[r];
	            result['longUrl'] = r;
	            break;
            }
            $statusTextArea.val(result.shortUrl + ' - ');
            $statusTextArea.keyup();
            $statusTextArea.show('blind', undefined, 'fast', null);
        }
        $statusTextArea.hide();
        BitlyClient.shorten(window.location.href, 'BitlyCB.shortenResponse');
    });