function GetTag(AName)
{
	var temp = document.getElementsByName(AName);
	var tempID = document.getElementById(AName);
	if (tempID != null) return tempID;
	else if (temp != null && temp.length > 0) return temp[0];
	else return null;
}

function CheckNumber(e)
{
	if (!e) e = window.event;
	if (e.charCode != null) return (e.charCode == 0 || /\d{1,1}/.test(String.fromCharCode(e.charCode)));
	else return /\d{1,1}/.test(String.fromCharCode(e.keyCode));
}

function CheckPhone(e)
{
	if (!e) e = window.event;
	if (e.charCode != null) return (e.charCode == 0 || e.charCode == 43 || /\d{1,1}/.test(String.fromCharCode(e.charCode)));
	else return /\d{1,1}/.test(String.fromCharCode(e.keyCode));
}

function ZobrazitPolozky(AObj) {
	if (AObj.checked) GetTag("divPolozky").style.display = "block";
	else GetTag("divPolozky").style.display = "none"; 
}

function Zobrazit(AObj, AId) {
	if (AObj.checked) GetTag(AId).style.display = "block";
	else GetTag(AId).style.display = "none"; 
}

function ZmenaHodnoty(obj, input, array, id) {
	var id = obj != null ? obj.options[obj.selectedIndex].value : id;
	input.options.length = 0;
	for (var i = 0; i < array.length; i++) {
		if (i == 0) input.options[input.options.length] = new Option("-- vyberte --", "");
		if (id == "") input.options[input.options.length] = new Option(array[i][2], okresy[i][1]);
		else if (parseInt(id) == array[i][0]) input.options[input.options.length] = new Option(array[i][2], array[i][1]);  
	}
}

function TestEmail(email)
{
	var ret = true;
	try {
		var zavinac = email.indexOf("@");
		var tecka = email.lastIndexOf(".");
		if (email != "") {
			if (zavinac < 1 || tecka > (email.length - 3) || tecka < 0 || ((zavinac + 2) > tecka)) ret = false;
		} else {
			ret = false;
		}
	} catch(e) {
		ret = false;
	}
	return ret;
}

