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 Okno(AUrl, AWidth, AHeight) {
	if (AUrl != null && AUrl != "") {
		AWidth = AWidth != null && !isNaN(parseInt(AWidth)) ? AWidth : 400;
		AHeight = AHeight != null && !isNaN(parseInt(AHeight)) ? AHeight : 300;
		window.open(AUrl, 'IMFSoft', "width=" + AWidth + ", height=" + AHeight + ", toolbar=no, menubar=no, scrollbars=yes, status=no, resizable=yes").focus();
	}
}

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;
}
