
$(document).ready(function () {
	
	var window_width = $(window).width();
	var window_height = $(window).height();
	
	$("a#spaz").click(function(e) {
		e.preventDefault();
		$("img.spacecadet").each(function(s) {
			
			var pos_left = Math.floor(Math.random()*(window_width-$(this).width()));
			var pos_top = Math.floor(Math.random()*(window_height-$(this).height()));
			
			// if they have scrolled down - pump it down into view
			pos_top += $(window).scrollTop();
			
			$(this).css('left', pos_left);
			$(this).css('top', pos_top);
			$(this).css('display', 'block');
			$(this).click(function(img) {
				$(this).css('display', 'none');
			});
		});
	});
	
	/*
	$("a.nav").each(function(el) {
		$(this).click(function(e) {
			e.preventDefault();
			$("div#main").html("Loading...");
			var href = $(this).attr('href');
			$.ajax({
				type: "POST",
				url: href,
			   	data: "ajax=1",
			   	success: function(h){
			   		$("div#main").html(h);
			   	}
			});
		});
	});
	*/
});