/**
 * This javascript does matches the heights of each cell in tables
 * that has the class col-column-resize.
 *
 * Arvid add 2010-07-01: This code could be replaced with some leaner
 * jQuery-code (see line_jquery.js), but since we haven't got jQuery
 * on each page, I think we should keep this until the day we start
 * including jQuery always.
 */

window.onload = function () {
	if (document.getElementsByTagName) {
		var tables = document.getElementsByTagName("table");

		// The table has the class col-column-resize if 
		for (i = 0; i<tables.length; i++) {
			if(tables[i].className=="col-column-resize") {
				tables[i].style.height = tables[i].parentNode.offsetHeight-10 + "px";
			}
		}
		for (i = 0; i<tables.length; i++) {
			if(tables[i].className=="col-box-resize") {
				tds = tables[i].getElementsByTagName("td");
				for (j = 0; j<tds.length; j++) {
					if (tds[j].className=="col-content") {
						var padding = tds[j].style.padding
						var paddingArray = padding.split(" ");
						var paddingTop = 0;
						var paddingBottom = 0;
						if (paddingArray.length > 1) {
							paddingTop = paddingArray[0].substr(0, paddingArray[0].length - 2);
							paddingBottom = paddingArray[2].substr(0, paddingArray[2].length - 2);
						}
						
						tds[j].style.height = tds[j].offsetHeight - paddingTop - paddingBottom +
  							(tables[i].parentNode.offsetHeight-tables[i].offsetHeight) + "px";
						break;
					}
				}
			}
		}
	}
	else {
		return false;
	}
}


