$(function(){
	/* Setup container background and border fade-in */
	var borderWidth = 2;
	var $container = $('#container');
	var $containerBg = $(document.createElement('div')).attr('id', 'containerBg');
	$container.prepend($containerBg);
	$containerBg.css({
		'border': borderWidth + 'px solid #FFF',
		'margin-top': '-' + borderWidth + 'px',
		'margin-left': '-' + borderWidth + 'px'
	});
	
	/* Add click event to flame graphic */
	$('#flame', $container).css({cursor: 'pointer'})
	
		/* Remove a href around flame (in markup for accessibility) */
		.bind('mouseover', function(){
			$(this).children().removeAttr('href');
		})
	
		/* Add click event to flame graphic */
		.bind('click', function(){
			$(this).css({cursor: 'default'}).unbind('click');
			
			/* Show logo */
			$('#logo', $container).fadeIn(1000, function() {
			
				/* Background fade in */
				$containerBg.fadeIn(750);
				$('#footer', $container).fadeIn(750);
				/* Show navigation button animation */
				$('ul#buttons', $container)
					.children()
						.hide()
						.animate({
							width: 'toggle'
						}, 750)
						.end()
					.fadeIn(750);
				/* Show text */
				$('#contentWrap', $container).fadeIn(1000, function() {

                                    /* Start image rotate */
                                    $.startImageRotate();

                                });
			});
	});
});
