function myCheck(ContrID, ValType, Descr, Par)
{
	if (ValType&1)
	{
		if (document.getElementById(ContrID).value == '') 
		{
			alert ("Il campo \""+Descr+"\" non puņ essere vuoto");
			return false;
		}
	}
	if (ValType&2)
	{
		if (isNaN(document.getElementById(ContrID).value)) 
		{
			alert ("Il campo \""+Descr+"\" deve essere un numero");
			return false;
		}
	}
	if (ValType&4)
	{
		if (document.getElementById(ContrID).value != '')
		{
			if ((document.getElementById(ContrID).value < Par[0] ) || (document.getElementById(ContrID).value > Par[1] ))
			{
				alert ("Il campo \""+Descr+"\" deve essere compreso tra "+Par[0]+" e "+Par[1]);
				return false;
			}
		}
	}
	if (ValType&8)
	{
		if (document.getElementById(ContrID).value != '' && !ValidateEmail(document.getElementById(ContrID)))
		{
			alert ("Il campo \""+Descr+"\" non č una E-Mail valida");
			return false;
		}
	}
	if (ValType&16)
	{
		if (isNaN(document.getElementById(ContrID).value) && (document.getElementById(ContrID).value!='-qualsiasi-'))
		{
			alert ("Il campo \""+Descr+"\" deve essere un numero");
			return false;
		}
	}
	return true;
}

function ValidateEmail(theinput)
{
	s=theinput.value
	if(s.search)
	{
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0)
	}
	if(s.indexOf)
	{
		at_character=s.indexOf('@')
		if(at_character<=0 || at_character+4>s.length)
			return false
	}
	if(s.length<6)
		return false
	else
		return true
}