var Stretch = {
	init: function () {
		this.sStretch  = ['contentwrap'];
		this.iSubtract = [217,          217];
		this.iPadding  = [0,            23];
		this.iMinimum  = [300,          300];
		this.sExpander = ['news', 'inhoud___Frame', 'content'];
		
		var iHeight = 0;
		
		if (self.innerHeight) {
			iHeight = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight) {
			iHeight = document.documentElement.clientHeight;
		}
		else if (document.body) {
			iHeight = document.body.iHeight;
		}
		
		if (iHeight == 0) return;
		
		var iMinHeight = 0;
		
		if (typeof this.sExpander != "string") {
			for (var i = 0; i < this.sExpander.length; i++) {
				if (document.getElementById(this.sExpander[i])) {
					if (document.getElementById(this.sExpander[i]).offsetHeight > iMinHeight)
					{
						iMinHeight = document.getElementById(this.sExpander[i]).offsetHeight;
						if (this.sExpander[i] == "inhoud___Frame") iMinHeight += 23;
					}
				}
			}
		}
		else {
			if (document.getElementById(this.sExpander)) {
				if (document.getElementById(this.sExpander).offsetHeight > iMinHeight)
				{
					iMinHeight = document.getElementById(this.sExpander).offsetHeight;
					if (this.sExpander == "inhoud___Frame") iMinHeight += 23;
				}
			}
		}
		
		if (typeof this.sStretch != "string") {
			for (var i = 0; i < this.sStretch.length; i++) {
				if (document.getElementById(this.sStretch[i])) {
					if (iMinHeight > this.iMinimum[i]) this.iMinimum[i] = iMinHeight;
					
					var iElementHeight = iHeight - this.iSubtract[i];
					
					if (iElementHeight < this.iMinimum[i]) iElementHeight = this.iMinimum[i];
					iElementHeight = iElementHeight - this.iPadding[i];
					
					document.getElementById(this.sStretch[i]).style.height = iElementHeight + 'px'
				}
			}
		}
		else {
			if (document.getElementById(this.sStretch)) {
				if (iMinHeight > this.iMinimum) this.iMinimum = iMinHeight;
				
				iHeight = iHeight - this.iSubtract;
				
				if (iHeight < this.iMinimum) iHeight = this.iMinimum;
				
				iElementHeight = iElementHeight - this.iPadding;
				
				document.getElementById(this.sStretch).style.height = iHeight + 'px';
			}
		}
	}
};

YAHOO.util.Event.addListener(window, 'load',   Stretch.init);
YAHOO.util.Event.addListener(window, 'resize', Stretch.init);