//Workarounds for old javascript implementations

if (Array.prototype.join == null)
{
   Array.prototype.join = function(sep)
   {
      if (sep == null)
         sep = ",";
      var str = "";
      if (this.length > 0)
         str = this[0];
      for (var i=1; i<this.length; i++)
         str += sep + this[i];
      return str;
   }
}

if (Array.prototype.push == null)
{
   Array.prototype.push = function()
   {
      for (var i=0; i<argument.length; i++)
         this[this.length] = arguments[i];
      return this.length;
   }
   Array.prototype.pop = function()
   {
      var ret = this[this.length];
      if (this.length > 0)
         this.length--;
      return ret;
   }
   Array.prototype.unshift = function()
   {
      var l = arguments.length;
      if (this.length > 0 && l > 0)
      {
         for (var i=this.length-1; i>=0; i--)
         {
            this[i+l] = this[i];
         }
      }
      for (var i=0; i<l; i++)
      {
         this[i] = arguments[i];
      }
      return this.length;
   }
   Array.prototype.shift = function()
   {
      var ret = this[0];
      if (this.length > 0)
      {
         for (var i=1; i<this.length; i++)
         {
            this[i-1] = this[i];
         }
         this.length--;
      }
      return ret;
   }
}
