	function tableCallback(col, reverse) {
		initMouseovers();
		setHeaders(col, reverse);
	}

	function initMouseovers() {
		var trs = document.getElementsByTagName('TR');
		for (var i=0;i<trs.length;i++) {
			if (trs[i].parentNode.nodeName == 'TBODY' && trs[i].parentNode.className == 'hovring') {
				trs[i].onmouseover = mouseGoesOver;
				trs[i].onmouseout = mouseGoesOut;
			}
    	}
	}

	function mouseGoesOver(e) {
		this.style.backgroundColor='#FFFF99';
	}

	function mouseGoesOut(e) {
		this.style.backgroundColor='';
	}

	var colClsNm = "sortedColumn";
	var colClsNmRev = "reverseSortedColumn";

	// Regular expressions for setting class names.
	var colTest = new RegExp(colClsNm, "gi");
	
	function setHeaders(col, reverse) {
		if(document.getElementById("sorteringsbar_tabell")!= null){
			var tblEl = document.getElementById("sorteringsbar_tabell");
			// Find the table header and highlight the column that was sorted.
			var el = tblEl.parentNode.tHead;
			
			// Get the entire row of TH elements.
			var rowEl = el.rows[el.rows.length - 1];
			
			// Set (and unset) style classes for each column as above.
			for (var i = 0; i < rowEl.cells.length; i++) {
				var cellEl = rowEl.cells[i];
				cellEl.className = "sorteringsbar";
				// Highlight the header of the sorted column.
				if (i == col) {
					if (reverse)
						cellEl.className = colClsNmRev;
					else
						cellEl.className = colClsNm;
				}
			}
		}
	}
