// JavaScript Documento Site
function startmenu()
  {
  	menu0.style.display = "none";
  }

function menu0func()
  {
  	if(menu0.style.display == "none")
  	{
  		startmenu();
  		menu0.style.display = "block";
  	}
  	else
  	{
  		startmenu();
  	}
  }

function omaggio_envia(){
   if(document.form_omaggio.nome.value ==""){
      alert("Il campo NOME è obbligatorio!");
	  document.form_omaggio.nome.focus();
	  return false;
   }
   if (document.form_omaggio.email.value == ""){
	   alert ("Il campo E-MAIL è obbligatorio!");
	   document.form_omaggio.email.focus();
	   return false;
   }
   if (document.form_omaggio.email.value.indexOf('@', 0) == -1 || document.form_omaggio.email.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL non valido!");
	   document.form_omaggio.email.focus();   
	   return false;
   }
   if(document.form_omaggio.telefone.value ==""){
      alert("Il campo TELEFONO è obbligatorio!");
	  document.form_omaggio.telefone.focus();
	  return false;
   } 
   return true;
}

function foto_envia(){
   if(document.form_enviafoto.nome_remetente.value ==""){
      alert("NOME mittente è obbligatorio!");
	  document.form_enviafoto.nome_remetente.focus();
	  return false;
   }
   if (document.form_enviafoto.email_remetente.value == ""){
	   alert ("E-MAIL mittente è obbligatorio!");
	   document.form_enviafoto.email_remetente.focus();
	   return false;
   }
   if (document.form_enviafoto.email_remetente.value.indexOf('@', 0) == -1 || document.form_enviafoto.email_remetente.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL mittente non valido!");
	   document.form_enviafoto.email_remetente.focus();   
	   return false;
   }
   if(document.form_enviafoto.nome_destinatario.value ==""){
      alert("NOME destinatario è obbligatorio!");
	  document.form_enviafoto.nome_destinatario.focus();
	  return false;
   }
   if (document.form_enviafoto.email_destinatario.value == ""){
	   alert ("E-MAIL destinatario è obbligatorio!");
	   document.form_enviafoto.email_destinatario.focus();
	   return false;
   }
   if (document.form_enviafoto.email_destinatario.value.indexOf('@', 0) == -1 || document.form_enviafoto.email_destinatario.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL destinatario non valido!");
	   document.form_enviafoto.email_destinatario.focus();   
	   return false;
   }
   return true;
}
function abrir_janela_popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function envia_newsletter(){
   if (document.form_newsletter.nome_newsletter.value == ""){
      alert('Il campo NOME è obbligatorio!');
	  document.form_newsletter.nome_newsletter.focus();
	  return false;
   }
   if (document.form_newsletter.email_newsletter.value == ""){
	   alert ("Il campo E-MAIL è obbligatorio!");
	   document.form_newsletter.email_newsletter.focus();
	   return false;
   }
   if (document.form_newsletter.email_newsletter.value.indexOf('@', 0) == -1 || document.form_newsletter.email_newsletter.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL non valido!");
	   document.form_newsletter.email_newsletter.focus();   
	   return false;
   }
   if (document.form_newsletter.privacy.checked == false){
      alert('Devi accettare la PRIVACY!');
	  document.form_newsletter.privacy.checked = true;
	  return false;
   }
   return true;
}
function addToFavorite(favTitle){
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
    window.external.AddFavorite(location.href, unescape(favTitle));
  }
}
function envia_contato(){
   if(document.form_contato.nome_contato.value ==""){
      alert("NOME è obbligatorio!");
	  document.form_contato.nome_contato.focus();
	  return false;
   }
   if (document.form_contato.email_contato.value == ""){
	   alert ("E-MAIL è obbligatorio!");
	   document.form_contato.email_contato.focus();
	   return false;
   }
   if (document.form_contato.email_contato.value.indexOf('@', 0) == -1 || document.form_contato.email_contato.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL non valido!");
	   document.form_contato.email_contato.focus();   
	   return false;
   }
   if(document.form_contato.mensagem_contato.value ==""){
      alert("Messaggio è obbligatorio!");
	  document.form_contato.mensagem_contato.focus();
	  return false;
   } 
   if (document.form_contato.privacy.checked == false){
      alert('Devi accettare la PRIVACY!');
	  document.form_contato.privacy.checked = true;
	  return false;
   }
   return true;
}
function envia_grafica(){
   if(document.form_grafica.nome_grafica.value ==""){
      alert("NOME è obbligatorio!");
	  document.form_grafica.nome_grafica.focus();
	  return false;
   }
   if (document.form_grafica.email_grafica.value == ""){
	   alert ("E-MAIL è obbligatorio!");
	   document.form_grafica.email_grafica.focus();
	   return false;
   }
   if (document.form_grafica.email_grafica.value.indexOf('@', 0) == -1 || document.form_grafica.email_grafica.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL non valido!");
	   document.form_grafica.email_grafica.focus();   
	   return false;
   }
   if(document.form_grafica.mensagem_grafica.value ==""){
      alert("Messaggio è obbligatorio!");
	  document.form_grafica.mensagem_grafica.focus();
	  return false;
   } 
   if (document.form_grafica.privacy_grafica[0].checked == false){
      alert('Devi accettare la PRIVACY!');
	  document.form_grafica.privacy_grafica[0].checked = true;
	  return false;
   }
   return true;
}

function envia_evento(){
   if(document.form_evento.titulo_evento.value ==""){
      alert("Il campo TITOLO è obbligatorio!");
	  document.form_evento.titulo_evento.focus();
	  return false;
   }
   if(document.form_evento.cidade_evento.value ==""){
      alert("Il campo CITTÀ è obbligatorio!");
	  document.form_evento.cidade_evento.focus();
	  return false;
   }
   if(document.form_evento.endereco_evento.value ==""){
      alert("Il campo INDIRIZZO è obbligatorio!");
	  document.form_evento.endereco_evento.focus();
	  return false;
   }  
   if(document.form_evento.data_evento.value ==""){
      alert("Il campo DATA è obbligatorio!");
	  document.form_evento.data_evento.focus();
	  return false;
   }    
   if(document.form_evento.mensagem_evento.value ==""){
      alert("Descrizione è obbligatorio!");
	  document.form_evento.mensagem_evento.focus();
	  return false;
   }
   if(document.form_evento.nome_evento.value ==""){
      alert("Il campo NOME è obbligatorio!");
	  document.form_evento.nome_evento.focus();
	  return false;
   }
   if(document.form_evento.telefone_evento.value ==""){
      alert("Il campo TELEFONO è obbligatorio!");
	  document.form_evento.telefone_evento.focus();
	  return false;
   }           
   if (document.form_evento.privacy_evento[0].checked == false){
      alert('Devi accettare la PRIVACY!');
	  document.form_evento.privacy_evento[0].checked = true;
	  return false;
   }
   return true;
}


// Permite apenas número no campo
// onKeyPress="return checkIt(event)"

function checkIt(evt) {
	evt = (evt) ? evt : window.event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 44 && charCode != 46) {
		alert ("Campo numerico!")
		return false
	}	
	return true
}
/*
Exemplos:
onkeyup="formatar(this, '###.###.###-##');"
onkeyup="formatar(this, '#####-###');"
*/
function formatar( src, mask ) {
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)
	if (texto.substring(0,1) != saida) {
		src.value += texto.substring(0,1);
	}
}
function envia_amigo(){
   if(document.form_amigo.nome1_amigo.value ==""){
      alert("NOME mittente è richiesto!");
	  document.form_amigo.nome1_amigo.focus();
	  return false;
   }
   if (document.form_amigo.email1_amigo.value == ""){
	   alert ("E-MAIL mittente è richiesto!");
	   document.form_amigo.email1_amigo.focus();
	   return false;
   }
   if (document.form_amigo.email1_amigo.value.indexOf('@', 0) == -1 || document.form_amigo.email1_amigo.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL mittente non valido!");
	   document.form_amigo.email1_amigo.focus();   
	   return false;
   }
   if(document.form_amigo.nome2_amigo.value ==""){
      alert("NOME destinatario è richiesto!");
	  document.form_amigo.nome2_amigo.focus();
	  return false;
   }
   if (document.form_amigo.email2_amigo.value == ""){
	   alert ("E-MAIL destinatario è richiesto!");
	   document.form_amigo.email2_amigo.focus();
	   return false;
   }
   if (document.form_amigo.email2_amigo.value.indexOf('@', 0) == -1 || document.form_amigo.email2_amigo.value.indexOf('.', 0) == -1){
	   alert ("E-MAIL destinatario non valido!");
	   document.form_amigo.email2_amigo.focus();   
	   return false;
   }   
   return true;
}
function atualizaCart(val) {
	if (val == 1) {
		 document.form_local.cart1.checked = false;
	}
	else {
		for (i=2;i<=12;i++) {
				box = eval("document.form_local.cart" + i);
				box.checked = false;				
		}	 	
	}
}

function atualizaAmb(val) {
	if (val == 1) {
		 document.form_local.amb1.checked = false;
	}
	else {
		for (i=2;i<=10;i++) {
				box = eval("document.form_local.amb" + i);
				box.checked = false;				
		}	 	
	}
}
function envia_local(){
   if (document.form_local.nome_local_inc.value == ""){
	   alert ("Il campo NOME è obbligatorio!");
	   document.form_local.nome_local_inc.focus();
	   return false;
   }
   if (document.form_local.cidade_local_inc.value == ""){
	   alert ("Il campo CITTÀ è obbligatorio!");
	   document.form_local.cidade_local_inc.focus();
	   return false;
   }
   if (document.form_local.cep_local_inc.value == ""){
	   alert ("Il campo CAP è obbligatorio!");
	   document.form_local.cep_local_inc.focus();
	   return false;
   }
   if (document.form_local.endereco_local_inc.value == ""){
	   alert ("Il campo INDIRIZZO è obbligatorio!");
	   document.form_local.endereco_local_inc.focus();
	   return false;
   }
   if (document.form_local.descricao_local_inc.value == ""){
	   alert ("Il campo DESCRIZIONE è obbligatorio!");
	   document.form_local.descricao_local_inc.focus();
	   return false;
   }
   if (document.form_local.razao_local_inc.value == ""){
	   alert ("Il campo RAGIONE SOCIALE è obbligatorio!");
	   document.form_local.razao_local_inc.focus();
	   return false;
   }
   if (document.form_local.iva_local_inc.value == ""){
	   alert ("Il campo PARTITA IVA è obbligatorio!");
	   document.form_local.iva_local_inc.focus();
	   return false;
   }
   if (document.form_local.res_cidade.value == ""){
	   alert ("Il campo CITTÀ è obbligatorio!");
	   document.form_local.res_cidade.focus();
	   return false;
   }
   if (document.form_local.res_cep.value == ""){
	   alert ("Il campo CAP è obbligatorio!");
	   document.form_local.res_cep.focus();
	   return false;
   }
   if (document.form_local.res_endereco.value == ""){
	   alert ("Il campo INDIRIZZO è obbligatorio!");
	   document.form_local.res_endereco.focus();
	   return false;
   }
   if (document.form_local.res_telefone.value == ""){
	   alert ("Il campo TELEFONO è obbligatorio!");
	   document.form_local.res_telefone.focus();
	   return false;
   }
   if (document.form_local.privacy_res[0].checked == false){
      alert('Devi accettare la PRIVACY!');
	  document.form_local.privacy_res[0].checked = true;
	  return false;
   }
   return true;
}
function envia_reservada(){
   if (document.form_areareservada.nome_login.value == ""){
	   alert ("Il campo Login è obbligatorio!");
	   document.form_areareservada.nome_login.focus();
	   return false;
   }
   if (document.form_areareservada.senha_login.value == ""){
	   alert ("Il campo PASSWORD è obbligatorio!");
	   document.form_areareservada.senha_login.focus();
	   return false;
   }
   return true;
}

function janelafoto(foto)
{
janelanfoto = window.open(foto, 'foto','height=450,width=450,left=30,top=30,scrollbars=auto')
}
