var regExpName = /^([á-ùÁ-ÙÜÝÞßüýþúûÀàa-zA-Z.' ]+)$/;
var regExpMail = /(\w+@\w+\.\w+)/;
var regExpPhone = /^([0-9\(\).\-\+ ]+)$/;
var regExpNumber = /^([0-9 ]+)$/;
var regExpAddres = /^([0-9á-ùÁ-ÙÜÝÞßüýþúûÀàa-zA-Z.,\-' ]+)$/;

function remove_spaces(str)
{
	while (str.search('  ')!=-1)
	{
	str = str.replace('  ', ' ');
	if (str.length == 1) str='';
    }
    return(str);
}

function ValidateValue(Value, AllowEmpty, regExp)
{
	Value = remove_spaces(Value);
	if (Value=='') return(AllowEmpty);
	var arr = regExp.exec(Value);
	try
	{
		var idx = arr.index;
		return(true);
	}
	catch(e)
	{	return(false);}
}


