$(document).ready(function () {   
			
	$('p').defuscate();
	
	var username='lymf'; // set user name
	var format='json'; // set format, you really don't have an option on this one
	var url='http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?'; // make the url
	
	/*$.getJSON(url,function(tweet){ // get the tweets
		$("#last-tweet").html(tweet[0].text); // get the first tweet in the response and place it inside the div
	});*/
	
	$("#last-tweet").tweet({
		username: "lymf",
		join_text: "auto",
		avatar_size: 0,
		count: 1,
		auto_join_text_default: "", 
		auto_join_text_ed: "LYMF",
		auto_join_text_ing: "LYMF was",
		auto_join_text_reply: "LYMF replied",
		auto_join_text_url: "LYMF was checking out",
		loading_text: "loading tweet..."
	});

});

jQuery.fn.defuscate = function( settings ) {
    settings = jQuery.extend({
        link: true
    }, settings);
    var regex = /\b([A-Z0-9._%-]+)\([^)]+\)((?:[A-Z0-9-]+\.)+[A-Z]{2,6})\b/gi;
    return this.each(function() {
        if ( $(this).is('a[@href]') ) {
            // If it's an <a> element, defuscate the href attribute
            $(this).attr('href', $(this).attr('href').replace(regex, '$1@$2'));
            // Make sure that the element's contents is not made into a link
            var is_link = true;
            //alert($(this).attr('href'));
        }
        // Defuscate the element's contents
        $(this).html($(this).html().replace(regex, (settings.link && !is_link ? '<a href="mailto:$1@$2">$1@$2</a>' : '$1@$2')));
  });
}
