function prepareWindow() {

	var objImage = document.getElementById('image');
	var objSpace = document.getElementById('space');

	var screenWidth = window.screen.width - 30;
	var screenHeight = window.screen.height - 170;

	var imgWidth = objImage.naturalWidth;
	var imgHeight = objImage.naturalHeight;

	if (imgWidth > screenWidth || imgHeight > screenHeight) {

		var x, y, z;

		x = screenWidth / imgWidth;
		y = screenHeight / imgHeight;

		if (x < y) {
			z = x;
		} else {
			z = y;
		}

		objImage.style.width = (objImage.naturalWidth * z) + 'px';
		objImage.style.height = ((objImage.naturalHeight * z)) + 'px';

	}

	objSpace.style.height = (objImage.clientHeight + 110) + 'px';
	window.resizeTo(objImage.clientWidth + 30, objSpace.clientHeight);

}

