/* Author: 

*/


function resizeWindow() {
	var windowHeight     = $(window).height(),
		windowWidth      = $(window).width(),
		minHeight        = 900,
		minWidth         = 1200,
		left             = 0,
		imgHeight        = $('#igloo').height(),
		imgWidth         = $('#igloo').width();


	// scale image to full page width
	// if to narrow, center horizontally
	newWidth         = windowWidth;
	newHeight        = windowHeight;
	if ((newWidth < minWidth)) { newWidth = minWidth; newHeight = minHeight; left = (windowWidth - newWidth) /2; }

//	console.log('windowHeight : '+windowHeight+'\nwindowWidth: '+windowWidth+'\nleft: '+left);

	$('#wrapper').css({'height' : windowHeight+'px', 'width':	windowWidth+'px'});
	$('#igloo').css({'width' : newWidth+'px', 'bottom' : '0px', 'left':left+'px'});
}

$(document).ready(function(){
	$('#wrapper').imagesLoaded( function( ) {
		$('#wrapper').removeClass('hidden');
		resizeWindow();
	});

	$(window).resize(resizeWindow);
});

