// JavaScript Document

function check_formRegistration(formobj)
{
	if (formobj.Ragione_Sociale.value == ""){alert("Il campo 'Ragione Sociale' è obbligatorio.");return false;}
	if (formobj.Indirizzo.value == ""){alert("Il campo 'Indirizzo' è obbligatorio.");return false;}
	if (formobj.Provincia.value == "-"){alert("Il campo 'Provincia' è obbligatorio.");return false;}
	//Telefono
	if(formobj.Telefono.value.length < 5)
	{
		alert("Il campo 'Telefono' è obbligatorio.");
		return false;
	}
	else
	{
		for(i=0; i < formobj.Telefono.value.length; i++)
		{
			var codiceA = formobj.Telefono.value.charCodeAt(i);
		
			if (formobj.Telefono.value.charAt(i)!=" " && codiceA < 48 || codiceA > 57)
			{
				alert("Numero di 'Telefono' non valido.");
				return false;
			}
		}
	}//end Check Telefono
	
	if (formobj.Cognome.value == ""){alert("Il campo 'Cognome' è obbligatorio.");return false;}
	if (formobj.Nome.value == ""){alert("Il campo 'Nome' è obbligatorio.");return false;}
	
	if (formobj.Settore.value == "-"){alert("Il campo 'Settore' è obbligatorio.");return false;}
	//if (formobj.Categoria.value == "-"){alert("Il campo 'Categoria' è obbligatorio.");return false;}
	//if (formobj.Sottocategoria.value == "-"){alert("Il campo 'Sottocategoria' è obbligatorio.");return false;}

	if(formobj.Email.value != "")
	{
		if (formobj.Email.value == formobj.email_verif.value)
		{
			if (formobj.Email.value.indexOf('@', 0) == -1)
			{
				alert("Indirizzo e-mail non valido!");
				return false;
			}
		}
		else
		{
			alert("L'e-mail di conferma non corrisponde.");
			return false;
		}
	}
	else
	{
		alert("Il campo 'E-mail' è obbligatorio.");
		return false;
	}
	
	
	//if (formobj.Comune.value == "-"){alert("Il campo 'Comune' è obbligatorio.");return false;}
	
	if (formobj.Pwd.value != formobj.Pwd_verif.value)
	{
		alert("Il campo 'Password' di conferma non corrisponde.");
		return false;
	}
	if (formobj.Pwd.value == ""){alert("Il campo 'Pwd' è obbligatorio.");return false;}
	
	if (formobj.privacy.checked == false){
	alert("Non sono state accettate le condizioni generali del servizio e le politiche sulla privacy");return false;}
	
	//Controlla l'estensione dell'immagine
	//return check_ImageExtension(formobj);
	
	return true;
}


<!--
var maxchars=256;

function CheckLength(testo)
{
  with (document.Registration)
    {
    chars=testo.value
    if (chars.length > maxchars)
      {
      testo.value=chars.substr(0,maxchars);
      testo.blur();
      }
    chr.value=maxchars-testo.value.length;
    }
  }
//-->


function check_ImageExtension(formobj)
{
	
	//var fileField = document.getElementById( 'logoFile' );
	var valore = formobj.logoFile.value;
	
	if(valore != "")
	{
		var valsub = valore.substring(valore.indexOf("."));
		if(valsub != ".jpg" && valsub != ".JPG")
		{
			alert("La foto deve avere estensione .jpg"); 
			return false;
		}
	}


	cacheON();
	document.getElementById('Submit').disabled=true;//Disabilita il bottone Invia
	//document.getElementById('res').disabled=true;//Disabilita il bottone Reset
	return true;
}


//Conferma Registrazione
function check_formConfirmReg(formobj)
{
	if (formobj.Comune.value == "-"){alert("Il campo 'Comune' è obbligatorio.");return false;}
	if (formobj.Categoria.value == "-"){alert("Il campo 'Categoria' è obbligatorio.");return false;}
	return true;
}