// No change required; change this file at your own risk.

// Topnavigation output, dynamic =================================================================================
// Writes the top navigation into the document. Note that "level" is the amount of directories below the homepage.
// For example, the homepage has level 0, "/courses/" would be level 1, "/courses/ymes/" would be level 2 etc.
// The level has to be changed in the HTML file

function write_topnavigation(level) {
  //alert (location.pathname);
  var pathhtml = "";
  for ( var i=0; i < level; i++) {
    pathhtml += "../"
  }
  document.write ('<ul id="topnavigation">');
  for (var j = 0; j < topnavigation.length; j++) {
    document.write ('<li');
    if (location.pathname.match(topnavigation[j]["Link"])){
      document.write(' class="active"');
    }
    document.write ('><a href="'+pathhtml+topnavigation[j]["Link"]+'index.html">'+topnavigation[j]["Name"]+'</a></li>');
  }
  document.write ('</ul>');
}

// Homepage Leftnavigation, dynamic =================================================================================
// Writes the left navigation on the homepage
// needs to be localised for all countries
function write_homepage_leftnavigation() {
  document.write ('<ul>');
  document.write ('<li class="top"><a href="./index.html">Home</a></li>');
  for (var j = 0; j < topnavigation.length; j++) {
    document.write ('<li><a href="'+topnavigation[j]["Link"]+'index.html">'+topnavigation[j]["Name"]+'</a></li>');
  }
  document.write ('</ul>');
}

// Write Footer (pretty static) =====================================================================================
function write_footer(level) {
  var pathhtml = "";
  for ( var i=0; i < level; i++) {
    pathhtml += "../"
  }
  document.write ('<ul>');
  document.write ('  <li><a href="'+pathhtml+'imprint.html" title="'+nameimprint+'">'+nameimprint+'</a></li>');
  document.write ('</ul>');
  document.write ('<address>');
  document.write ('  Copyright &copy; ');
  document.write (copyrightyear+'&nbsp;');
  document.write (schoolname+'. ');
  document.write (allrightsreserved);
  document.write ('</address>');
}

// Left Navigation - Courses ========================================================================================
// Writes the left navigation in the section "Courses"
// needs to be localised for all countries
function write_leftnavigation_courses(level) {
  var pathhtml = "";
  for ( var i=0; i < level; i++) {
    pathhtml += "../"
  }
  document.write ('<ul>');
  document.write ('<li class="top"><a href="'+pathhtml+'index.html">Kurse</a></li>');
  for (var j = 0; j < coursecategories.length; j++) {
    document.write ('<li');
    if (location.pathname.match(coursecategories[j]["Link"])){
      document.write(' class="active"');
    }
    document.write ('><a href="'+pathhtml+coursecategories[j]["Link"]+'index.html">'+coursecategories[j]["Name"]+'</a></li>');
  }
  document.write ('</ul>');
}

// Back To Top Link =================================================================================================
// needs to be localised for all countries
function write_backtotop() {
  document.write ('<div class="backtotop"><a href="#header" onclick="scrollTo(0,0);">Zurück nach oben</a></div>');
}


