function Form1_Validator(theForm)
{

  if (theForm.url.value == "")
  {
    alert("Inserisci il nome del dominio");
    theForm.url.focus();
    return (false);
  }
  
  if (theForm.url.value.length < 3)
  {
    alert("Il dominio deve essere formato da almeno 3 caratteri");
    theForm.url.focus();
    return (false);
  }

  if (theForm.url.value.length > 63)
  {
    alert("Il dominio non deve superare i 63 caratteri");
    theForm.url.focus();
    return (false);
  }

  var checkOK = "qwertyuiopasdfghjklzxcvbnm0123456789-";
  var checkStr = theForm.url.value;
  var allValid = true;
  var validGroups = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    if (ch != ".")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Il dominio che hai scelto contiene caratteri non validi oppure spazi vuoti all'inizio o alla fine.");
    theForm.url.focus();
    return (false);
  }

  return (true);
}



	function	checkvaluereg(field)
	
	{
		
 if (document.form1.elements['verifica[1]'].value=="1")
 {
 
 
	       if (field.accordo.checked==false)
 {
    alert("E' necessario accettare l'accordo");
    
    return (false);
  }
  
         if (field.informativa.checked==false)
 {
    alert("E' necessario accettare l'informativa sulla privacy");
   
    return (false);
  }
  
  pattern5 = /^([a-zA-Z0-9])+$/;
  
  
  		if(pattern5.test(field.password.value)==false)
		{
			alert("Password errata o mancante usare solo lettere e numeri");
			field.password.value="";
			 field.password.focus();
			   return (false);
		}

		
  
		pattern = /^([a-zA-Z\ ])+$/;
		
		if(pattern.test(field.nomecliente.value)==false)
		{
			alert("Nome Usare solo lettere minuscole e numeri, NON usare parole accentate");
			field.nomecliente.value="";
			 field.nomecliente.focus();
			   return (false);
		}
		
		
		
				if(pattern.test(field.cognomecliente.value)==false)
		{
			alert("Cognome Usare lettere, NON usare parole accentate");
			field.cognomecliente.value="";
			 field.cognomecliente.focus();
			   return (false);
		}
		pattern55 = /^([a-zA-Z0-9\ ])+$/;
		
				if(pattern55.test(field.password.value)==false)
		{
			alert("Password Usare solo lettere minuscole e numeri, NON usare parole accentate");
			field.password.value="";
			 field.password.focus();
			   return (false);
		}
		
		
		
		pattern1 = /^([a-zA-Z0-9\ \.])+$/;
		
		
				pattern2 = /^([a-zA-Z0-9\ \.\,])+$/;
		
		if(pattern2.test(field.viacliente.value)==false)
		{
			alert("Via Usare solo lettere e numeri non usare parole accentate");
			field.viacliente.value="";
			 field.viacliente.focus();
			   return (false);
		}
				if(pattern2.test(field.cittacliente.value)==false)
		{
			alert("citta Usare solo lettere e numeri non usare parole accentate");
			field.cittacliente.value="";
			 field.cittacliente.focus();
			   return (false);
		}
		pattern3 = /^([a-zA-Z])+$/;
				if(pattern3.test(field.provinciacliente.value)==false)
		{
			alert("Provincia Mancante");
			field.provinciacliente.value="";
			 field.provinciacliente.focus();
			   return (false);
		}
				pattern4 = /^([0-9\.])+$/;
				if(pattern4.test(field.capcliente.value)==false)
		{
			alert("Cap Usare solo numeri");
			field.capcliente.value="";
			 field.capcliente.focus();
			   return (false);
		}
		
						if(pattern4.test(field.telefonocliente.value)==false)
		{
			alert("Telefono Usare solo numeri");
			field.telefonocliente.value="";
			 field.telefonocliente.focus();
			   return (false);
		}
		
		pattern5 = /^([a-zA-Z0-9])+$/;
				
		
				if(pattern5.test(field.cfpivacliente.value)==false)
		{
			alert("Codice fiscale o Piva Usare solo lettere e numeri");
			field.cfpivacliente.value="";
			 field.cfpivacliente.focus();
			   return (false);
		}
		
		

		
		
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    if (Filtro.test(field.emailcliente.value))
      return true;
   else
      {
      alert("Controlla l'indirizzo di e-mail inserito");
	  field.emailcliente.value="";
      field.emailcliente.focus();
       return (false);
      }
 }
	  
}



function	checkvaluefisica(field)
	
	{
	

  pattern1 = /^([a-zA-Z0-9\+\ \.])+$/;
		
		pattern = /^([a-zA-Z\ ])+$/;
		
		if(pattern.test(field.nome.value)==false)
		{
			alert("Nome Usare solo lettere minuscole e numeri, NON usare parole accentate");
			field.nome.value="";
			 field.nome.focus();
			   return (false);
		}
				if(pattern.test(field.cognome.value)==false)
		{
			alert("Cognome Usare lettere, NON usare parole accentate");
			field.cognome.value="";
			 field.cognome.focus();
			   return (false);
		}
				
		
		
		pattern1 = /^([a-zA-Z0-9\ \.])+$/;
		
		
				pattern2 = /^([a-zA-Z0-9\ \.\,])+$/;
		
		if(pattern2.test(field.via.value)==false)
		{
			alert("Via Usare solo lettere e numeri non usare parole accentate");
			field.via.value="";
			 field.via.focus();
			   return (false);
		}
				if(pattern2.test(field.citta.value)==false)
		{
			alert("citta Usare solo lettere e numeri non usare parole accentate");
			field.citta.value="";
			 field.citta.focus();
			   return (false);
		}
		pattern3 = /^([a-zA-Z])+$/;
				if(pattern3.test(field.provincia.value)==false)
		{
			alert("Provincia Mancante");
			field.provincia.value="";
			 field.provincia.focus();
			   return (false);
		}
				pattern4 = /^([0-9\.])+$/;
				if(pattern4.test(field.cap.value)==false)
		{
			alert("Cap Usare solo numeri");
			field.cap.value="";
			 field.cap.focus();
			   return (false);
		}
		if(pattern4.test(field.telefonor.value)==false)
		{
			alert("Telefono Usare solo numeri");
			field.telefonor.value="";
			 field.telefonor.focus();
			   return (false);
		}
		
			
		
				if(pattern2.test(field.cfpiva.value)==false)
		{
			alert("Codice fiscale o Piva Usare solo lettere e numeri");
			field.cfpiva.value="";
			 field.cfpiva.focus();
			   return (false);
		}
		
		

   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    if (Filtro.test(field.email.value))
      return true;
   else
      {
      alert("Controlla l'indirizzo di e-mail inserito");
	  field.email.value="";
      field.email.focus();
       return (false);
      }
	  
	  

}




function	checkvaluegiuridica(field)
	
	{
	

  pattern1 = /^([a-zA-Z0-9\+\ \.])+$/;
		
		pattern = /^([a-zA-Z\ ])+$/;
		
		if(pattern.test(field.nome.value)==false)
		{
			alert("Nome Usare solo lettere minuscole e numeri, NON usare parole accentate");
			field.nome.value="";
			 field.nome.focus();
			   return (false);
		}
				if(pattern.test(field.cognome.value)==false)
		{
			alert("Cognome Usare lettere, NON usare parole accentate");
			field.cognome.value="";
			 field.cognome.focus();
			   return (false);
		}
				
		
		
		pattern1 = /^([a-zA-Z0-9\ \.\&])+$/;
		if(pattern1.test(field.intestazionerd.value)==false)
		{
			alert("Intestazione caratteri non consentiti, NON usare parole accentate");
			field.intestazionerd.value="";
			 field.intestazionerd.focus();
			   return (false);
		}
		
				pattern2 = /^([a-zA-Z0-9\ \.\,])+$/;
		
		if(pattern2.test(field.via.value)==false)
		{
			alert("Via Usare solo lettere e numeri non usare parole accentate");
			field.via.value="";
			 field.via.focus();
			   return (false);
		}
				if(pattern2.test(field.citta.value)==false)
		{
			alert("citta Usare solo lettere e numeri non usare parole accentate");
			field.citta.value="";
			 field.citta.focus();
			   return (false);
		}
		pattern3 = /^([a-zA-Z])+$/;
				if(pattern3.test(field.provincia.value)==false)
		{
			alert("Provincia Mancante");
			field.provincia.value="";
			 field.provincia.focus();
			   return (false);
		}
				pattern4 = /^([0-9])+$/;
				if(pattern4.test(field.cap.value)==false)
		{
			alert("Cap Usare solo numeri");
			field.cap.value="";
			 field.cap.focus();
			   return (false);
		}
						pattern4 = /^([0-9\.])+$/;
				if(pattern4.test(field.telefonord.value)==false)
		{
			alert("Telefono Usare solo numeri");
			field.telefonord.value="";
			 field.telefonord.focus();
			   return (false);
		}
		
			
		
						if(pattern2.test(field.cf.value)==false)
		{
			alert("CF Usare solo lettere e numeri");
			field.cf.value="";
			 field.cf.focus();
			   return (false);
		}
				if(pattern2.test(field.cfpiva.value)==false)

		{
			alert("Piva Usare solo lettere e numeri");
			field.cfpiva.value="";
			 field.cfpiva.focus();
			   return (false);
		}
		
		
		

   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
    if (Filtro.test(field.email.value))
      return true;
   else
      {
      alert("Controlla l'indirizzo di e-mail inserito");
	  field.email.value="";
      field.email.focus();
       return (false);
      }
	  
	  

}



function hideObject(id) { 
document.getElementById(id).style.height  = '1px';
        document.getElementById(id).style.display = "none"; 
} 
// Show/Hide functions for pointer objects 
function showObject(id) { 
document.getElementById(id).style.left = 400;
document.getElementById(id).style.height  = 'auto';
    document.getElementById(id).style.display = ""; 
} 

 
function hideObjectn(id) { 
document.getElementById(id).style.height  = '1px';
        document.getElementById(id).style.display = "none"; 
} 
// Show/Hide functions for pointer objects 
function showObjectn(id) { 
document.getElementById(id).style.left = 400;
document.getElementById(id).style.height  = 'auto';
    document.getElementById(id).style.display = ""; 
} 


function cliente(field)
{

   document.getElementById('cliente').style.display = "";
   document.getElementById('prima').style.display = "none"
  document.form1.elements['verifica[1]'].value="0";
  document.form1.emailcliente.value="";
  document.form1.password.value="";
  document.form1.passwordr.value="";
  document.form1.nomecliente.value="";
  document.form1.cognomecliente.value="";
  document.form1.ditta.value="";
  document.form1.viacliente.value="";
  document.form1.capcliente.value="";
  document.form1.cittacliente.value="";
  document.form1.provinciacliente.value="";
  document.form1.cfpivacliente.value="";
  document.form1.telefonocliente.value="";
 }
 function prima(field)
{
  document.form1.elements['verifica[1]'].value="1";
   document.getElementById('prima').style.display = "";
   document.getElementById('cliente').style.display = "none"
   document.form1.userid1.value="";
   document.form1.password1.value="";

 }
 

function showObject3(id) { 
if(id=='1a1'){
document.getElementById(id).style.left = 400;
document.getElementById(id).style.height  = 'auto';
    document.getElementById(id).style.display = ""; 
	document.getElementById('1a').style.background='url(lab1s.gif)';
	document.getElementById('2a').style.background='url(lab2d.gif)';
	        document.getElementById('2a2').style.display = "none"; 
			document.getElementById('2b').style.display = "none"; 
			document.getElementById('3b').style.display = "none"; 
			document.getElementById('1b').style.display = ""; 
			document.getElementById('1b').style.background='url(l1.gif)';
        	document.getElementById('3a3').style.display = "none";
			document.getElementById('3a').style.background='url(lab2d.gif)';
		 

		}
if(id=='2a2'){
document.getElementById(id).style.left = 400;
document.getElementById(id).style.height  = 'auto';
    document.getElementById(id).style.display = ""; 
	
        document.getElementById('1a1').style.display = "none"; 
        document.getElementById('3a3').style.display = "none"; 
		document.getElementById('3a').style.background='url(lab2d.gif)';
		document.getElementById('1a').style.background='url(lab1d.gif)';
		document.getElementById('2a').style.background='url(lab2s.gif)';
		document.getElementById('2b').style.display = ""; 
			document.getElementById('3b').style.display = "none"; 
			document.getElementById('1b').style.display = "none"; 
			document.getElementById('2b').style.background='url(l1.gif)';

		}
		if(id=='3a3'){
document.getElementById(id).style.left = 400;
document.getElementById(id).style.height  = 'auto';
    document.getElementById(id).style.display = ""; 
	document.getElementById('2a2').style.height  = '1px';
    document.getElementById('2a2').style.display = "none"; 
	document.getElementById('1a1').style.height  = '1px';
    document.getElementById('1a1').style.display = "none"; 
				document.getElementById('3a').style.background='url(lab2s.gif)';
		document.getElementById('1a').style.background='url(lab1d.gif)';
		document.getElementById('2a').style.background='url(lab2d.gif)';
				document.getElementById('3b').style.display = ""; 
			document.getElementById('2b').style.display = "none"; 
			document.getElementById('1b').style.display = "none"; 
			document.getElementById('3b').style.background='url(l1.gif)';

		}
		
} 



