var imageWidth = 1500;
var imageHeight = 1000;

jQuery(document).ready(function() {
	jQuery(window).resize(function(){
	  resizeImage();
	});	
	resizeImage();
});
function resizeImage() {
	var navWidth = jQuery(window).width();
	var navHeight = jQuery(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);
	jQuery('#image').css({height: navHeight, width: navWidth});
	jQuery('#image img').css({height: newHeight, width: newWidth, top: newTop, left: newLeft});
	jQuery('#image').css({visibility:"visible", display:"block"});
}


