// JavaScript Document

function submeter(act, nomeForm) {
	document.getElementById(nomeForm).action = act;
	document.getElementById(nomeForm).submit();
}

function toggle(item) {
	obj = document.getElementById(item);
	visible = (obj.style.display != "none");
	if (visible) {
		obj.style.display = "none";
	} else {
		obj.style.display = "block";
	}
}

function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}

function checkEmail(str) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (str.value.length > 0) {
		if(reg.test(str.value) == false) {
			alert('E-mail incorreto! Por favor insira seu e-mail corretamente.');
			str.value = "";
			str.focus();
			return false;
		}
	}
}
