$(document).ready(function() {

	// signup : show subdomain examples
	$('#show-subdomain-examples-link').click(function() {
		$('table#subdomain-examples').toggle();
		return false;
	});

	var twitter_url = "http://twitter.com/status/user_timeline/servicesidekick.json?count=1&callback=?";
	
	String.prototype.linkify = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/, function(m) {
    	return m.link(m);
  	});
 	};
 	
	$.getJSON(twitter_url, function(data){
	  $.each(data, function(i, item) {
	    var tweet = '<li>' + item.text.linkify() + '</li>';
	    $('ul#tweets').empty().append(tweet);
    });
	});

	$('a.fancyvideo').fancybox({
		'frameWidth': 660,
		'frameHeight': 525,
	  'callbackOnClose': function() {
			// finish the video after closingfancybox
			$('#fancy_content').empty();
		}
	});
	
	$('body.videos a.title').click(function(){
    $(this).parents('li').find('.video_embed').toggle();
	  return false;
	})
});