
var etim = {
	init : function () {
		this.setColHeight();
	},
	setColHeight : function (e) {
		// "Height by Javascript" not my finest moment... 
		
		var wih = window.innerHeight;
		if	(document.body.clientHeight) {
			wih = document.body.clientHeight; // IE
		}
		
		if ( he.get("searchCol") ) {
			if(he.get("content").offsetHeight < wih){
				he.get("searchCol").style.height = he.get("content").offsetHeight + "px";
			} else {
				he.get("searchCol").style.height = wih + "px";
			}
		}
		 
		if (navigator.userAgent.match(/(MSIE)\s[6]/)) {
			// IE 6
			he.get("leftBottom").style.position = "absolute";
			he.get("leftBottom").style.top = (he.get("leftBottom").parentNode.offsetHeight-he.get("leftBottom").offsetHeight) + "px";
			he.get("leftBottom").style.visibility = "visible";
		}
	}
}

var et = {
	init : function () {
		et.colorRow();
		//et.tac();
		//et.tal();
	},
	colorRow : function () {
		var tb = he.getEs("tbody")[0];
		var oddEven = 0;
		for(var i = 0; i < tb.childNodes.length; i += 1) {
			if(tb.childNodes[i].nodeName === "TR") {
				he.addClass("noBorder", tb.childNodes[i].firstChild);
				if(oddEven === 0) {
					he.addClass("even", tb.childNodes[i]);
				} else {
					var oeFl = parseFloat(oddEven/2);
					var oeInt = parseInt(oddEven/2,10);
					if(oeFl === oeInt) {
						he.addClass("even", tb.childNodes[i]);
					} else {
						he.addClass("odd", tb.childNodes[i]);
					}
				}
				
				oddEven += 1;
			}
		}
	},
	tac : function () {
		var tds = he.getEs("td");
		for(var i = 0; i < tds.length; i += 1) {
			if(tds[i].innerHTML.match(/^\d{1,2}$/) || tds[i].innerHTML.match(/^[N|A|L|W|V]$/) || tds[i].innerHTML.match(/^(Lm|Mm)$/)) {
				he.addClass("tac", tds[i]);
			}
		}
	},
	tal : function () {
		var ths = he.getEs("th");
		for(var i = 0; i < ths.length; i += 1) {
			he.addClass("col" + i, ths[i]);
			if(ths[i].innerHTML.match(/^(Egenskap|V\ärde)$/)){
				he.addClass("tal", ths[i]);
			}
		}
	}
}

function initPage () {
	etim.init();
	//et.init();
}

he.addEvent("load",initPage,window);
he.addEvent("resize",etim.setColHeight,window);
