// JS for contact form



function processForm() {

    $('.error').hide();
    $("#formStatus").hide(); //overlay
    $("#overlayLeft").hide();

    $("#sendBtn").click(function() {
    
        var errors = 0;
    
        // validate and process form
        // first hide any error messages
        $('.error').hide();
        $("#formStatus").hide(); //overlay

 
		        var tel = $("input#tel").val();
        if (tel == "") {
            $("#telError").attr("class", "error");
            $("#telError").text("Questo campo è obbligatorio");
            $("#telError").fadeIn("fast");
            $("input#tel").focus();
            errors += 1;
        } else {
            $("#telError").attr("class", "good");
            $("#telError").text("Good");
            $("#telError").fadeIn("fast");
        }
		
        
        var name = $("input#name").val();
        if (name == "") {
            $("#nameError").attr("class", "error");
            $("#nameError").text("Questo campo è obbligatorio");
            $("#nameError").fadeIn("fast");
            $("input#name").focus();
            errors += 1;
        } else {
            $("#nameError").attr("class", "good");
            $("#nameError").text("Good");
            $("#nameError").fadeIn("fast");
        }
    
        var cognome = $("input#cognome").val();
        if (cognome == "") {
            $("#cognomeError").attr("class", "error");
            $("#cognomeError").text("Questo campo è obbligatorio");
            $("#cognomeError").fadeIn("fast");
            $("input#cognome").focus();
            errors += 1;
        } else {
            $("#cognomeError").attr("class", "good");
            $("#cognomeError").text("Good");
            $("#cognomeError").fadeIn("fast");
        }	
    
		
        if(errors > 0) {
            return false;
        
        } else {
			return true;
			}

        function sendMail() {}// sendMail  
    
        return false;
        
        
    }); // onclick
}// process form
