// JavaScript Document

function isImageLoaded(image_id) { //klopt niet - neemt de div waarden ipv image
	if (document.layers) { 
		var pic = document.layers[image_id];
		alert('layers'+pic);
	} else { 
		var pic = document.getElementById(image_id);
	}
	
	var h = pic.offsetHeight;
	var w = pic.offsetWidth;
	if (w == undefined || h == undefined || h < 500 || w < 500 ) {
		return false;
	} else {
		return true;
	}
}

function resizeImage(ImageName) {
	var window_height = document.body.clientHeight;
	var window_width  = document.body.clientWidth;
	if (isImageLoaded(ImageName)) { 
		var image_width   = document.getElementById(ImageName).width;
		var image_height  = document.getElementById(ImageName).height;
		var height_ratio  = image_height / window_height;
		var width_ratio   = image_width / window_width;
		if (height_ratio > width_ratio) {
			document.getElementById(ImageName).style.width  = window_width+10;
			document.getElementById(ImageName).style.height = 'auto';
		} else {
			document.getElementById(ImageName).style.width  = 'auto';
			document.getElementById(ImageName).style.height = window_height+10;
		}
	}
	document.getElementById('bg').style.display = 'block';
}