// GRAUMANS
function ExtraOnload(eventHandler) {
  if (window.onload) {
    window.onload = new Function(
      window.onload.toString().replace(/[\r\n]/g, '').replace(/\s+$|^\s+/g, '').replace(/^function\s*\w+\s*\(\w*\)\s*\{\s*(.*)\s*\}$/,'$1\n' + eventHandler)
    );
  } else {
    window.onload = new Function(eventHandler);
  }
}

// WRAPPER HOOGTE
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function wrapperHeight() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('container').offsetHeight;
			var footerHeight = document.getElementById('footer').offsetHeight;
			var realHeight = (contentHeight - 160)- footerHeight; //Hoogte van de header en footer aftrekken
			var goodHeight = (windowHeight - 160)- footerHeight; //Hoogte van de header en footer aftrekken
			//alert(windowHeight + " - " + contentHeight + " = " + realHeight);
			if (windowHeight - contentHeight >= 0) {
				//alert("Content is hoger dan browservenster");
				document.getElementById('container').style.height = windowHeight + 'px';
				document.getElementById('nav').style.height = goodHeight + 'px';
			}
			else {
				//alert("Content is lager dan browservenster, schaal de content op...");
				document.getElementById('nav').style.height = realHeight + 'px';
			}
		}
	}
}
	
// POSITION FOOTER
function getObj(name)
{
  if (document.getElementById)
  {
  this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

// SCROLLBAR
function initScrollLayer() {
  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
  // if horizontal scrolling, id of element containing scrolling content (table?)
  var wndo = new dw_scrollObj('wn', 'lyr1', 't1');
  
  // pass id('s) of scroll area(s) if inside table(s)
  dw_scrollObj.GeckoTableBugFix('wn'); 
}



