Site = {
	register: function(){
		$('#register').bind('click', function(){
			var page = $('#light'),
				url  = $(this).attr('href');
		
			if (page.length <= 0)
				page = $('<div id="light"></div>').appendTo(document.body).hide();
		
			$.ajax({
				url: url,
				dataType: 'html',
				success: function(data){
					page.html(data).fadeIn();
					Cufon.refresh();
				}
			});
		
			$(this).blur();
		
			return false;
		});
	
		$('#light div.widget-close').live('click', function(){
			$(this)
				.parent()
					.parent().hide().end()
				.remove();
		});

	},
	
	photos: function(){
		$('#photos a').lightBox();
	},
	
	cufon: function(){
		// Must be triggered before AND outside a document.ready event
		$(document.body).addClass('hasJS cufon-start');
		Cufon.replace('#nav a, #credits', { separate: 'none' });
		Cufon.replace('h2, h3', { color: '-linear-gradient(#d7d7d7, #fbfbfb)', textShadow: '#222 1px 2px', separate: 'none' }); // Gradient: #d7d7d7, #fbfbfb
		Cufon.replace('#page h2, #page h3, #light h2', { textShadow: null }); // No shadow, no gradient
		Cufon.now();
	},
	
	init: function(){
		Site.photos();
		Site.register();
	}
}

Site.cufon();
$(document).ready(Site.init);
