var imageWidth = 1680;
var imageHeight = 1050;

$(document).ready(function() {
	
	resizeImage();
	
	// load png fix for IE
	//$(document).pngFix();
	
	// image scalling
	$(window).resize(function(){
		resizeImage();
	});
});

function resizeImage() {
	var navWidth = $(window).width();
	var navHeight = $(window).height();
	var navRatio = navWidth / navHeight;
	imageRatio = imageWidth / imageHeight;
	if (navRatio > imageRatio) {
		var newHeight = (navWidth / imageWidth) * imageHeight;
		var newWidth = navWidth;
	} else {
		var newHeight = navHeight;
		var newWidth = (navHeight / imageHeight) * imageWidth;
	}	
	newTop = 0 - ((newHeight - navHeight) / 2);
	newLeft =  0 - ((newWidth - navWidth) / 2);
	$('#image').css({height: navHeight, width: navWidth});
	$('#image img').css({height: newHeight, width: newWidth, top: newTop, left: newLeft});
	$('#image').css({visibility:"visible", display:"block"});
}
