var autoClose = 0;
var oldObject = null;

function showHideSection(outerDiv) {
  var firstDiv = outerDiv.getElementsByTagName('div')[0];
  var expandCollapseWidget = outerDiv.getElementsByTagName('img')[0];
  if ((oldObject) &&(autoClose == 1)) oldObject.style.display = 'none'
  try {
    if (firstDiv.style.display == 'block') {
      firstDiv.style.display = 'none';
      expandCollapseWidget.setAttribute('src','navArrowRight.png');
      expandCollapseWidget.setAttribute('alt','expand');
    } else {
      firstDiv.style.display = 'block';
      expandCollapseWidget.setAttribute('src','navArrowDown.png');
      expandCollapseWidget.setAttribute('alt','collapse');
    }
    oldObject = firstDiv;
  } catch (e) {
      /*
      Ignore errors from getElementById(). We do not care about attempts
      to showHide non-existing ids.
      */
  }
  return;
}

function goThere(dest) {
  document.location.replace(dest);
}

function getString(str) {

  var lang = document.documentElement.getAttribute("lang");
  if (!(lang)) {
    lang = document.documentElement.getAttribute("xml:lang");
    if (!(lang)) {
      lang = "en";
    }
  }

  var search = new Array();
  search["de"] = search["de-ch"] = search["de-de"] = "Suchen";
  search["en"] = search["en-ca"] = search["en-gb"] = search["en-us"] = "Search";
  search["es"] = search["es-es"] = search["es-xl"] = "Buscar";
  search["fr"] = search["fr-be"] = search["fr-ca"] = search["fr-ch"] = search["fr-fr"] = "Rechercher";
  search["it"] = search["it-ch"] =  search["it-it"] = "Cerca";
  search["ja"] = search["ja-jp"] = "検索";
  search["ko"] = search["ko-kr"] = "검색";
  search["nl"] = search["nl-be"] = search["nl-nl"] = "Zoeken";
  search["pt"] = search["pt-br"] = search["pt-pt"] = "Pesquisar";
  search["ru"] = search["ru-ru"] =  "Поиск";
  search["zh"] = search["zh-cn"] = "搜索";
  search["zh-tw"] = "搜尋";

  var printString = new Array();
  printString["de"] = printString["de-ch"] = printString["de-de"] = "Drucken";
  printString["en"] = printString["en-ca"] = printString["en-gb"] = printString["en-us"] = "Print";
  printString["es"] = printString["es-es"] = printString["es-xl"] = "Imprimir";
  printString["fr"] = printString["fr-be"] = printString["fr-ca"] = printString["fr-ch"] = printString["fr-fr"] = "Imprimer";
  printString["it"] = printString["it-ch"] =  printString["it-it"] = "Stampa";
  printString["ja"] = printString["ja-jp"] = "印刷";
  printString["ko"] = printString["ko-kr"] = "인쇄";
  printString["nl"] = printString["nl-be"] = printString["nl-nl"] = "Afdrukken";
  printString["pt"] = printString["pt-br"] = printString["pt-pt"] = "Imprimir";
  printString["zh"] = printString["zh-cn"] = "打印";
  printString["zh-tw"] = "列印";

  var index = new Array();
  index["de"] = index["de-ch"] = index["de-de"] = "Index";
  index["en"] = index["en-ca"] = index["en-gb"] = index["en-us"] = "Index";
  index["es"] = index["es-es"] = index["es-xl"] = "Índice";
  index["fr"] = index["fr-be"] = index["fr-ca"] = index["fr-ch"] = index["fr-fr"] = "Index";
  index["it"] = index["it-ch"] =  index["it-it"] = "Indice";
  index["ja"] = index["ja-jp"] = "索引";
  index["ko"] = index["ko-kr"] = "색인";
  index["nl"] = index["nl-be"] = index["nl-nl"] = "Index";
  index["pt"] = index["pt-br"] = index["pt-pt"] = "Índice";
  index["ru"] = index["ru-ru"] =  "Индекс";
  index["zh"] = index["zh-cn"] = "索引";
  index["zh-tw"] = "索引";

  var contents = new Array();
  contents["de"] = contents["de-ch"] = contents["de-de"] = "Inhaltsverzeichnis";
  contents["en"] = contents["en-ca"] = contents["en-gb"] = contents["en-us"] = "Contents";
  contents["es"] = contents["es-es"] = contents["es-xl"] = "Contenido";
  contents["fr"] = contents["fr-be"] = contents["fr-ca"] = contents["fr-ch"] = contents["fr-fr"] = "Table des matières";
  contents["it"] = contents["it-ch"] =  contents["it-it"] = "Contenuto";
  contents["ja"] = contents["ja-jp"] = "目次";
  contents["ko"] = contents["ko-kr"] = "목차";
  contents["nl"] = contents["nl-be"] = contents["nl-nl"] = "Inhoud";
  contents["pt"] = contents["pt-br"] = contents["pt-pt"] = "Conteúdo";
  contents["ru"] = contents["ru-ru"] = "Содержание";
  contents["zh"] = contents["zh-cn"] = "内容";
  contents["zh-tw"] = "內容";

  if (str == "search") {
    return search[lang];
  } else if (str == "printString") {
    return printString[lang];
  } else if (str == "index") {
    return index[lang];
  } else if (str == "contents") {
    return contents[lang];
  } else {
    alert("\"" + str + "\" isn't a string that getString knows.");
  }

  return;
}
