// Funciones auxiliares de comprobación

function isEmpty(s){
  return ((s == null) || (s.length == 0))
}

function statBar (s){
  window.status = s
}

function isNice(s){
  var i = 1;
  var sLength = s.length;
  var b = 1;
  while(i<sLength) {
    if( (s.charAt(i) == "\"") || (s.charAt(i) == "'" ) )
      b = 0;
    i++;
  }
  return b;
}

function isDigit (c){
  return ((c >= "0") && (c <= "9"))
}

function isInteger (s){
  var i;
  if (isEmpty(s))
    if (isInteger.arguments.length == 1)
      return defaultEmptyOK;
    else
      return (isInteger.arguments[1] == true);

  for (i = 0; i < s.length; i++){
    var c = s.charAt(i);
    if( i != 0 ) {
      if (!isDigit(c))
        return false;
    }
    else {
      if (!isDigit(c) && (c == "-") || (c == "+"))
        return false;
    }
  }
  return true;
}

function isWhitespace (s){
  var i;
  if (isEmpty(s)) return true;
  for (i = 0; i < s.length; i++){
    var c = s.charAt(i);
    // si el caracter en que estoy no aparece en whitespace,
    // entonces retornar falso
    if (whitespace.indexOf(c) == -1)
      return false;
  }
  return true;
}

function isLetter (c){
  return( (uppercaseLetters.indexOf( c ) != -1) ||
          (lowercaseLetters.indexOf( c ) != -1 ))
}

function stripCharsInBag (s, bag){
  var i;
  var returnString = "";

  // Buscar por el string, si el caracter no esta en "bag",
  // agregarlo a returnString

  for (i = 0; i < s.length; i++){
    var c = s.charAt(i);
    if (bag.indexOf(c) == -1)
      returnString += c;
  }

  return returnString;
}
