
/**
 *  Removing endings from a string
 **/
String.prototype.chomp = function()
{
  return this.replace(/(\n|\r)+$/, '');
}

/**
 *  Trim all spaces & tabs from begining and end of string
 **/
String.prototype.trim = function()
{
  return this.replace(/^(\t|\s)+/g, '').replace(/(\t|\s)+$/g, '');
}

/**
 *  Changes the first character to uppercase and the rest to lower
 **/
String.prototype.firstToUpper = function()
{
   return this.substr(0, 1).toUpperCase() + this.substr(1).toLowerCase();
}


/**
 *  Dumps all containing variables
 **/
function dumper(obj, indent)
//Object.prototype.rawDump = function(indent)
{
  var output = "";
  if (!indent) indent = 0;
  if (indent > 5) return "(Max Limit)";
  
  if (typeof obj != "object") return "";
    
  for (var item in obj)
  {
    var child = obj[item];
    for(var i=0; i<indent; ++i) output += "  ";
    
    if (typeof child == "string")
      output += item + ":\t <pre>" + child.substring(0, 25) + "</pre><br>\n";
    else if (typeof child == "number")
      output += item + ":\t " + child + "<br>\n";
    else
      dumper(child, indent+1);
      //child.rawDump(indent+1);
  }
  
  return output;
}


