function checkdata(){

	var response = true;
	var nome = document.getElementById('nome').value;
	var cognome = document.getElementById('cognome').value;
	var email = document.getElementById('email').value;
	var telefono = document.getElementById('telefono').value;
	var telefono2 = document.getElementById('telefono2').value;
	var comune = document.getElementById('comune').value;
	var paese = document.getElementById('paese').value;
	var provincia = document.getElementById('provincia').value;
	var via = document.getElementById('via').value;
	var richiesta = document.getElementById('richiesta').value;
	var cap = document.getElementById('cap').value;
	var scode = document.getElementById('scode').value;
	

	if (nome == "") {
		alert("Please provide this information: Name");
		document.getElementById("nome").focus();
		response = false; 
		return (response);
	}

	if (cognome == "") {
		alert("Please provide this information: Surname");
		document.getElementById("cognome").focus();
		response = false; 
		return (response);
	}

	if (telefono == "") { 
		alert("Please provide this information: Phone");
		document.getElementById("telefono").focus();
		response = false;
		return (response);
	}
	else{	
	var telefonoReg = /^\d{1,24}$/; 
		if (!telefonoReg.test(telefono)) {
			alert("Please provide only digits for this information: Phone");
			document.getElementById("telefono").focus();
			response = false; 
			return (response);
		}
	}
	
	if (telefono2 != "") { 	
		var telefonoReg = /^\d{1,24}$/; 
			if (!telefonoReg.test(telefono2)) {
			alert("Please provide only digits for this information: Mobile");
			document.getElementById("telefono2").focus();
				response = false; 
				return (response);
			}
	}
	
	if (email == "") {
		alert("Please provide this information: Email");
		document.getElementById("email").focus();
		response = false; 
		return (response);
	}
	else{
		var emailReg =/^[A-Za-z0-9][\w-.]+[A-Z_a-z0-9]@[A-Za-z0-9]([\w-.]+[A-Za-z0-9]\.)+([A-Za-z]){2,4}$/; 
		if (!emailReg.test(email)) {
			alert("Please provide a valid Email address");
			document.getElementById('email').focus();
			response = false; 
			return (response);
		}
	}
	
	if (comune == "") {
		alert("Please provide this information: City");
		document.getElementById("comune").focus();
		response = false; 
		return (response);
	}
	
	
	if (via == "") {
		alert("Please provide this information: Address");
		document.getElementById("via").focus();
		response = false; 
		return (response);
	}	
	
	if (cap == "") {
		alert("Please provide this information: Zip code");
		document.getElementById("cap").focus();
		response = false; 
		return (response);
	}	
	
	if (richiesta == "") {
		alert("Please provide this information: Message");
		document.getElementById("richiesta").focus();
		response = false; 
		return (response);
	}		
	
	
	if (scode == "") {
		alert("Please provide this information: Security code");
		document.getElementById("scode").focus();
		response = false; 
		return (response);
	}
	
	if (!(document.getElementById("condizioni").checked)){
		alert("Please provide this information: Privacy Authorization");
		document.getElementById("condizioni").focus();
		response = false; 
		return (response);
	}
	
	
}

function cambia_fase(fase){
	
	document.getElementById("fase").value = fase;
	document.frmTrans.submit();
	
}

function gestisci_nazione(questo){

	if(questo.options[questo.selectedIndex].value=='IT'){
		document.getElementById('regione').disabled=false;
		document.getElementById('provincia').disabled=false;
	}
	else {
		document.getElementById('regione').disabled=true;
		document.getElementById('regione').selectedIndex=0
		document.getElementById('provincia').disabled=true;
		document.getElementById('provincia').selectedIndex=0
	
	}
}

function resetta_form(){
	if (confirm("Are you sure you want to reset the information provided?")){
		document.frmTrans.reset();
	}
}
