var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('netscape6') != -1)
  document.write('<link rel="stylesheet" type="text/css" href="/EN/CSS/netscape_Menu.css">')
else if (ua.indexOf('netscape/7') != -1)
  document.write('<link rel="stylesheet" type="text/css" href="/EN/CSS/netscape_Menu.css">')
else if (ua.indexOf('gecko') != -1)
  document.write('<link rel="stylesheet" type="text/css" href="/EN/CSS/netscape_Menu.css">')
else
  document.write('<link rel="stylesheet" type="text/css" href="/EN/CSS/ie_Menu.css">');

MenuItems = new Array();
MenuItemCount = 0;

function MenuItem(id, src, href, hint)
{
  this.id = id;
  this.src = src;
  this.href = href;
  this.title = hint;
  this.index = MenuItemCount;
  this.img = new Image();
  this.img.src = '/EN/Images/Buttons/' + src + '_N.gif';
  this.imgsel = new Image();
  this.imgsel.src = '/EN/Images/Buttons/' + src + '_s.gif';
  MenuItemCount++;
}

//ID, Text, Href, Title
MenuItems[MenuItemCount] = new MenuItem('start', 'Homepage', 'index2.htm', 'Click here to return to the homepage.');
MenuItems[MenuItemCount] = new MenuItem('news', 'News', 'news/index2.htm', 'Click here to read news about PublicWare.');
MenuItems[MenuItemCount] = new MenuItem('products', 'Products', 'products/index2.htm', 'Click here to read about products from PublicWare.');
MenuItems[MenuItemCount] = new MenuItem('tools', 'Tools', 'tools/index2.htm', 'Click here to read about tools from PublicWare.');
MenuItems[MenuItemCount] = new MenuItem('download', 'Download', 'download/index2.htm', 'Click here to download PublicWare products or tools.');
MenuItems[MenuItemCount] = new MenuItem('support', 'Support', 'support/index2.htm', 'Click here to get support for PublicWare products.');
MenuItems[MenuItemCount] = new MenuItem('development', 'Develop', 'development/index2.htm', 'Click here to read about the delevlopment of new products, tools and updates from Publicware.');
MenuItems[MenuItemCount] = new MenuItem('sitemap', 'Sitemap', 'sitemap/index2.htm', 'Click here to get a overview over the PublicWare site.')
MenuItems[MenuItemCount] = new MenuItem('contact', 'Contact', 'contact/index2.htm', 'Click here to contact PublicWare.');

function CreateMenu()
{
  for (Index = 0; Index < MenuItemCount; Index++)
  {
    containt = '<img id="img' + MenuItems[Index].id + '" src="/EN/Images/Buttons/' + MenuItems[Index].src + '_N.gif" onmouseover="ButtonMouseOver(this)" onmouseout="ButtonMouseOut(this)" onclick="ButtonClick(this)">';
    document.writeln('<a href="' + MenuItems[Index].href + '" target="mainframe" onblur="ButtonMouseOut(this)" onfocus="ButtonMouseOver(this)"><td class="menubox" id="' + MenuItems[Index].id + '" title="' + MenuItems[Index].title + '" height="21">' + containt + '</td></a>');
  }  
}

function getButtonIndex(Element)
{
  result = 0;
  for (Index = 0; Index < MenuItemCount; Index++)
  {
    if ((Element.id == MenuItems[Index].id) || (Element.id == 'img' + MenuItems[Index].id)) result = Index
  }
  return result;
}

function ButtonMouseOver(Element)
{
  Element.src = MenuItems[getButtonIndex(Element)].imgsel.src;
}  

function ButtonMouseOut(Element)
{
  Element.src = MenuItems[getButtonIndex(Element)].img.src;
}


function ButtonClick(Element)
{
  if (Element.id == 'imgtop')
  {
    location.href = '#top';
  }
  else if (Element.id == 'imgback')
  {
    history.back();
  }
  else
  {
    parent.parent.mainframe.location.href = MenuItems[getButtonIndex(Element)].href
  }
}
