// Set a cookie value
function setCookie(name, value) {
  expDate = new Date();
  expDate.setYear(expDate.getYear() + 1);
  document.cookie = name+"="+escape(value)+";expires=\"expDate.toGMTString()+\";"
}

// Return value of cookie
function getCookie(name) {
  var prefix = name + "="
  var cookieStartIndex = document.cookie.indexOf(prefix)
  if (cookieStartIndex == -1)
    return null
  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
  if (cookieEndIndex == -1)
    cookieEndIndex = document.cookie.length
  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function show_list_block(id)
{
  for (I=0;I<1000;I++)
    if (document.getElementById("list_"+I))
      document.getElementById("list_"+I).style.display = "none";
  document.getElementById("list_"+id).style.display = "block";
  setCookie('open_list_id', id);
}

function show_selected_list()
{
  document.getElementById("list_"+getCookie('open_list_id')).style.display = "block";
}
