function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}	function CheckPage()
	{
	   var nResult = 0;
nResult += NotEmpty( nResult, 'first_name','Nombre' );
		if(nResult == 1)
		{
			return;
		}
nResult += NotEmpty( nResult, 'last_name','Apellidos' );

if(nResult == 1)
		{
			return;
		}
nResult += NotEmpty( nResult, 'edad','Edad' );
		if(nResult == 1)
		{
			return;
		}	    nResult += Email( nResult, 'email','Email' );

		if(nResult == 1)
		{
			return;
		}
nResult += NotEmpty( nResult, 'mobile','Telefono Movil' );

		if(nResult == 1)
		{
			return;
		}nResult += NotEmpty( nResult, 'city','Ciudad' );
	
		if(nResult == 1)
		
		{
			return;
		}  if (1)
		  {
			 var el = document.getElementById( 'formCandidate' );
			 if ( typeof(el)=='object' && el != null ) el.submit();
		  }	}  function NotEmpty( old_res, id, field_title )
  {
     if ( old_res==0 )
     {
        var el = document.getElementById( id );
        if ( typeof(el)=='object' && el!=null )
          if ( trimAll(el.value) == '' )
          {
             alert( 'Por favor llenar el campo "' + field_title + '"' );
             return 1;
          }
     }
     return 0;
  }
  function Email( old_res, id, field_title )
  {
     if ( old_res==0 )
     {
        var el = document.getElementById( id );        if (el != null && trimAll(el.value) == '' )
        {
           alert( 'Por favor ingrese un"'+field_title+'" valido' );
           return 1;
        }        if (el != null && trimAll(el.value) != '' )
        {
           var re = /^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9][a-zA-Z0-9-]+\.)+[a-zA-Z]{2,6}$/;           if (el.value.search(re) != -1 )  return 0;
           else
           {
              alert( 'Por favor ingrese un"'+field_title+'" valido' );
              return 1;
           }
        }
     }
     return 0;
  }function nothing() {}
