//retorna falso caso campo não esteja preenchido.
function Campo_Preenchido(campo,str_msg)
{
if (!Trim(campo.value)) {
	if (!str_msg)
		str_msg = 'campo vazio!'; 
	alert(str_msg);
	campo.focus();
	return false;
}
else
	return true;
}


function Hidden_Preenchido(campo,str_msg) {
if (!Trim(campo.value)) {
	if (str_msg)
		{ alert(str_msg);}
	return false;
}
else
	return true;
}

function TextArea_MaxLength(campo,int_maxchar,str_msg)
{
if (campo.value.length > int_maxchar) {
	if (!str_msg)
		str_msg = 'ERRO: campo contém mais de ' + int_maxchar + ' caracteres!'; 
	alert(str_msg);
	campo.focus();
	return false;
}
else
	return true;
}

function WDDX_Preenchido(arr_WDDX) {
cboWDDX = eval('document.forms[0].cbo_WG_GRID_' + arr_WDDX);
if (cboWDDX.length < 1)
	return false;
else
	return true;
}

/*verifica se um item de um grupo de radio buttons está marcado*/
function Radio_Marcado(radio)
{
	checked = false;

	for(i = 0; i < radio.length; i++)
	{
		if (radio[i].checked == true)
		{
			checked = true;
		}
	}
	return checked;
}


/*
lib_Trim.js
funções para limpar espaços em branco em string
AUTOR: Eduardo Corrêa Gonçalves
DATA: 07/10/2001
*/

function LTrim(strEntrada) {
var tam = strEntrada.length;
if (tam > 0) {
	for (var i=0; i < tam; i++)
		if (strEntrada.substring(i,i+1) != ' ')
			break;
	return strEntrada.substring(i,tam);
	}
else
	return strEntrada;
}

function RTrim(strEntrada) {
var tam = strEntrada.length;
if (tam > 0) {
	for (var i=tam; i > 0; i--)
		if (strEntrada.substring(i-1,i) != ' ')
			break;
	return strEntrada.substring(0,i);
	}
else
	return strEntrada;
}

function Trim(strEntrada) {
	return RTrim(LTrim(strEntrada));
}
