function Collection()
{
   var colKeys = {};
   var aszKeysOrder = [];

   this.add = function(property, value)
   {
      if ( !this.exists(property) )
      {
         colKeys[property] = value;
         aszKeysOrder.push(property);
      }
      return colKeys[property];
   }

   this.remove = function(property)
   {
      colKeys[property] = null;
      var ii = aszKeysOrder.length;

      while (ii-- > 0)
      {
         if (aszKeysOrder[ii] == property)
         {
            aszKeysOrder[ii] = null;
            break;
         }
      }
   }

   this.toString = function()
   {
      var output = [];

      for ( var ii = 0; ii < aszKeysOrder.length; ++ii )
      {
         if (aszKeysOrder[ii] != null)
         {
            output.push(colKeys[aszKeysOrder[ii]]);
         }
      }
      return output;
   }

   this.getKeys = function()
   {
      var keys = [];
      for ( var ii = 0; ii < aszKeysOrder.length; ++ii )
      {
         if (aszKeysOrder[ii] != null)
         {
            keys.push(aszKeysOrder[ii]);
         }
      }
      return keys;
   }
   
   this.update = function(property, value)
   {
      if (value != null)
      {
         colKeys[property] = value;
      }
      var ii = aszKeysOrder.length;
   
      while (ii-- > 0)
      {
         if (aszKeysOrder[ii] == property)
         {
            aszKeysOrder[ii] = null;
            aszKeysOrder.push(property);
            break;
         }
      }
   }
  
   this.length = function()
   {
      return aszKeysOrder.length;
   }

   this.exists = function(property)
   {
      return colKeys[property] != null;
   }

   this.getKeyByIndex = function(nIndex)
   {
      return aszKeysOrder[nIndex];
   }

   this.getValueByKey = function(szKey)
   {
      return colKeys[szKey];
   }

   this.getValueByIndex = function(nIndex)
   {
      return colKeys[aszKeysOrder[nIndex]];
   }
}   