// JavaScript Document

	// Only Numbers Textbox
	function onlyNumbers(evt){
		var e = event || evt; // for trans-browser compatibility
		var charCode = e.which || e.keyCode;
		if (charCode > 31 && (charCode < 48 || charCode > 57)){
			alert("ATTENZIONE: Questo campo richiede solo valori numerici.");
			return false;
		}
		return true;
	}
	
	
	// Newsletter form validations
	function checkFormNewsletter(){
		mail = document.frmNewsletter.txtEmailNewsletter.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   
	 if(document.frmNewsletter.txtNomeNewsletter.value == ""){
      document.getElementById('lblNomeNewsletter').style.color='#FF0000';
			document.getElementById('lblNomeNewsletter').innerHTML  = "*Nome:";
			document.frmNewsletter.txtNomeNewsletter.focus();
			return false;
			} else if(Filtro.test(mail)== false){
					document.getElementById('lblNomeNewsletter').style.color='#CCC';
					document.getElementById('lblNomeNewsletter').innerHTML  = "*Nome:";
					document.getElementById('lblEmailNewsletter').style.color='#FF0000';
					document.getElementById('lblEmailNewsletter').innerHTML  = "*Email";
					document.frmNewsletter.txtEmailNewsletter.focus();
					return false;
	}
}

// Contact Form Validation
	function checkFormContact(){
		mail = document.formContact.txtEmail.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   
	 if(document.formContact.txtNome.value == ""){
      document.getElementById('lblNome').style.color='#FF0000';
			document.getElementById('lblNome').innerHTML  = "*Nome:";
			document.formContact.txtNome.focus();
			return false;
	 } else if(document.formContact.txtCognome.value == ""){
						 document.getElementById('lblNome').style.color='#666';
						 document.getElementById('lblNome').innerHTML  = "*Nome:";
						 document.getElementById('lblCognome').style.color='#FF0000';
						 document.getElementById('lblCognome').innerHTML  = "*Cognome:";
						 document.formContact.txtCognome.focus();
						 return false;
					} else if(Filtro.test(mail)== false){
										document.getElementById('lblCognome').style.color='#666';
										document.getElementById('lblCognome').innerHTML  = "*Cognome:";
										document.getElementById('lblEmail').style.color='#FF0000';
										document.getElementById('lblEmail').innerHTML  = "*Email:";
										document.formContact.txtEmail.focus();
										return false; 
									} else if(document.formContact.txtMessaggio.value == ""){
														document.getElementById('lblEmail').style.color='#666';
														document.getElementById('lblEmail').innerHTML  = "*Email:";
													  	document.getElementById('lblMessaggio').style.color='#FF0000';
														document.getElementById('lblMessaggio').innerHTML  = "*Messaggio:";
														document.formContact.txtMessaggio.focus();
											 			return false;
								  }
	
	}
	
	
	
	// Contact Form Validation
	function checkFormCataloghi(){
		mail = document.frmRichCataloghi.txtEmailCat.value;
		Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   
	 if(document.frmRichCataloghi.txtNome.value == ""){
      document.getElementById('lblNome').style.color='#FF0000';
			document.getElementById('lblNome').innerHTML  = "*Nome Societa':";
			document.frmRichCataloghi.txtNome.focus();
			return false;
	 } else if(document.frmRichCataloghi.txtIndirizzo.value == ""){
						 document.getElementById('lblNome').style.color='#666';
						 document.getElementById('lblNome').innerHTML  = "*Nome Societa':";
						 document.getElementById('lblIndirizzo').style.color='#FF0000';
						 document.getElementById('lblIndirizzo').innerHTML  = "*Indirizzo:";
						 document.frmRichCataloghi.txtIndirizzo.focus();
						 return false;
					}  else if(document.frmRichCataloghi.txtCap.value == ""){
										 document.getElementById('lblIndirizzo').style.color='#666';
										 document.getElementById('lblIndirizzo').innerHTML  = "*Indirizzo:";
										 document.getElementById('lblCap').style.color='#FF0000';
										 document.getElementById('lblCap').innerHTML  = "*Cap:";
										 document.frmRichCataloghi.txtCap.focus();
							 			 return false;
									} else if(document.frmRichCataloghi.txtCitta.value == ""){
														document.getElementById('lblCap').style.color='#666';
														document.getElementById('lblCap').innerHTML  = "*Cap:";
													  document.getElementById('lblCitta').style.color='#FF0000';
														document.getElementById('lblCitta').innerHTML  = "*Citta':";
														document.frmRichCataloghi.txtCitta.focus();
											 			return false;
									} else if(document.frmRichCataloghi.txtNazione.value == ""){
														document.getElementById('lblCitta').style.color='#666';
														document.getElementById('lblCitta').innerHTML  = "*Cap:";
													  document.getElementById('lblNazione').style.color='#FF0000';
														document.getElementById('lblNazione').innerHTML  = "*Nazione:";
														document.frmRichCataloghi.txtNazione.focus();
											 			return false;
								  } else if(Filtro.test(mail)== false){
										document.getElementById('lblNazione').style.color='#666';
										document.getElementById('lblNazione').innerHTML  = "*Nazione:";
										document.getElementById('lblEmailCat').style.color='#FF0000';
										document.getElementById('lblEmailCat').innerHTML  = "*Email:";
										document.frmRichCataloghi.txtEmailCat.focus();
										return false; 
									}
	
	}



