function finestra_immagine(chemin,defaultWidth,defaultHeight)
{
	i1 = new Image;
	i1.src = chemin;
	html = '<HTML>\n<HEAD>\n<TITLE>Image</TITLE>\n</HEAD>\n<BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0>\n<CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER>\n</BODY>\n</HTML>';
	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0');
	popupImage.document.open();
	popupImage.document.write(html);
	popupImage.document.close();
}

function controlla_form_registrazione()
{
   var controllo_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;	
	
   if (document.form_registrazione.username.value=='') 
   {
      alert('Attenzione! inserire Username');
	  document.form_registrazione.username.focus();
	  return false;
   }  
   
   if (document.form_registrazione.username.value.length<5 || document.form_registrazione.username.value.length>10 ) 
   {
      alert('Attenzione! Il campo username deve essere min. 5 caratteri e max. 10 caratteri');
	  document.form_registrazione.username.focus();
	  return false;
   }  
   
   if (document.form_registrazione.password.value=='') 
   {
      alert('Attenzione! inserire Password');
	  document.form_registrazione.password.focus();
	  return false;
   } 
   
   if (document.form_registrazione.password.value.length<5 || document.form_registrazione.password.value.length>10 ) 
   {
      alert('Attenzione! Il campo password deve essere min. 5 caratteri e max. 10 caratteri');
	  document.form_registrazione.password.focus();
	  return false;
   }  
   
   if (document.form_registrazione.password.value!=document.form_registrazione.password2.value) 
   {
      alert('Attenzione! Il campo conferma password \n non corrisponde alla password inserita');
	  document.form_registrazione.password2.focus();
	  return false;
   } 
   
   if (document.form_registrazione.nome.value=='') 
   {
      alert('Attenzione! inserire il nome');
	  document.form_registrazione.nome.focus();
	  return false;
   }  
   
   if (document.form_registrazione.cognome.value=='') 
   {
      alert('Attenzione! inserire il cognome');
	  document.form_registrazione.cognome.focus();
	  return false;
   }

   if (document.form_registrazione.cap.value=='') 
   {
      alert('Attenzione! inserire il CAP');
	  document.form_registrazione.cap.focus();
	  return false;
   }

   if (document.form_registrazione.email.value=='' || !controllo_email.test(document.form_registrazione.email.value)) 
   {
      alert('Attenzione! e-mail errata');
	  document.form_registrazione.email.focus();
	  return false;
   }  

   if (document.form_registrazione.privacy.checked==false) 
   {
      alert('Attenzione! Non hai acconsentito il trattamento dei dati');
	  return false;
   }

   return true; 
}