function Fensterweite () {
  if (window.innerWidth) {
    return window.innerWidth;
  } else if (document.body && document.body.offsetWidth) {
    return document.body.offsetWidth;
  } else {
    return 0;
  }
}

function Fensterhoehe () {
  if (window.innerHeight) {
    return window.innerHeight;
  } else if (document.body && document.body.offsetHeight) {
    return document.body.offsetHeight;
  } else {
    return 0;
  }
}

function IE6 () {
	if (navigator.appName != "Microsoft Internet Explorer") {
		return false;
	}
	if (parseFloat(navigator.appVersion) >= 7) {
		return false;
	}
	return true;
}

function resize_all(minw, imgw, imgh) {
	if (typeof(minw) == "undefined") {
		return;
	}
	var mainview = document.getElementById('main');
	var bgimage = document.getElementById('bgimage');
	var ratio = (imgw/imgh); // Image ratio.	
	var htmlheight = document.body.parentNode.clientHeight;
	var windowheight = Fensterhoehe();
	var height;
	if (htmlheight < windowheight) {
		height = htmlheight;
	} else {
		height = windowheight;
	}
	var widthbyheight = height * ratio - 15;
	var widthbywidth = Fensterweite() - 30;
	if (widthbyheight < widthbywidth)
	{
		w = widthbyheight;
//		document.getElementById('bg').style.overflow = "hidden";
//		document.getElementById('bg').style.maxHeight = height+"px";
	} else {
		w = widthbywidth; //*/
	}
	w = widthbywidth;
	if (w < minw) {
		w = minw;
	}
	if (w > imgw) {
		// Don't make the image too large!
		w = imgw;
	}
	mainview.style.maxWidth = w + "px";
	mainview.style.width = w + "px";
	bgimage.width = mainview.offsetWidth;
	if (IE6()) {
		// More IE6 hacking - how I loath it!
		// 440 because of the width of the two outer images.
		var cw = w - 440;
		document.getElementById('center').style.width = cw + "px";
	}
}

