function hbCookies (name)
{
  this.cookieName = name;
  var allCookies = document.cookie.split (';');
  var ourCookies = null;
  this.nameToValue = new Object ();
  this.disabled = false;

  for (var i = 0; i < allCookies.length; ++i)
  {
    if (this.cookieName + "=" == allCookies [i].substring (0, 1 + this.cookieName.length))
    {
      ourCookies = allCookies [i];
      break;
    }
  }

  if (null == ourCookies)
  {
    return;
  }

  ourCookies = ourCookies.substring (1 + this.cookieName.length);

  var cookieArray = ourCookies.split ('&');

  for (var i = 0; i < cookieArray.length; ++i)
  {
    cookieArray [i] = cookieArray [i].split (':');
  }

  for (var i = 0; i < cookieArray.length; ++i)
  {
    this.nameToValue [cookieArray [i] [0]] = decodeURIComponent (cookieArray [i] [1]);
  }
}

hbCookies.prototype.disable = function ()
{
  this.disabled = true;
  this.nameToValue = new Object ();
}

hbCookies.prototype.get = function (name)
{
  if (this.nameToValue [name])
  {
    return this.nameToValue [name];
  }

  return "";
}

hbCookies.prototype.set = function (name, value)
{
  this.nameToValue [name] = value;

  if (true == hbCookies.prototype.disabled)
  {
    return;
  }

  var cookieValue = "";

  for (var prop in this.nameToValue)
  {
    if (('$' == prop.charAt (0)) || ('function' == (typeof this.nameToValue [prop])))
    {
      continue;
    }

    if ("" != cookieValue)
    {
      cookieValue += '&';
    }

    cookieValue += prop + ':' + encodeURIComponent (this.nameToValue [prop]);
  }

  document.cookie = this.cookieName + "=" + cookieValue + "; max-age=31536000";
}
