	 function displayTable(campo){ 
		document.getElementById('tbAspira1').style.display = 'none'; 
		document.getElementById('tbAspira2').style.display = 'none';
		document.getElementById(campo).style.display = 'block';
		
		}

	function Validate(str,checkStr){
				
		var matchArray = str.match(checkStr); 
		
		if (matchArray == null){
			return false;
		}
		return true;
	}
	
	function ValidatePwd(str,checkStr){				

		pattern = /[0-9]/g; 
		if (!str.match(pattern)) {
			return false;
		}		  

		var matchArray = str.match(checkStr); 
		
		if (matchArray == null){
			return false;
		}
		return true;
	}
	//solo lettere spazio e simboli min3car max 20
	var control_1 = /^[a-zA-Z0-9\%\.\_\-\@\!\?]{3,20}$/;
	//solo lettere spazio e apic. min3car max nd
	var control_2 = /^[a-zA-Z\ \']{3,}$/;
	//mail
	var control_3 = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	//controllo data
	var control_d = /^([0-9]{2})+\/([0-9]{2})+\/([0-9]{4})+$/;
												   
	var control_4 = /^[a-zA-Z0-9\ \'\-\_\@\.]{3,}$/;
	var control_5 = /^[a-zA-Z0-9\ \'\-\,\.]{3,}$/;
	var control_6 = /^[a-zA-Z0-9\ \'\-]{3,}$/;
	var control_7 = /^[0-9\+\(\)\ \/]{3,}$/;
	var control_8 = /^[a-zA-Z0-9\ \-\_\.\@\%]{6,20}$/;
	var control_9 = /^[0-9]{1,}$/;
	var control_0 = /^[a-zA-Z0-9]{3,}$/;
	var control_a = /^[a-zA-Z0-9\-\.\:\/\@]{5,}$/;
	var control_b = /^[a-zA-Z0-9\%\.\_\@\!\?]{6,20}$/;
	var control_c = /^[a-zA-Z0-9\%\.\_]{5,15}$/;

function CheckOfferta()
{
		off = document.offerta;
		/*if (off.nOfferta.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.nOfferta.focus();
			return;
		}
		
		if (off.data.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.data.focus();
			return;
		}
		
		if (Validate(off.data.value,control_d) == false){
			alert("ATTENZIONE: scrivere la data nel formato corretto gg/mm/aaaa ");
			off.data.focus();
			return;
		}
		
		if (off.referente.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.referente.focus();
			return;
		}
		
		if (off.cliente.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.cliente.focus();
			return;
		}*/
		
		if (off.Nref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Nref.focus();
			return;
			}
			
		if (off.Sref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Sref.focus();
			return;
			}
			
		if (off.Servizio.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Servizio.focus();
			return;
			}

		/*if (off.Quantita.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Quantita.focus();
			return;
			}
			
		if (Validate(off.Quantita.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.Quantita.focus();
			return;
		}*/

		if (off.Fluido.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Fluido.focus();
			return;
			}
			
		if (off.m3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.m3h.focus();
			return;
			}

		if (Validate(off.m3h.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.m3h.focus();
			return;
		}
			
		if (off.nm3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.nm3h.focus();
			return;
			}
			
		if (Validate(off.nm3h.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.nm3h.focus();
			return;
		}

		if (off.Pressione.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Pressione.focus();
			return;
			}

		if (Validate(off.Pressione.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.Pressione.focus();
			return;
		}
			
		if (off.Altitudine.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Altitudine.focus();
			return;
			}

		if (Validate(off.Altitudine.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.Altitudine.focus();
			return;
		}
			
		if (off.Cabina.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Cabina.focus();
			return;
			}

		if (off.Temperatura.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off.Temperatura.focus();
			return;
			}

		if (Validate(off.Temperatura.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off.Temperatura.focus();
			return;
		}

	off.submit();
}

function CheckOfferta2()
{

	off2 = document.offerta2;

	/*if (off2.nOfferta.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.nOfferta.focus();
			return;
		}
		
	if (off2.data.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.data.focus();
			return;
		}
		
	if (Validate(off2.data.value,control_d) == false){
			alert("ATTENZIONE: scrivere la data nel formato corretto gg/mm/aaaa ");
			off2.data.focus();
			return;
		}
		
	if (off2.referente.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.referente.focus();
			return;
		}
		
	if (off2.cliente.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.cliente.focus();
			return;
		}*/
		
	if (off2.Nref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Nref.focus();
			return;
			}
			
	if (off2.Sref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Sref.focus();
			return;
			}
			
	if (off2.Servizio.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Servizio.focus();
			return;
			}

	/*if (off2.Quantita.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Quantita.focus();
			return;
			}
			
	if (Validate(off2.Quantita.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			off2.Quantita.focus();
			return;
		}*/

	if (off2.Fluido.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Fluido.focus();
			return;
			}
			
	if (off2.m3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.m3h.focus();
			return;
			}
			
	if (Validate(off2.m3h.value,control_9) == false){
			alert("ATTENZIONE: iserire solo numeri");
			off2.m3h.focus();
			return;
			}
			
	if (off2.nm3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.nm3h.focus();
			return;
			}
			
	if (Validate(off2.nm3h.value,control_9) == false){
			alert("ATTENZIONE: iserire solo numeri");
			off2.nm3h.focus();
			return;
			}
			
	if (off2.aspirazione.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.aspirazione.focus();
			return;
			}
			
	if (Validate(off2.aspirazione.value,control_9) == false){
			alert("ATTENZIONE: iserire solo numeri");
			off2.aspirazione.focus();
			return;
		}

	if (off2.spinta.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.spinta.focus();
			return;
			}
			
	if (Validate(off2.spinta.value,control_9) == false){
			alert("ATTENZIONE: iserire solo numeri");
			off2.spinta.focus();
			return;
		}

	if (off2.Cabina.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Cabina.focus();
			return;
			}
			
	if (off2.Temperatura.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			off2.Temperatura.focus();
			return;
			}
			
	if (Validate(off2.Temperatura.value,control_9) == false){
			alert("ATTENZIONE: iserire solo numeri");
			off2.Temperatura.focus();
			return;
			}

	off2.submit();
}
//Controllo la selezione dell'offerta
function CheckElenco(){
	oe = document.offertaElenco;
	
	oe.submit();
	}

function CheckOffertaDettaglio(){
	od = document.offertaDettaglio;
	
		if (od.nOfferta.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.nOfferta.focus();
			return;
		}
		
		if (od.data.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.data.focus();
			return;
		}
		
		if (Validate(od.data.value,control_d) == false){
			alert("ATTENZIONE: scrivere la data nel formato corretto gg/mm/aaaa ");
			od.data.focus();
			return;
		}	
		
	if (od.Nref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Nref.focus();
			return;
			}
			
	if (od.Sref.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Sref.focus();
			return;
			}
			
	if (od.Contatto.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Contatto.focus();
			return;
			}
			
	if (od.Direzione.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Direzione.focus();
			return;
			}
			
	if (od.Servizio.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Servizio.focus();
			return;
			}
		
	if (od.Pasp.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Pasp.focus();
			return;
			}
			
		if (Validate(od.Pasp.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Pasp.focus();
			return;
		}	
		
	if (od.PesEsp.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.PesEsp.focus();
			return;
			}
			
		if (Validate(od.PesEsp.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.PesEsp.focus();
			return;
		}	
		
	if (od.Tasp.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Tasp.focus();
			return;
			}
			
	if (Validate(od.Tasp.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Tasp.focus();
			return;
		}	
		
	if (od.Fluido.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Fluido.focus();
			return;
			}
			
	if (od.m3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.m3h.focus();
			return;
			}
			
	if (Validate(od.m3h.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.m3h.focus();
			return;
		}
			
	if (od.nm3h.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.nm3h.focus();
			return;
			}
			
	if (Validate(od.nm3h.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.nm3h.focus();
			return;
			}			
			
	if (od.Dif.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Dif.focus();
			return;
		}
			
	if (Validate(od.Dif.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Dif.focus();
			return;
			}			
		
	if (od.Vel.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Vel.focus();
			return;
		}

	if (Validate(od.Vel.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Vel.focus();
			return;
			}			
		
	if (od.Motore.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Motore.focus();
			return;
		}
		
	if (Validate(od.Motore.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Motore.focus();
			return;
			}			
		
	if (od.RumoreS.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.RumoreS.focus();
			return;
		}
			
	if (Validate(od.RumoreS.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.RumoreS.focus();
			return;
			}			
		
	if (od.RumoreC.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.RumoreC.focus();
			return;
		}
		
	if (Validate(od.RumoreC.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.RumoreC.focus();
			return;
			}			

	if (od.IncrTemp.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.IncrTemp.focus();
			return;
		}
		
	if (Validate(od.IncrTemp.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.IncrTemp.focus();
			return;
			}			

	if (od.TempImp.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.TempImp.focus();
			return;
		}
		
	if (Validate(od.TempImp.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.TempImp.focus();
			return;
			}			

	if (od.CvAbs.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.CvAbs.focus();
			return;
		}
		
	if (Validate(od.CvAbs.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.CvAbs.focus();
			return;
			}			

	if (od.KwAbs.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.KwAbs.focus();
			return;
		}
		
	if (Validate(od.KwAbs.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.KwAbs.focus();
			return;
			}			

	if (od.CvMotore.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.CvMotore.focus();
			return;
		}
		
	if (Validate(od.CvMotore.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.CvMotore.focus();
			return;
			}			

	if (od.KwMotore.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.KwMotore.focus();
			return;
		}
		
	if (Validate(od.KwMotore.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.KwMotore.focus();
			return;
			}			

	if (od.Tipo.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Tipo.focus();
			return;
		}

	if (od.Quantita.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Quantita.focus();
			return;
		}
		
	if (Validate(od.Quantita.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Quantita.focus();
			return;
		}			

	if (od.prezzoGruppo.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.prezzoGruppo.focus();
			return;
		}
		
	if (Validate(od.prezzoGruppo.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.prezzoGruppo.focus();
			return;
		}			

	if (od.Sconto.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Sconto.focus();
			return;
		}
		
	if (Validate(od.Sconto.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Sconto.focus();
			return;
		}			

	if (od.prezzoEl.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.prezzoEl.focus();
			return;
		}
		
	if (Validate(od.prezzoEl.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.prezzoEl.focus();
			return;
		}			

	if (od.prezzoMotore.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.prezzoMotore.focus();
			return;
		}
		
	if (Validate(od.prezzoMotore.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.prezzoMotore.focus();
			return;
		}			

	if (od.prezzoCabina.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.prezzoCabina.focus();
			return;
		}
		
	if (Validate(od.prezzoCabina.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.prezzoCabina.focus();
			return;
		}			

	if (od.Pagamento.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Pagamento.focus();
			return;
		}
		
	if (Validate(od.Pagamento.value,control_9) == false){
			alert("ATTENZIONE: inserire solo numeri ");
			od.Pagamento.focus();
			return;
		}			

	if (od.Trasporto.value.replace(/^ +/, "") == ""){
			alert("ATTENZIONE: campo obbligatorio");
			od.Trasporto.focus();
			return;
		}

	od.submit();
	}

