function limpar(input, msg){
  if(input.value == msg){
    input.value = '';
  }
}	

function restaurar(input, msg) {
  if(input.value == '') {
    input.value = msg;
  }
}

function ValidarEmail(mail){
  var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
  if(typeof(mail) == "string"){
    if(er.test(mail)){ return true; }
  } else if(typeof(mail) == "object"){
    if(er.test(mail.value)){ 
      return true; 
    }
  } else{
    return false;
  }
}

function Enviar() {
  if ((document.getElementById("form_nome").value == "") || 
	  (document.getElementById("form_email").value == "") ||
	  (!ValidarEmail(document.getElementById("form_email").value))) 
  {
    alert("Preencha corretamente os campos.\nVerifique se o formato do e-mail está correto.");  
  } else {
    document.getElementById("form_email").submit();
  }
}
