// JavaScript Document for Sub-Navigation Mouse Over Colour Swapping

// Functions for Left Side Sub-Navigation

var target0 = document.getElementById('subNavigationArea');
var target1;
var target2;
var target3;
var menuItem1;
var menuItem2;
var menuItem3;
var parentSection;

if (level == 1)
  {
  for (var a = 1; a <= totalItems; a++)
    {
    if (section == eval('m' + a + '[2]'))
      {
      menuItem1 = "m" + a;
      break;
      }
    }
  }
else if (level == 2)
  {
  for (var a = 1; a <= totalItems; a++)
    {
    for (var b = 1; b <= eval('m' + a + '[4]'); b++)
      {
      if (section == eval('m' + a + '_' + b + '[2]'))
        {got = true; break;}
      }
    if (got)
      {break;}
    }
  menuItem1 = "m" + a;
 
  }
else if (level == 3)
  {
  var got = false;
  for (a = 1; a <= totalItems; a++)
    {
    for (b = 1; b <= eval('m' + a + '[4]'); b++)
      {
      for (c = 1; c <= eval('m' + a + '_' + b + '[4]'); c++)
        {
        if (section == eval('m' + a + '_' + b + '_' + c + '[2]'))
          {got = true; break;}
        }
      if (got)
        {break}
      }
    if (got)
      {break}
    }
  menuItem1 = "m" + a;
  }

target0.innerHTML = "<div id=\"subNavTop\"><a href=\"" + eval(menuItem1 + '[3]') + "\"><img src=\"" + eval(menuItem1 + '[1]') + "\" width=\"177\" height=\"63\" border=\"0\" /></a></div><div id=\"subNavMid\"></div>";
target1 = document.getElementById('subNavMid');
for (var i = 1; i <= eval(menuItem1 + '[4]'); i++)
  {
  menuItem2 = "m" + a + "_" + i;
  target1.innerHTML += "<div id=\"" + eval(menuItem2 + '[2]') + "_top\" class=\"subNavigation1\" style=\"padding:4px 14px 4px 14px;\" onmouseover=\"swapColour('" + eval(menuItem2 + '[2]') + "_top')\" onmouseout=\"restoreColour('" + eval(menuItem2 + '[2]') + "_top')\" onclick=\"window.location = '" + eval(menuItem2 + '[3]') + "'\">" + "<a href=\"" + eval(menuItem2 + '[3]') + "\" class=\"subNavigation1\">" + eval(menuItem2 + '[0]') + "</a></div>";
  if (eval(menuItem2 + '[4]') >= 1)
    {
    target1.innerHTML += "<div id=\"" + eval(menuItem2 + '[2]') + "_body\" style=\"display:none\"></div>";
    for  (var j = 1; j <= eval(menuItem2 + '[4]'); j++)
      {
      target2 = document.getElementById(eval(menuItem2 + '[2]') + "_body");
      target2.innerHTML += "<div class=\"vert5pxSpacing\"></div>";
      menuItem3 = "m" + a + "_" + i + "_" + j;
      target2.innerHTML += "<div id=" +  eval(menuItem3 + '[2]') + " class=\"subNavigation2\" style=\"padding:4px 14px 4px 14px;display:inline-block;\" onmouseover=\"swapColour('" +  eval(menuItem3 + '[2]') + "')\" onmouseout=\"restoreColour('" +  eval(menuItem3 + '[2]') + "')\" onclick=\"window.location = '" + eval(menuItem3 + '[3]') + "'\"><a href=\"" +  eval(menuItem3 + '[3]') + "\" class=\"subNavigation2\">" + eval(menuItem3 + '[0]') + "</a></div>";
      }
    target2.innerHTML += "<div class=\"vert5pxSpacing\"></div>";
    target2.innerHTML += "<div class=\"subNavBtm2\"></div>";
    }
  target1.innerHTML += "<div class=\"vert5pxSpacing\"></div>";
  }
target1.innerHTML += "<div class=\"vert5pxSpacing\"></div>";
if (eval(menuItem1 + '[4]') == 0 && (menuItem1 + '_1') != null)
  {
  target1.style.padding = "0px";
  target1.innerHTML = "<div class=\"subNavigation1\"><img src=\"" + eval(menuItem1 + '_1' + '[1]') + "\" style=\"cursor:default;\" /></div>";
  }
target0.innerHTML += "<div id=\"subNavBtm\"></div>";

function getSubNavColour()
{
document.getElementById('subNavMid').style.background = colour1;
document.getElementById('subNavBtm').style.background = subNavBtm;
if (level == 2)
  {
  document.getElementById(section + '_top').style.background = colour2;
  if (document.getElementById(section + '_body'))
    {
    document.getElementById(section + '_body').style.background = colour3;
    document.getElementById(section + '_body').style.display = "";
    }
  }
if (level == 3)
  {
  document.getElementById(eval('m' + a + '_' + b + '[2]') + '_top').style.background = colour3;
  document.getElementById(eval('m' + a + '_' + b + '[2]') + '_body').style.background = colour3;
  document.getElementById(section).style.background = colour2;
  document.getElementById(eval('m' + a + '_' + b + '[2]') + '_body').style.display = "";
  parentSection = eval('m' + a + '_' + b + '[2]');
  }
}

function swapColour(divId)
{
document.getElementById(divId).style.background = colour2;
}

function restoreColour(divId)
{
var str1 = divId.substring(0,(divId.length - 4));
var str2 = divId.substring((divId.length - 4),(divId.length));
if (str1 == section || divId == section)
  {}
else if (divId == (parentSection + '_top'))
  {document.getElementById(divId).style.background = colour3;}
else if (str2 == '_top')
  {document.getElementById(divId).style.background = colour1;}
else
  {document.getElementById(divId).style.background = colour3;}
}

// Functions for Product Page Tabs

var tab1 = "";
var tab2 = "";

function swapTab(_tab1,_tab2)
{
tab1 = _tab1;
tab2 = _tab2;
document.getElementById(tab1).src = "/images/sub_nav/nav_product_" + tab2 + ".jpg";
}

function restoreTab()
{
document.getElementById(tab1).src = "/images/sub_nav/nav_product_" + tab1 + ".jpg";
}
