// JavaScript Document

function countDown(){
  var now=new Date()
  var data=new Date()
  var nowSecs=now.getTime()
  var millenium=new Date((data.getFullYear()+1),0,1,0)
  var milleniumSecs=millenium.getTime()
  document.countdown.days.value=Math.floor ((((((milleniumSecs-nowSecs)/1000)/60)/60)/24))
  document.countdown.hours.value=23-now.getHours()
  document.countdown.minutes.value=59-now.getMinutes()
  document.countdown.seconds.value=59-now.getSeconds()
  myTimer=setTimeout("countDown()",1000)
}

function stopTimer() {
   clearTimeout(myTimer)
}



function ApriImmagini(file)
{
	if (typeof win1 != "undefined") 
	win1.close();
	var prop = "top=10, left=10, width=10, height=10";
	win1 = window.open(file, null, prop);
}

function controlla()
{
	
  var d = window.document.contatti
  var title_error = "ERRORE! Impossibile inviare la richiesta! \n\n"
  var error = ""
  
  if (d.mail.value) { 
		if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test( d.mail.value )) {
			error += "Il formato della email non č corretto.\n"
		}
	}
	  
  if (!d.nome.value)  error += "Inserire il vostro Nome. \n"
  if (!d.contatto.value)  error += "Inserire il vostro Contatto in azienda. \n"
  if (!d.citta.value)  error += "Inserire la cittā di provenienza. \n"
  if (!d.mail.value)  error += "Inserire l'indirizzo e-mail. \n"
  if (!d.telefono.value)  error += "Inserire il telefono \n"
  if (!d.servizio.value)  error += "Scegliere il tipo di servizio \n"
  if (!d.richiesta.value)  error += "Inserire il motivo delle vostra richiesta \n"
  
  else { if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test( d.mail.value ))  { error += "L'indirizzo e-mail inserito non č valido.\n" } }
  

  if (error) {
	 alert(title_error + error); 
	 return(false);
  } else {
	  return(true);
  }
	
	
}
