var url = "";
var cm = 0;
var om = 0;
var sm = 0;
var mytimer;
var menuselected;

function menu(i,p,n,c,h,o)
{
  this.id = i;
  this.parent = p;
  this.name = n;
  this.cname = c;
  if (h.indexOf("contents.asp") == -1)
  {
    if ((h != '#') && (h.indexOf('http') == -1) )
      this.href = url + h; 
    else
      this.href = h; 
  }
  else
    this.href = h; 

  this.opt = o;
  return(this);
} var wasopen;

var menus = new Array();

menus[0] = new menu(9,0,'Home','topmenu_off','/index.htm','c','150','20');
menus[1] = new menu(10,0,'Company','topmenu_off','#','c','60','20');
menus[2] = new menu(11,0,'Gallery','topmenu_off','#','c','50','20');
menus[3] = new menu(12,0,'Links','topmenu_off','/links.htm','c','65','20');
menus[4] = new menu(13,0,'Products','topmenu_off','#','c','50','20');
menus[5] = new menu(14,0,'Trim Selector','topmenu_off','#','c','150','20');

menus[6] = new menu(16,10,'About Southbound','submenu_off','/company/about.htm','c','100','20');
menus[7] = new menu(17,10,'Contact Details','submenu_off','/company/contact.htm','c','100','20');
menus[8] = new menu(18,10,'Location','submenu_off','/company/location.htm','c','100','20');
menus[9] = new menu(42,10,'Jobs','submenu_off','/company/jobs.htm','c','100','20');

menus[10] = new menu(23,11,'911 Speedster','submenu_off','/gallery/911speedster.htm','c','60','20');
menus[11] = new menu(24,11,'911 Carrera 2','submenu_off','/gallery/911carrera2.htm','c','60','20');
menus[12] = new menu(25,11,'Boxster','submenu_off','/gallery/boxster.htm','c','60','20');
menus[13] = new menu(26,11,'Various Trims','submenu_off','/gallery/various.htm','c','60','20');

menus[14] = new menu(28,13,'Seats','submenu_off','/products/seats.htm','c','50','20');
menus[15] = new menu(29,13,'Panels','submenu_off','/products/panels.htm','c','50','20');
menus[16] = new menu(32,13,'Trim - General','submenu_off','/products/trim.htm','c','50','20');
menus[17] = new menu(40,13,'Carpet sets (fitted)','submenu_off','/products/carpetfitted.htm','c','50','20');
menus[18] = new menu(30,13,'Carpet sets (supplied)','submenu_off','/products/carpetssupplied.htm','c','50','20');
menus[19] = new menu(34,13,'Fittings and Materials','submenu_off','/products/fittings.htm','c','50','20');
menus[20] = new menu(35,13,'Hoods','submenu_off','/products/hoods.htm','c','50','20');

menus[21] = new menu(36,14,'Porsche Leather 1','submenu_off','/trim/porsche1.htm','c','50','20');
menus[22] = new menu(37,14,'Porsche Leather 2','submenu_off','/trim/porsche2.htm','c','50','20');
menus[23] = new menu(38,14,'Various Leather 1','submenu_off','/trim/various1.htm','c','50','20');
menus[24] = new menu(39,14,'Various Leather 2','submenu_off','/trim/various2.htm','c','50','20');



var opened = '';
var toopen = 0;

function RestoreMenu()
{
var s;

  if (mytimer) clearTimeout(mytimer);

  DrawSubMenu(toopen);
}

function mouseOut()
{

  if (mytimer) clearTimeout(mytimer);
  
  mytimer = setTimeout("RestoreMenu()", 1000);

}

function DrawSubMenu(l)
{
var html='';
var i;
var s = MM_findObj("submenux");
var a;

  if (mytimer) clearTimeout(mytimer);

  if (!s) {
    cm = l; 
    return;
  }

  if (cm != toopen)
    {
    a = MM_findObj("link" + cm);
    if (a) 
      a.className = a.className.replace('on', 'off'); 
    } 


  html += "<table border=0 cellspacing=0 cellpadding=0>";
  html += "<tr>";
  for (i = 0; (i < menus.length) && (l != 0); i ++)
    {
    if (menus[i].parent == l)
      {
      html += "<td nowrap class=\"topsubmenu-td\">";
      if (menuselected == menus[i].id) 
        html += "<a class='" + menus[i].cname.replace("off", "on") + "' onmouseover='clearTimeout(mytimer);' onmouseout='mouseOut();' href='" + menus[i].href + "'>" + menus[i].name + "</a>";
      else
        html += "<a class='" + menus[i].cname + "' onmouseover='clearTimeout(mytimer);' onmouseout='mouseOut();' href='" + menus[i].href + "'>" + menus[i].name + "</a>";
      
      html += "</td>";
      }
    }
  html += "</tr>";
  html += "</table>";
  s.innerHTML = html;
 
  s = MM_findObj("link" + l);
  if (s) {
    s.className = s.className.replace('off', 'on'); 
  }
  
  cm = l;
}

function DrawMenuItems(l)
{
var html='';
var i,j;
var f;
var cols = 0;

  f = 0;
  html += "<table border=0 width=650 cellspacing=0 cellpadding=0>";
  html += "<tr>";
  html += "<td>"
  html += "<div id='mainmenux'>";
  html += "<table border=0 cellspacing=0 cellpadding=0 align=right>";
  html += "<tr>";
  for (i = 0; i < menus.length; i ++)
    {
    if (menus[i].parent == 0)
      {
      cols ++;
      f = 1;
        html += "<td nowrap class=\"topmenu-td\">";

        if ((toopen == menus[i].id) || (l == menus[i].id)) 
          html += "<a id='link" + menus[i].id + "' class='" + menus[i].cname.replace("off", "on") + "' onmouseout='mouseOut();' onmouseover='DrawSubMenu(" + menus[i].id + ");' href='" + menus[i].href + "'>" + menus[i].name + "</a>";
        else
          html += "<a id='link" + menus[i].id + "' class='" + menus[i].cname + "' onmouseout='mouseOut();' onmouseover='DrawSubMenu(" + menus[i].id + ");' href='" + menus[i].href + "'>" + menus[i].name + "</a>";
      html += "</td>";
      }
    }
  html += "</tr>";
  html += "</table></div></td></tr>";
  html += "</table>";

  if (f == 0)
    return("");
  else
    return(html);
}

function HasChildren(x)
{
var i;

  for (i = 0; i < menus.length; i ++)
    if (menus[i].parent == x) return(true);
    
  return (false);
}

function GetParentSubscript(x)
{
var i;

  for (i = 0; i < menus.length; i ++)
    if (menus[i].id == x) return(i);
    
  return(-1);
}

function strtolower(s)
{
var t;

  t = s;
  
  while (t.indexOf(" ") != -1)
    t = t.replace(" ", "_");
  
  return(t.toLowerCase());
}

function DrawMenu(l)
{
var m = MM_findObj("menux");
var pos;
var apos;
var i;
var url='nowhere';

  m.innerHTML = DrawMenuItems(l);
  
  return (true);

}

toopen = 0;

DrawMenu(toopen);

