

function validateFormContatti(theForm, msg) {
var reason = "";

  reason += validateEmptyBis(theForm.nome , '');
  reason += validateEmptyBis(theForm.cognome, '');
  reason += validateEmptyBis(theForm.telefono , '');
  reason += validateEmptyBis(theForm.email1 , '');
  reason += validateEmptyBis(theForm.email2 , '');
  reason += validateEmptyBis(theForm.note , '');
  reason += validateEmptyCheckBox(theForm.auth , '');

	if(theForm.email1.value != theForm.email2.value)
	{
		theForm.email1.style.borderColor = '#F7931D #F7931D';
		theForm.email2.style.borderColor = '#F7931D #F7931D';
		reason += 'Email';
	}
	else
	{
		theForm.email1.style.borderColor = '';
		theForm.email2.style.borderColor = '';
	}

  if (reason != "") {
	  
    alert(msg);
    return false;
  }

  return true;
}




function validateEmpty(fld,name) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = 'silver';

        error = " - "+name+" - \n"
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validateEmptyBis(fld,name) {
    var error = "";

    if (fld.value.length == 0) {
        fld.style.background = 'silver';

        //error = " - "+name+" - \n"
		  error = "."
    } else {
        fld.style.background = 'White';
    }
    return error;
}

function validateEmptyCheckBox(fld,name) {
    var error = "";

    if (!fld.checked) {
        fld.style.backgroundColor  = 'silver';

        error = " - "+name+" - \n"

    } else {
        fld.style.backgroundColor  = 'White';
    }
    return error;
}

function resetInput(elemento)
{

	elemento.value = '';

}


