/**
 *	Funkce pro ovladaci prvky a jina vizualni vylepseni
 *
 *	vytvoril zdolf
 */

/**
 *	nastaveni chovani
 */
var TABLEROWS_KEEP_FOCUSED = true;
var TABLEROWS_FOCUS_COLOR = 'rgb(255, 90, 90)';
var TABLEROWS_SEMI_COLOR = 'rgb(255, 170, 170)';

/**
 *	prace s tabulkou
 */
function focusRow(tableRow) {
	if(!TABLEROWS_KEEP_FOCUSED) {
		blurAllRows();
	} else {
		semiBlurRows();
	}

	tableRow.style.backgroundColor = TABLEROWS_FOCUS_COLOR;

	return true;
}

function blurRow(tableRow) {
	tableRow.style.backgroundColor = '';

	return true;
}

function semiBlurRows() {
	tableRows = document.getElementsByTagName("tr");

	for(var i = 0; i < tableRows.length; i++) {
		//alert(tableRows[i].style.backgroundColor);

		if(tableRows[i].style.backgroundColor == TABLEROWS_FOCUS_COLOR)
			tableRows[i].style.backgroundColor = TABLEROWS_SEMI_COLOR;
	}

	return true;
}

function blurAllRows() {
	tableRows = document.getElementsByTagName("tr");

	for(var i = 0; i < tableRows.length; i++) {
		tableRows[i].style.backgroundColor = '';
	}

	return true;
}

function showRow(tableRow) {
	tableRow.style.display = 'block';

	return true;
}

function hideRow(tableRow) {
	tableRow.style.display = 'none';

	return true;
}
