/* This function shows the main menu for the PeLuAk web pages.
*/
function mainMenu()
{
  var     m_fMenuPercent = 100/4;
  var     m_sFileName;
  var     m_sPageWithoutLang;
  var     m_sCurrentLang;

  // The file name is retrieved from the URL ---------------------
  m_sFileName = retrieveFileName();
  
  // The current language is retrieved from the file name ---------------------
  m_sCurrentLang = retrieveLanguage(m_sFileName);
  
  // The page without the language code is retrieved ---------------------
  m_sPageWithoutLang = retrievePageName(m_sFileName);
  
  // The start of the menu table =========================================
  document.write('<table class="table_100">');
  document.write('<tr>');
  
  // The start page cell -------------------------------------------------
  if (m_sPageWithoutLang == "index")
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="selected_menu">');
    
    if (m_sCurrentLang == "EN")
    {
      document.write('Start page');
    }
    else
    {
      document.write('Startsida');
    }
  }
  else
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="not_selected_menu">');
    
    if (m_sCurrentLang == "EN")
    {
      document.write('<a href="index_EN.html"><div>Start page</div></a>');
    }
    else
    {
      document.write('<a href="index.html"><div>Startsida</div></a>');
    }
  }
  document.write('</td>');

  // The photo archive cell ---------------------------------------------
  if (m_sPageWithoutLang.substr(0, 5) == "photo")
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="selected_menu">');

    if (m_sCurrentLang == "EN")
    {
      document.write('Photos');
    }
    else
    {
      document.write('Bilder');
    }
  }
  else
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="not_selected_menu">');
    
    if (m_sCurrentLang == "EN")
    {
      document.write('<a href="photo_order_EN.html"><div>Photos</div></a>');
    }
    else
    {
      document.write('<a href="photo_order_SE.html"><div>Bilder</div></a>');
    }
  }
  document.write('</td>');
  
  // The link cell --------------------------------------------------------
  if (m_sPageWithoutLang == "link")
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="selected_menu">');

    if (m_sCurrentLang == "EN")
    {
      document.write('Links');
    }
    else
    {
      document.write('L&auml;nkar');
    }
  }
  else
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="not_selected_menu">');
    
    if (m_sCurrentLang == "EN")
    {
      document.write('<a href="link_EN.html?' + c_LINKSUBMENU + '=' + c_CLASSICROADRACING + '"><div>Links</div></a>');
    }
    else
    {
      document.write('<a href="link_SE.html?' + c_LINKSUBMENU + '=' + c_CLASSICROADRACING + '"><div>L&auml;nkar</div></a>');
    }
  }
  document.write('</td>');
  
  // The about cell --------------------------------------------------------
  if (m_sPageWithoutLang == "about")
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="selected_menu">');

    if (m_sCurrentLang == "EN")
    {
      document.write('About PeLuAk');
    }
    else
    {
      document.write('Om PeLuAk');
    }
  }
  else
  {
    document.write('<td width="' + m_fMenuPercent + '%" class="not_selected_menu">');
    
    if (m_sCurrentLang == "EN")
    {
      document.write('<a href="about_EN.html"><div>About PeLuAk</div></a>');
    }
    else
    {
      document.write('<a href="about_SE.html"><div>Om PeLuAk</div></a>');
    }
  }
  document.write('</td>');
  
  // ------------------------------------------------------------------------
  
  document.write('</tr>');
  document.write('</table>');
  // ========================================================================
}

