/*******************************************************************************
 * function IsEmpty(s)                                                         *
 * function Required(objField,strFieldName)                                    *
 ******************************************************************************/

//Checks if the string s is empty.
function IsEmpty(s)
{   return ((s == null) || (s.length == 0))
}

//	Checks if the string s is composed only by whitespaces. 
function Required(objField,strFieldName)
{   
	var strTest = new String(objField.value);
	var bResult = true;
	var cant = 0;
	var i;

	// Is s empty?
    if (IsEmpty(strTest)) 
		 bResult = false;

  // Search through string's characters one by one
  // until we find a non-whitespace character.
  // When we do, return false; if we don't, return true.

  for (i = 0; i < strTest.length; i++)
   if (strTest.charAt(i) == " ") 
    cant = cant + 1
			
	if (strTest.length == cant)
		bResult = false;
	else
		bResult = true;

	if (!bResult)
	{
		alert("Por favor llene el campo " + strFieldName + ".")
		objField.focus();
	}

	return bResult;
}

