<!---

function alterStr() {
  
  this.ltrim = function() {
    return this.replace(/^\s+/,"");
  }
  
  this.rtrim = function() {
    return this.replace(/\s+$/,"");
  }
  
  this.trim = function() {
    var str = this;
    str = str.ltrim;
    str = str.rtrim;
    return str;
  }
  
  this.mkPhoneNum = function() {
    var str = this;
    str = str.replace(/^1/,"");
    str = str.replace(/[\(\)\.\-\s]/g,"");
    return str;
  }
}

function chkStr() {
  
  this.empty = function() {
    return this.length < 1;
  }
  
  this.isBlank = function() {
    var str = this.replace(/\s/g,'');
    return str.length < 1;
  }
  
  this.isAlpha = function() {
    if (this.search(/[^a-zA-Z]/) == -1) return true;
    else return false;
  }
  
  this.isNum = function() {
    if (this.search(/[^0-9]/) == -1) return true;
    else return false;
  }
  
  this.isAlphaNum = function() {
    if (this.search(/[^a-zA-Z0-9]/) == -1) return true;
    else return false;
  }
  
  //[a-zA-Z0-9!#$%&'*+-/=?^_`{|}~]+(?:\.[a-zA-Z0-9!#$%&'*+-/=?^_`{|}~]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?
  this.isEmail = function() {
    if (this.search(/^[a-zA-Z0-9!#$%&'*+-\/=?^_`{|}~]+(?:\.[a-zA-Z0-9!#$%&'*+-\/=?^_`{|}~]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/) != -1) return true;
    else return false;
  }
  
  this.isPhoneNum = function() {
    var str = this;
    str = str.replace(/^1/,"");
    str = str.replace(/[\(\)\.\-\s]/g,"");
    if (str.isLength(10) && str.isNum()) {
      return true;
    }
    else return false;
  }
  
  this.isLength = function(n) {
    if (this.length==n) return true;
    else return false;
  }
  
  this.hasPunctuation = function() {
    if (this.search(/[\.\?!,:'"()[]-\/]/) != -1) return true;
    else return false;
  }
  
  this.hasBrackets = function() {
    if (this.search(/[()\[\]{)<>]/) != -1) return true;
    else return false;
  }
  
  this.hasSymbol = function() {
    if (this.search(/[@#\$%\*~`\^&\|\\_]/) != -1) return true;
    else return false;
  }
  
  this.hasMathOp = function() {
    if (this.search(/[\+\*!-=()\/\^]/) != -1) return true;
    else return false;
  }
  
  this.isName = function() {
    if (this.search(/[^a-zA-Z-\s']/) == -1) return true;
    else return false;
  }
}


// Make the methods accessible to all strings
String.prototype.empty = new chkStr().empty;
String.prototype.isBlank = new chkStr().isBlank;
String.prototype.isAlpha = new chkStr().isAlpha;
String.prototype.isNum = new chkStr().isNum;
String.prototype.isAlphaNum = new chkStr().isAlphaNum;
String.prototype.isEmail = new chkStr().isEmail;
String.prototype.isPhoneNum = new chkStr().isPhoneNum;
String.prototype.isLength = new chkStr().isLength;
String.prototype.hasPunctuation = new chkStr().hasPunctuation;
String.prototype.hasBrackets = new chkStr().hasBrackets;
String.prototype.hasSymbol = new chkStr().hasSymbol;
String.prototype.hasMathOp = new chkStr().hasMathOp;
String.prototype.isName = new chkStr().isName;

String.prototype.trim = new alterStr().trim;
String.prototype.ltrim = new alterStr().ltrim;
String.prototype.rtrim = new alterStr().rtrim;
String.prototype.mkPhoneNum = new alterStr().mkPhoneNum;

//--->