 /*************************************************************************
 * Erweitern des Funktionsumfangs von javascript
 *
 * @package Automedia
 * @author  Anreas Percher
 * @version 1, 2007-07-06
 */

  String.prototype.leftTrim = function () {
    return (this.replace(/^\s+/,""));
  };
  String.prototype.rightTrim = function () {
    return (this.replace(/\s+$/,""));
  };
//kombiniert "leftTrim" und "rightTrim";
  String.prototype.basicTrim = function () {
    return (this.replace(/\s+$/,"").replace(/^\s+/,""));
  };
//dampft leerzeichen(-sequenzen) innerhalb einer zeichenkette auf ein einzelnes "space" ein;
  String.prototype.superTrim = function () {
    return(this.replace(/\s+/g," ").replace(/\s+$/,"").replace(/^\s+/,""));
  };

//zugabe: entfernt alle leerzeichen aus einer zeichenkette;
  String.prototype.removeWhiteSpaces = function () {
    return (this.replace(/\s+/g,""));
  };
// prüft, ob leer
  String.prototype.isEmpty = function() {
    return (this.basicTrim(/\s+/g,"").length<1);
  }
// prüft, ob nicht leer
  String.prototype.isNotEmpty = function() {
    return (this.basicTrim(/\s+/g,"").length>0);
  }

// alle Vorkommen ersetzen
  String.prototype.replaceAll = function(
    strTarget, // The substring you want to replace
    strSubString // The string you want to replace in.
  ){
    var strText = this;
    var intIndexOfMatch = strText.indexOf( strTarget );

    // Keep looping while an instance of the target string
    // still exists in the string.
    while (intIndexOfMatch != -1){
      // Relace out the current instance.
      strText = strText.replace( strTarget, strSubString )
      // Get the index of any next matching substring.
      intIndexOfMatch = strText.indexOf( strTarget );
    }
    // Return the updated string with ALL the target strings
    // replaced out with the new substring.
    return( strText );
  }
