

//valida o formulario com campos textbox and password
//necessario preecher o atributo title dos campos txt and pwd
function validTextBox(objFrm)
{
	try
	{
		//alert(objFrm.name);
		var intLength = objFrm.elements.length;
		var strType = "";
		var strValue = "";
		if(intLength > 0)
		{
			for(i = 0; i < intLength; i++)
			{
				var obj = objFrm.elements[i];
				strType = obj.type;				
				//verifica se e textbox or password element
				if(strType == "text" || strType == "password")
				{
					strValue = objFrm.elements[i].value;
					if(Trim(strValue) == "")
					{
						//envia alerta com o title do elemento
						alert(obj.title);
						obj.focus();
						return false;
					}
				}
			}
		}
		return true;
	}
	catch(e)
	{
		alert("Erro: " + e.message + "\n" + e.source);
	}
}


//remove any spaces
function Trim(strValue)
{
	var re = /\s/g;//regular expression pattern.
	var str = strValue.replace(re, "");
	return str;		
}
