
suitClass.prototype.stringTrim = function(strInput, type) // version 2.3
{
  if (strInput == "" || strInput == null) return; //if there's no string, don't bother

  var strOutput;
  if (!type) type = "trim";

  switch (type)
  {
    case "ltrim": strOutput = suit.pLTrim(strInput); break;
    case "rtrim": strOutput = suit.pRTrim(strInput); break;
    case "trim": strOutput = suit.pRTrim(suit.pLTrim(strInput)); break;
  }
  return strOutput;
}

suitClass.prototype.pLTrim = function(strInput)
{
  var strOutput = new String(strInput);

  if (suit.pStrWhitespace.indexOf(strOutput.charAt(0)) != -1)   // If the string has leading blanks,
  {
    var j, i;
    j=0;
    i = strOutput.length;
        // iterate from the far left of string to the end of the whitespace,
    while (j < i && suit.pStrWhitespace.indexOf(strOutput.charAt(j)) != -1) j++;
        // get the substring from the first non-whitespace character to the end of the string.
    strOutput = strOutput.substring(j, i);
  }
  return strOutput;
}

suitClass.prototype.pRTrim = function(strInput)
{
    // PURPOSE: Remove trailing blanks
  var strOutput = new String(strInput);

  if (suit.pStrWhitespace.indexOf(strOutput.charAt(strOutput.length-1)) != -1)
  {
    var i = strOutput.length - 1;       
    while (i >= 0 && suit.pStrWhitespace.indexOf(strOutput.charAt(i)) != -1) i--;
    strOutput = strOutput.substring(0, i+1);
  }
  return strOutput;
}

