$(document).ready(function(){
	
	var username='fylingdalesinn'; // 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(linkify(tweet[0].text)); // get the first tweet in the response and place it inside the div
	});
	
	$("a[rel=Gallery]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
	
	$('.Gallery').cycle({
		fx: 'fade',
		speed:  4500	    // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
});

function linkify(string){
     string = string.replace(
     /((https?\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi,
     function(url){
          var full_url = url;
          if (!full_url.match('^https?:\/\/')) {
          full_url = 'http://' + full_url;
     }
     return '<a href="' + full_url + '">' + url + '</a>';
     }
);
return string;
}
