function select_menu() {
  var num = getMenuNum(document.URL);
  if (num == -1) {
    return;
  }
  var target = document.getElementById("banner-link")
    .getElementsByTagName("li")[num].childNodes[0];
  var classAttr = document.createAttribute("class");
  classAttr.value = "selected";
  target.setAttributeNode(classAttr);
}

function getMenuNum(url) {
  if (url == "http://okilab.jp/") {
    return 0;
  }
  if (url.indexOf("http://okilab.jp/blog/top/")>=0) {
    return 0;
  }
  if (url.indexOf("http://okilab.jp/information/")>=0) {
    return 1;
  }
  if (url.indexOf("http://okilab.jp/project/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/location/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/word/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/document/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/koneta/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/mplan/")>=0) {
    return 2;
  }
  if (url.indexOf("http://okilab.jp/devdiary/")>=0) {
    return 3;
  }
  if (url.indexOf("http://okilab.jp/blog/")>=0) {
    return 3;
  }
  if (url.indexOf("http://okilab.jp/about/")>=0) {
    return 4;
  }
  return -1;
}
