function LTrim(value) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}

function RTrim(value) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}

function trim(value) {
	return LTrim(RTrim(value));
}

function zerarStyle(obj) {
	obj.style.background = '#606060';
}

function validarCadastro() {	
	var cor_erro 		= '#F69600';
	var txtNomeEmpresa 	= document.getElementById('txtNomeEmpresa');
	var txtEmail 		= document.getElementById('txtEmail');
	
	if (trim(txtNomeEmpresa.value) == '') {
		alert('Atenção: Informe seu "NOME" ou "EMPRESA"!');
		txtNomeEmpresa.focus();
		txtNomeEmpresa.style.background 		= cor_erro;
		return(false);
	}	
	if (trim(txtEmail.value) == '') {
		alert('Atenção: Informe seu "E-MAIL"!');
		txtEmail.focus();
		txtEmail.style.background 		= cor_erro;
		return(false);
	}	
	if (!trim(txtEmail.value).match(/^[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_.-][A-Za-z0-9]+)*.[A-Za-z0-9]{2,4}$/)){
		alert('Atenção: Você deve infomar um endereço de "E-MAIL" válido!');
		txtEmail.focus();		
		txtEmail.style.background 		= cor_erro;
		return(false);
	}	
	return(true);
}
