<!-- hide script from old browsers
function trim(str) { 
    // getting rid of leading spaces 
    while (str.substring(0,1) == ' ') 
        str = str.substring(1, str.length);

    // getting rid of trailing spaces 
    while (str.substring(str.length-1,str.length) == ' ')
        str = str.substring(0, str.length-1);

   return str;
} 
function validateString(string,Chars) 
{
   if (!string) 
		return true;
   for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
          return false;
    }
    return true;
} 
function validateCap(field)
{
		if (validateString(field.value,'0123456789') == false || (field.value.length != 5) ) 
		{
			alert("Cap non valido");
			field.focus();
			return true;
		}
		return false;
}
function validatePhone(field, min, max,cell)
{
		var chars;
		chars =  (cell == true) ? '+0123456789' : '0123456789'; 
		if ( (field.value.length < min) || field.value.length > max)
		{
			alert("Numero telefonico non valido. Inserisci solo cifre.");
			field.focus();
			return true;
		}
		if (validateString(field.value,chars) == false ) 
		{
			alert("Numero telefonico non valido. Inserisci solo cifre");
			field.focus();
			return true;
		}
		return false;
}
function checkField(field, msg)
{
	if ( trim(field.value) == "")
	{
		field.focus();
		alert(msg);
		return true;
	}	
	return false;
}
function checkSelect(field, msg)
{
	if (trim(field.options[field.selectedIndex].value) == "")
	{
		field.focus();
		alert(msg)
		return true;
	}
	return false;	
}
function checkRadio(fieldName, msg)
{
	for (var i = 0; i < fieldName.length; i++)
		if (fieldName[i].checked == true)
			return false;

	fieldName[0].focus();
	alert(msg);
	return true;
}
function validateYear(strValue, startYear, endYear)
{
	if (isNaN(parseInt(strValue)))
		return false;	
	strValue = parseInt(strValue);	
	if (strValue >= startYear && strValue <= endYear)	
			return true;
	return false;
}

//-->