var TweetThisLink = {
    shorten : function(e) {
        // this stops the click, which will later be handled in the  response method
        e.preventDefault();
        var url = document.location.href+"#xtor=RSS-586-[twitter]";
        BitlyClient.shorten(url, 'TweetThisLink.response');
    },
    
    response : function(data) {
        var bitly_link = null;
        for (var r in data.results) {
            bitly_link = data.results[r]['shortUrl']; 
            break;
        }
        var tweet_text = 'via @cadremploi - '+$('.chapeau h2').html().substr(0,110);
        document.location = "http://twitter.com/home?status=" + encodeURIComponent(tweet_text + ' - ' + bitly_link);
    }
}



