
function formulatorValidateRequired(field, alerttxt)
{
	with (field)
	{
		if(value == null || value == "")
  		{
  			alert(alerttxt);
  			return false;
		}
		else 
		{
			return true
		}
	}
}

function formulatorValidateChecked(field, alerttxt)
{
	with (field)
	{
		if(checked != true)
  		{
  			alert(alerttxt);
  			return false;
		}
		else 
		{
			return true
		}
	}
}

function formulatorValidateEmail(field, alerttxt)
{
	with (field)
	{
		if(value == null || value == "")
			return true;
			
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos < 1 || dotpos - apos < 2) 
  		{
  			alert(alerttxt);
  			return false;
		}
		else 
		{
			return true;
		}
	}
}


function formulatorValidateEmailList(field, alerttxt)
{
	with (field)
	{
		if(value == null || value == "")
			return true;
			
		chunks = value.split(/[ .,]+/);
		for(chunk in chunks)
		{
			$ret = formulatorValidateEmail(field, alerttxt);
			if(!$ret) return false;
		} 
		return true;
	}
}


function formulatorValidateCzCellular(field, alerttxt)
{
	with (field)
	{
		if(value == '') return true;
		
		value = value.split(' ').join('');
		
		if(value.length != 9)
  		{
  			alert(alerttxt);
  			return false;
		}
		var phone = parseInt(value);
		if(phone < 600000000 || phone > 799999999)
		{	
			alert(alerttxt);
			return false;
		}
		//alert(value);
		
		return true
		
	}
}
