function _String_trim()
  {
   var str = this;
   var count = 0;

   while (str.charCodeAt(0) == '32')
     { str = str.substring(count++, str.length); }

   while(str.charCodeAt(str.length - 1) == "32")
     { str = str.substring(0, str.length - 1); }

   return (str);
  }

// converts a String to a char array
// param	String	str	the String to be converted
// returns	Char[]
function _String_toCharArray()
  {
   var arr = new Array(this.length);

   for (c = 0; c < this.length; c++)
     { arr[c] = this.substr(c, 1); }

   return (arr);
  }

// compare strings
// param	String	str	String to compare
// returns	Boolean
function _String_equals(str)
  { return (this.compareTo(str) == 0); }

// compare strings ignoring case
// param	String	str	String to compare
// returns	Boolean
function _String_equalsIgnoreCase(str)
  { return (this.toLowerCase().equals(str.toLowerCase())); }

// compare strings
// param	String	str	Strng to compare
// returns	Integer
//	 0 - if the string is equals str
//	-1 - if the string is less than str
//	 1 - if the string is greater than str
function _String_compareTo(str)
  { return (this.toCharArray().compareTo(str.toCharArray())); }

function _String_compareToIgnoreCase(str)
  { return (this.toLowerCase().compareTo(str.toLowerCase())); }

String.prototype.equals	=	_String_equals;
String.prototype.toCharArray	=	_String_toCharArray;
String.prototype.equalsIgnoreCase	=	_String_equalsIgnoreCase;
String.prototype.compareTo	=	_String_compareTo;
String.prototype.compareToIgnoreCase	=	_String_compareToIgnoreCase;
String.prototype.trim	        =	_String_trim;

// <------------------------------------------------->

// remove element from array
// param	Object	el	element to be removed
// param	Integer	index	offset to search the element
// param	Integer	qnt	how many elements must be removed
// returns	Object[]
function _Array_removeElement(el, index, qnt)
  {
   var actual = 1;

   if (typeof index == "undefined")
     { index = 0; }

   if (typeof qnt == "undefined")
     { qnt = -1; }

   for (i = index; i < this.length; i++)
     {
      if (this[i] == el)
        {
         this[i] = null;

         if (qnt == -1)
           { continue; }
         else if (actual++ >= qnt)
           { break; }
        }
     }

   return (this.removeNullElements());
  }

// remove null elements from array
// returns	Object[]
function _Array_removeNullElements()
  {
   var newArr = [];

   for (i = 0; i < this.length; i++)
     {
      if (this[i] != null)
        { newArr[newArr.length] = this[i]; }
     }

   return (newArr);
  }

// returns true if key exists in the key set of the array
// param	Object	key	key to search
// returns	Boolean
function _Array_containsKey(key)
  { return (typeof this[key] != "undefined"); }

// returns true if el exists in the array
// param	Object	el	element to search
// returns	Boolean
function _Array_contains(el)
  {
   for (element in this)
     {
      if (this[element] == el)
        { return (true); }
     }

   return (false);
  }

function _Array_compareTo(arr)
  {
   if (this.length > arr.length)
     { return (1); }

   if (this.length < arr.length)
     { return (-1); }

   if (this.length == arr.length)
     {
      for (char = 0; char < this.length; char++)
        {
         if (this[char] != arr[char])
           {
            if (this.toString() > arr.toString())
              { return (1); }

            return (-1);
           }
        }
     }

   return (0);
  }

Array.prototype.removeNullElements	=	_Array_removeNullElements;
Array.prototype.removeElement	=	_Array_removeElement;
Array.prototype.containsKey	=	_Array_containsKey;
Array.prototype.contains	=	_Array_contains;
Array.prototype.compareTo	=	_Array_compareTo;