// JavaScript Document
// Date: September 2008
// Author: Travis Cunningham
// Description: Core Functions

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
function balanceCol(){
	//Balance Landing Triple Columns
	if(document.getElementById('landingTripleColumn')){
		//Stretch the triple columns if the right column is greater than the middle column
		var centerCol = document.getElementById('landingCol2');
		var rightCol = document.getElementById('landingCol3');
		var leftCol = document.getElementById('landingCol1');
		//Height variables
		var centerColHeight = centerCol.offsetHeight;
		var rightColHeight = rightCol.offsetHeight;
		var leftColHeight = leftCol.offsetHeight;
		//Balance
		if(centerColHeight<rightColHeight){
			var remainderOfCol = rightColHeight - centerColHeight;
			centerCol.style.height = remainderOfCol + centerColHeight + 'px'
		}
		
		//Remove background gradient on first widgets
		var leftFirstDiv = leftCol.getElementsByTagName('div');
		var centerFirstDiv = centerCol.getElementsByTagName('div');
		var rightFirstDiv = rightCol.getElementsByTagName('div');
		leftFirstDiv[0].style.background = 'none';
		centerFirstDiv[0].style.background = 'none';
		rightFirstDiv[0].style.background = 'none';
	}
	//Balance Primary Columns
	if(document.getElementById('beta')){
		var alpha = document.getElementById('alpha');
		var beta = document.getElementById('beta');
		//Height variables
		var alphaHeight = alpha.offsetHeight;
		var betaHeight = beta.offsetHeight;
		//Balance
		if(betaHeight<alphaHeight){
			var remainderOfCol = alphaHeight - betaHeight;
			beta.style.height = remainderOfCol + betaHeight + 'px'
		}
	}
}