
/*

function CheckEMail(strMail)
function ExamFloat(strNumeric, strNum, strDec, strMsg)
function ExamDate(strDate, strMsg)

*/

function CheckEMail( strMail, srtNC )
{
	var blnVld = true;
	var strNC;
	
	var arrMatch = strMail.match(new RegExp("^([^@]*)@([^@]*)\\.([^@]*)$"));
	
 	// var arrMatchPoint = strMail.match(new RegExp("^(*)\\.([^@]*)$"));
	
	if (arrMatch == null)
	{
		blnVld = false;
		if (strNC == 'en')
		{
			alert("Invalid e-mail format!");
		}
		if (strNC == 'de')
		{
			alert("Slecht e-mail");
		}
		else
		{
			alert("Nem megfelelő a beírt e-mail cím!");
		}
	}

	return blnVld;
}

function CheckPassword( strPWD, strPWDN, srtNC )
{
	var blnVld = true;
	var strNC;
	
	if (strPWDN != strPWD)
	{
		blnVld = false;
		if (strNC == 'en')
		{
			alert("Invalid password!");
		}	
		if (strNC == 'de')
		{
			alert("Slecht passwords");
		}
		else
		{
			alert("Nem azonos a két jelszó mező értéke!");
		}
	}

	return blnVld;
}

function ExamFloat(strNumeric, strNum, strDec, strMsg, objCtl)
{
	blnValid = true;
	
	if (strNumeric.length > 0)
	{
		var rexFloat = new RegExp("^\\d{1," + strNum + "}\\.\\d{1," + strDec + "}$");
		var rexInt = new RegExp("^\\d{1," + strNum + "}$");
		
		var arrMatch = strNumeric.match(rexFloat);
		
		if (arrMatch == null)
		{
			arrMatch = strNumeric.match(rexInt);
			
			if (arrMatch == null) blnValid = false;
		}
		
	}
	
	if (!blnValid)
	{
		alert(strMsg);
		
		if (objCtl != null) objCtl.focus();
	}
	
	return blnValid;
}

function ExamDate(strDate, strMsg, objCtl)
{
	blnValid = false;
	
	if (strDate.length > 0)
	{
		var rexHUDate = new RegExp("^(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})$");
		var rexISODate = new RegExp("^(\\d{4})-(\\d{1,2})-(\\d{1,2})$");
		
		var arrMatch = strDate.match(rexHUDate);
		
		if (arrMatch != null)
		{
			blnValid = ExamDateVal(arrMatch[1]*1, arrMatch[2]*1, arrMatch[3]*1);
		}
		else
		{
			arrMatch = strDate.match(rexISODate);
			
			if (arrMatch != null)
			{
				blnValid = ExamDateVal(arrMatch[1]*1,
				 arrMatch[2]*1,
				 arrMatch[3]*1);
			}
			
		}
	}
	else
	{
		blnValid = true;
	}
	
	if (!blnValid)
	{
		alert(strMsg);
		
		if (objCtl != null) objCtl.focus();
	}
	
	return blnValid;
}

function ExamDateVal(intYear, intMonth, intDay)
{
	blnValid = true;
	
	if (intYear < 1000 || intYear > 3000)
		blnValid = false;
	
	if (intMonth < 1 || intMonth > 12)
		blnValid = false;
	
	if (intDay < 1 || intDay > 31)
		blnValid = false;
	
	return blnValid;
}

function ExamInt(strNumeric, strMin, strMax, strMsg, objCtl)
{
	blnValid = true;
	
	if (strNumeric.length > 0)
	{
		var rexInt = new RegExp("^\\d{" + strMin + "," + strMax + "}$");
		
		var arrMatch = strNumeric.match(rexInt);
		
		if (arrMatch == null) blnValid = false;
	}
	
	if (!blnValid)
	{
		alert(strMsg);
		
		if (objCtl != null) objCtl.focus();
	}
	
	return blnValid;
}

function ExamTime(strTime, strMsg, objCtl)
{
	blnValid = true;
	
	if (strTime.length > 0)
	{
		var rexTime = new RegExp("^(\\d{1,2}):(\\d{2})$");
		
		var arrMatch = strTime.match(rexTime);
		
		if (arrMatch == null)
		{
			blnValid = false;
		}
		else
		{
			var intHour = arrMatch[1]*1;
			var intMin = arrMatch[2]*1;
			
			if  (intHour < 0 ||  intHour > 24) blnValid = false;
			if  (intMin < 0 ||  intMin > 59) blnValid = false;
			if (intHour == 24 && intMin != 0) blnValid = false;
		}
	}
	
	if (!blnValid)
	{
		alert(strMsg);
		
		if (objCtl != null) objCtl.focus();
	}
	
	return blnValid;
}

