﻿if (window.addEventListener){
      window.addEventListener("load",pageSizer, false);
}
else if (window.attachEvent){
      window.attachEvent("onload", pageSizer);
}


//setTimeout(pageSizer, 10000);

function pageSizer(){
if (getWindowheight() > getLongestHeight()) {
setWindowHeight();
}
else { 
setLongestHeight();
}
}

function Numsort (a, b) {
  return a - b;
}

function getLongestHeight() {
 	colLength = new Array(2);
 	colLength[0] = document.getElementById("leftcontent").offsetHeight;
 	colLength[1] = document.getElementById("rightcontent").offsetHeight;
 	colLength.sort(Numsort);
 	colLength.reverse();
 	return colLength[0];
}

function getWindowheight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Kein-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
 return myHeight;
}

function setLongestHeight() {
 	divLen = getLongestHeight();
	document.getElementById("leftcontent").style.height = divLen+"px";
 	document.getElementById("rightcontent").style.height = divLen+"px";
 	document.getElementById("leftcontentstrip").style.height = divLen-10+"px";
}

function setWindowHeight() {
    divLen = getWindowheight();
 	document.getElementById("leftcontent").style.height = divLen+"px";
 	document.getElementById("rightcontent").style.height = divLen+"px";
 	document.getElementById("leftcontentstrip").style.height = divLen-10+"px";
}









