function FormValidation() {
  document.getElementById('capabotonenviar').innerHTML = '<img src="/php-include/imgs/enviar_naranja_off.gif" width="177" height="26" alt="Enviando..." />';
  dojo.io.bind({
      url: "php-include/exec_validate.php",
      load: ExecValidation,
      error: ErrorHandler,
      formNode: document.getElementById( "registration_form" ),
      mimetype: "text/plain"
  });
}

function ExecValidation(type, data, evt)
{
    if ( 'true' == data ) {
		document.getElementById("registration_form").submit();
//         window.location="registro_usuarios2.php"
    } else {
        alert(data);
		document.getElementById('capabotonenviar').innerHTML = '<a href="#" onclick="FormValidation(); return false;"><img src="/php-include/imgs/enviar_naranja.gif" width="77" height="26" alt="Continuar" /></a>';
    }
}

function DumpData( type, data, evt ) {
  var msg = "Data dump:\n" + data;
  alert( msg );
}

function ErrorHandler( type, error ) {
  var msg = "Ocurrio un error ...\n" +
      error.message;
  alert( msg );
}

function UserExists() {
  dojo.io.bind({
      url: "php-include/user_exists.php",
      load: ShowUserExists,
      error: ErrorHandler,
      formNode: document.getElementById( "registration_form" ),
      mimetype: "text/plain"
  });
}

function ShowUserExists( type, data, evt ) {
  if ( 'true' == data )
    alert( 'Lo sentimos, ese nombre de usuario ya ha sido tomado o es inválido' );
  else
    alert( 'Enhorabuena, tu nombre de usuario esta disponible!' );
}
