function menuOnOff(item) {
	sub = document.getElementById('kat_' + item).style;
	if (sub.display == "none") {
		sub.display = "block";
	} else {
		sub.display = "none";
	}
	sipka = document.getElementById('hl_' + item)
	if (sipka.className == "close") {
		sipka.className = 'open';
	} else {
		sipka.className = 'close';
	}

	return true;
}


/*
15.8.2005
Ales Dostal
funkce pro zvyrazneni radku tabulky po najeti mysi
*/
function barvaSel (id, typ)
{
    var radek = document.getElementById(id).style;
    var barva = "orange";
    if (typ == 'vyber') {
        if (radek.backgroundColor != barva) {
            radek.backgroundColor = "#CCCCFF";
        }
    } else if(typ == 'out') {
        if (radek.backgroundColor != barva) {
            radek.backgroundColor = "";
        }
    } else {
        if (radek.backgroundColor == barva) {
            radek.backgroundColor = "";
        } else {
            radek.backgroundColor = barva;
        }
    }
}

function legendaShow(idf)
{
	var tableIn = document.getElementById(idf).style;

	if (tableIn.display == "none") {
		tableIn.display = "block";
	} else {
		tableIn.display = "none";
	}
}

//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="#e8fd5e"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e)
{
    eventobj=ns6? e.target : event.srcElement
    if (previous!='') {
        if (checkel(previous)) {
            previous.style.backgroundColor=''
        }
        previous=eventobj
        if (checkel(eventobj)) {
            eventobj.style.backgroundColor=highlightcolor
        }
    } else {
        if (checkel(eventobj)) {
            eventobj.style.backgroundColor=highlightcolor
        }
        previous=eventobj
    }
}


/*
23.6.2005
Ales Dostal
funkce pro kontrolu zadanych dat ve formulari
*/
var focus_changing = false;
var dont_check = false;

// Focus into field f, display message s and return false
function focus_alert(s, f) {
	f.focus();
	alert(s);
	return false;
}

// Check fields in the form
// s is warning message, f is pointer to <form>, next arguments are names of mandatory fields
// example of use: <form onSubmit="return form_correct('Fill-in all marked fields!', this, 'name', 'password');">
function form_correct(s, f) {
	// correctness of each field
	for (i=0; i < f.elements.length; i++) {
		if (f.elements[i].onblur != undefined && !f.elements[i].onblur()) {
			return false;
		}
	}

	// non-emptiness of selected fields
	for (i=2; i < arguments.length; i++) {
		if (f[arguments[i]].value == '') {
			return focus_alert(s, f[arguments[i]]);
		}
	}
	return true;
}

// Check if field matches ereg
// example of use: <input onBlur="return ereg_correct('Enter a date!', this, /^[0-9]{4}-[0-9]{2}-[0-9]{2}$/);">
function ereg_correct(s, f, regexp) {
	if (f.value == '' || regexp.test(f.value)) {
		return true;
	}
	if (!focus_changing) {
		focus_changing = true;
		focus_alert(s, f);
		focus_changing = false;
	}
	return false;
}

// Check if there is a number in the field
// s is warning message, f is input field, boolean negative allows negative values, d1 is number of digits before decimal point, optional d2 is maximum count of digits after decimal point (empty - none, d1 - unlimited)
// example of use: <input onBlur="return number_correct('Enter a possitive number!', this, false, 5);">
function number_correct(s, f, negative, d1, d2) {
	f.value = f.value.replace(',', '.');
	return ereg_correct(s, f, new RegExp('^'+ (negative ? '-?' : '') +'[0-9]{0,'+ (d1 ? d1 : '') +'}'+ (d2 ? '([.][0-9]{1,'+ d2 +'})?' : '') +'$'));
}

// Check if there is an e-mail in the field, simplified!
// example of use: <input onBlur="return email_correct('Enter an e-mail!', this);">
function email_correct(s, f) {
	return ereg_correct(s, f, /^[^ @]+@[^ @]+\.[^ @]+$/);
}

// Check if there is a URL in the field, simplified!
// example of use: <input onBlur="return email_correct('Enter a URL!', this);">
function url_correct(s, f) {
	return ereg_correct(s, f, /^https?:\/\/[^ \/]+\.[^ ]+/);
}
/*
konec kontroly zadanych dat ve formulari
*/


