// #############################################################################
// function to set a cookie
function set_cookie(name, value, expires, path, domain) {
  if (!expires) {
    expires = new Date();
    expires.setTime(expires.getTime() + (1000 * 86400 * 30));
  }
  if (!path) {
    path = '; path=/';
  }
  var pdomain = '';
  if (domain) {
    pdomain = '; domain='+domain;
  }
  document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() +  path + pdomain;
}

// #############################################################################
// function to retrieve a cookie
function fetch_cookie(name)
{
        cookie_name = name + "=";
        cookie_length = document.cookie.length;
        cookie_begin = 0;
        while (cookie_begin < cookie_length)
        {
                value_begin = cookie_begin + cookie_name.length;
                if (document.cookie.substring(cookie_begin, value_begin) == cookie_name)
                {
                        var value_end = document.cookie.indexOf (";", value_begin);
                        if (value_end == -1)
                        {
                                value_end = cookie_length;
                        }
                        return unescape(document.cookie.substring(value_begin, value_end));
                }
                cookie_begin = document.cookie.indexOf(" ", cookie_begin) + 1;
                if (cookie_begin == 0)
                {
                        break;
                }
        }
        return null;
}

// #############################################################################
// function to delete a cookie
function delete_cookie(name, expires, path, domain) {
  if (!expires) {
    expires = new Date();
    expires.setTime(expires.getTime() - (1000 * 86400));
  }
  if (!path) {
    path = '; path=/';
  }
  var pdomain = '';
  if (domain) {
    pdomain = '; domain='+domain;
  }
  document.cookie = name + "=" + "; expires=" + expires.toGMTString() +  path + pdomain;
}

function hide(src) {
  obj = document.getElementById(src);
  if (obj.style.display == "none") {
    obj.style.display = "";
    set_cookie('mnuconf['+src+']','1',false,false,'.l2dc.ru');
  }
  else
    if(obj.style.display == "") {
      obj.style.display = "none";
      delete_cookie('mnuconf['+src+']',false,false,'.l2dc.ru');
    }
  return false;
}