$(function() {
	if (hasTransitions()) {
		
		$('img').each(function(i){
			var img = $(this);
			img.load(function(){
				setTimeout( function(){ img.css({opacity:'1.0'});}, i*50);
			});	
		});
	} else {
		$('img').css({opacity:'1.0'});
	}
		
	$('#list-signup-submit').click(function(e) {
		e.preventDefault();
		$.post('/site/signup', { email: $("#list-signup").val() }, function (data) {
			$('#list-signup-status').html(data).fadeIn().delay(1000).fadeOut('slow');
			$('#list-signup').val('');
		});
    });
    
    var isShowingGrid = false;
    $('<div id="grid"></div>').appendTo('.section');
		$('#grid').hide();
		$('body').keyup(function(e) {
			if (e.keyCode == '71') {
				isShowingGrid = !isShowingGrid;
				if (isShowingGrid) { 
					var w = $(window).width();
					var h = $(document).height();
					$('#grid').show();
				} else {
					$('#grid').hide();
				}
			}
		});

	
});

var hasTransitions = function() {
	var b = document.body || document.documentElement;
	var s = b.style;
	return s.WebkitTransition !== undefined;
}


