function popup(img,x,y) 
{
	url="popup.php?img="+img;
	width=x+40;
	height=y+40;
	name="";
	
	settings="toolbar=no,location=no,directories=no,"+"status=no,menubar=no,scrollbars=yes,"+"resizable=yes,width="+width+",height="+height;
	NewWindow=window.open(url,name,settings);
}

function trim(x) 
		{
			return x.toString().replace(/^[ \t\r\n]+/,'').replace(/[ \t\r\n]+$/,'');
		}


//controlla il form nel campo contatti
function checkform(Form) 
{
   var descrErrore="";
   var errore = false;

   // Controllo sul campo name
   if (trim(Form.nome.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"Name\"";
      if (!errore) Form.nome.focus();
      errore = true;
   }
   
    
   // Controllo sul campo e-mail
   if (trim(Form.email.value).length==0) 
   {
      descrErrore += "\n- Please insert your \"E-Mail\"";
      if (!errore) Form.email.focus();
      errore = true;
   }
   else 
   {
      // controllo forma dell'email
      if (Form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) 
      {
         descrErrore += "\n- Please insert your \"E-Mail\" like name@domain.ext";
         if (!errore) 
	 {
            Form.email.select();
            Form.email.focus();
         }
      errore = true;
      }
   }
   
   if (errore) 
   {
      window.alert(descrErrore);
      return false;
   }
   else 
   {
      return true;
   }

}
