function checkModificaRiepilogo(){
	var ok = true;
	frm = document.getElementById('frm_modifica');
	
	if(!checkField(frm.Riferimento.value)) {
		ok = false;
		alert('\"Name and Surname\" values are not valid');
	}
	
	if(parseInt(frm.NumAdulti.value) + parseInt(frm.NumBambini.value) != parseInt(frm.TotalePersone.value)) {
		ok = false;
		alert('The edit at \"Number of Passengers\" value is not correct');
	}
	
	d = frm.data_da.value.substring(8,10)*1;
	m = frm.data_da.value.substring(5,7)*1-1;
	y = frm.data_da.value.substring(0,4)*1;

	da_d = frm.data_inizio.value.substring(8,10)*1
	da_m = frm.data_inizio.value.substring(5,7)*1-1;
	da_y = frm.data_inizio.value.substring(0,4)*1;
	
	a_d = frm.data_fine.value.substring(8,10)*1;
	a_m = frm.data_fine.value.substring(5,7)*1-1;
	a_y = frm.data_fine.value.substring(0,4)*1;
	
	var date = new Date(y, m, d);
	var date_da = new Date(da_y, da_m, da_d);
	var date_a = new Date(a_y, a_m, a_d);
	
	if (date >= date_a || date < date_da) {
		ok = false;
		alert('The edit at the date value is not correct');
	}
		
	if(ok) {
		document.getElementById("frm_modifica").submit();
	}
}

function checkInvioUtenteRegistrato() {
	var strErrore = 'Mandatory Field';
	var ok = true;
	
	if(document.getElementById("Richiesta").value != strErrore){
		if(!checkField(document.getElementById("Richiesta").value)) {
			document.getElementById("Richiesta").style.color ='#FF0000';
			document.getElementById("Richiesta").value = strErrore;
			document.getElementById("Richiesta").onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}else{
		ok = false;
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
		alert("It's mandatory to accept the privacy notice before proceeding with the registration");
	} else if (!ok) 
		alert("Please fill out the form before proceeding");
		
	if(ok){
		document.getElementById("form_contatti").submit();
	}
}

function checkInvioClienteFinale(){

	var arrayCampi = new Array("nome","cognome","nazione");
	
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
		alert("It's mandatory to accept the privacy notice before proceeding with the registration");
	} else if (!ok) 
		alert("Please fill out the form before proceeding");
	
		
	if(ok){
		document.getElementById("frm_register").submit();
	}
}


function checkInvioNuovoUtente(){

	var arrayCampi = new Array("nome","cognome","citta","provincia","telefono","nazione","indirizzo");
	
	var arrayEmail = new Array("email");
	
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	for(var n=0;n<arrayEmail.length;n++){
		var myCampo = arrayEmail[n];
		if(!checkEmail(document.getElementById(myCampo).value)){
			document.getElementById(myCampo).style.color ='#FF0000';
			document.getElementById(myCampo).value = strEmail;
			document.getElementById(myCampo).onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
		alert("It's mandatory to accept the privacy notice before proceeding with the registration");
	} else if (!ok) 
		alert("Please fill out the form before proceeding");
	
		
	if(ok){
		document.getElementById("frm_register").submit();
	}
}

function checkInvioNuovoUtenteConPren(){

	var arrayCampi = new Array("nome","cognome","citta","provincia","telefono","nazione","indirizzo");
	
	var arrayEmail = new Array("email");
	
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	for(var n=0;n<arrayEmail.length;n++){
		var myCampo = arrayEmail[n];
		if(!checkEmail(document.getElementById(myCampo).value)){
			document.getElementById(myCampo).style.color ='#FF0000';
			document.getElementById(myCampo).value = strEmail;
			document.getElementById(myCampo).onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
		alert("It's mandatory to accept the privacy notice before proceeding with the registration");
	} else if (!ok) 
		alert("Please fill out the form before proceeding");
	
	if(ok){
		sendPag();
	}
}

function checkInvioNuovoProprietario(){

	var arrayCampi = new Array("nome","cognome","citta","provincia","telefono","nazione","indirizzo","ambito","info_apt");
	
	var arrayEmail = new Array("email");
	
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	for(var n=0;n<arrayEmail.length;n++){
		var myCampo = arrayEmail[n];
		if(!checkEmail(document.getElementById(myCampo).value)){
			document.getElementById(myCampo).style.color ='#FF0000';
			document.getElementById(myCampo).value = strEmail;
			document.getElementById(myCampo).onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
	}
	
		
	if(ok){
		document.getElementById("frm_register").submit();
	}
}
function checkInvioNuovoPartner(){

	var arrayCampi = new Array("nome","cognome","citta","provincia","telefono","nazione","indirizzo", "rag_soc","ambito");
	
	var arrayEmail = new Array("email");
	
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	for(var n=0;n<arrayEmail.length;n++){
		var myCampo = arrayEmail[n];
		if(!checkEmail(document.getElementById(myCampo).value)){
			document.getElementById(myCampo).style.color ='#FF0000';
			document.getElementById(myCampo).value = strEmail;
			document.getElementById(myCampo).onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
	}
	
		
	if(ok){
		document.getElementById("frm_register").submit();
	}
}

function checkInvio(){
	if(document.getElementById('nc').style.display == 'none'){
		var arrayCampi = new Array("CompanyName","Richiesta","Phone");
	}else{
		var arrayCampi = new Array("Name","Richiesta","Phone");
	}
	var arrayEmail = new Array("EMail");
	var strErrore = 'Mandatory Field';
	var strEmail = 'E-mail not valid';
	var ok = true;
	
	for(var i=0;i<arrayCampi.length;i++){
		var myCampo = arrayCampi[i];
		if(document.getElementById(myCampo).value != strErrore){
			if(!checkField(document.getElementById(myCampo).value)){
				document.getElementById(myCampo).style.color ='#FF0000';
				document.getElementById(myCampo).value = strErrore;
				document.getElementById(myCampo).onclick = function(){
					this.style.color = '#333333';
					this.value ='';
					this.onclick = '';
				};
				ok = false;
			}
		}else{
			ok = false;
		}
	}
	
	for(var n=0;n<arrayEmail.length;n++){
		var myCampo = arrayEmail[n];
		if(!checkEmail(document.getElementById(myCampo).value)){
			document.getElementById(myCampo).style.color ='#FF0000';
			document.getElementById(myCampo).value = strEmail;
			document.getElementById(myCampo).onclick = function(){
				this.style.color = '#333333';
				this.value ='';
				this.onclick = '';
			};
			ok = false;
		}
	}
	
	if(document.getElementById("privacy").checked==false){
		ok = false;
		document.getElementById('output_privacy').style.display ='block';
	}
	
		
	if(ok){
		document.getElementById("form_contatti").submit();
	}
}