//****************************************************************************************
//*	    Creare dinamicamente una pagina HTML e visualizza n immagini		             *    
//****************************************************************************************
function visualizza(nome, n) {//Nome comune delle immagini e loro numero
var i;
Win=window.open('','enlargement','width=900,height=600,menubar=0,toolbar=0,status=0,scrollbars=2,resizable=1');
Win.document.writeln('<html><head><title>'+ nome +'</title></head>'+'<body bgcolor=white onclick="window.close();">');
Win.document.writeln('<script language="javascript">window.moveTo(0,0);window.resizeTo(screen.width,screen.height);</script>');//Allarga a pieno schermo la finestra
for(i=1 ;i <= n; i++){//Inserimento nella finestra delle n immagini
  Win.document.writeln('<a href="javascript:window.close();"><img src="img/'+nome+'_'+i+'.jpg" BORDER=0></a>');
  //if(((i % 3) == 0) && (i!=0)) Win.document.writeln('<BR>');//dopo 4 immagini passa alla riga di sotto
};
Win.document.writeln('</body></html>');
}

//***************************************************************************************
//*		    Espande la pagina HTML a pieno schermo               		                *    
//***************************************************************************************
function PienoSchermo(){
  window.moveTo(0,0);//posiziona l'angolo superiore sx della pagina nell'angolo superio sx dello schermo
  window.resizeTo(screen.width,screen.height);//espande le dimensioni della pagina su quelle dello schermo
}

//***************************************************************************************
//*		    Controlla se un indirizzo EMAIL è valido               		                *    
//***************************************************************************************
function check_email(address) {
  if ( (address == "") || (address.indexOf ('@') == -1) || (address.indexOf ('.') == -1)) {
     return false;
  }else{
     return true;
  }
}

//***************************************************************************************
//*		    Controlla se un argomento è un numero               		                *    
//***************************************************************************************
function ValidNumber(item) {
 if (isNaN(item) == true) return false;
    return true;
}

//***************************************************************************************
//*		    Validazione dei campi nomemail_utente e messaggio  di un FORM               *    
//***************************************************************************************
function ValidateForm(this_form){
   if (this_form.elements["nome"].value == ""){
      //alert("是必要的写制字段名称");
      eval("this_form.nome.focus()");
      Win=window.open('','enlargement','width=300,height=120,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0');
      Win.document.writeln('<html><head><title>Warning</title></head><body bgcolor=white onclick="window.close();">');
      Win.document.writeln('<script language="javascript">window.moveTo(screen.width/2-150,screen.height/2-60);</script>');//Centra la finestra
      Win.document.writeln("<br><center><font color='#FF0000'>是必要的写制字段名称</font></center><br>");
      Win.document.writeln('<center><input type="button" value="       好       " onclick="window.close();"></center>');
      Win.document.writeln('</body></html>');
      return false;
   }
   if(!check_email(this_form.elements["email_utente"].value)){
      //alert("是必要的写制正确领域的电子邮件");
      eval("this_form.email_utente.focus()");
      Win=window.open('','enlargement','width=300,height=120,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0');
	  Win.document.writeln('<html><head><title>Warning</title></head><body bgcolor=white onclick="window.close();">');
      Win.document.writeln('<script language="javascript">window.moveTo(screen.width/2-150,screen.height/2-60);</script>');//Centra la finestra
      Win.document.writeln("<br><center><font color='#FF0000'>是必要的写制正确领域的电子邮件</font></center><br>");
      Win.document.writeln('<center><input type="button" value="       好       " onclick="window.close();"></center>');
      Win.document.writeln('</body></html>');
      return false;
   }
   if (this_form.elements["messaggio"].value == ""){
      //alert("是必要的写讯息");
      eval("this_form.messaggio.focus()");
      Win=window.open('','enlargement','width=300,height=120,menubar=0,toolbar=0,status=0,scrollbars=0,resizable=0');
      Win.document.writeln('<html><head><title>Warning</title></head><body bgcolor=white onclick="window.close();">');
      Win.document.writeln('<script language="javascript">window.moveTo(screen.width/2-150,screen.height/2-60);</script>');//Centra la finestra
      Win.document.writeln("<br><center><font color='#FF0000'>是必要的写讯息</font></center><br>");
      Win.document.writeln('<center><input type="button" value="       好       " onclick="window.close();"></center>');
      Win.document.writeln('</body></html>');
      return false;
   }
   return true;//Tutti i campi richiesti sono stati compilati correttamente
}
