//-----------------------------------------------------------------
// Barry Mann Photography
// ----------------------
// Navigation rollover
// Created:   10 February 2006
// Copyright: George Mann Publications 2006 ~ post@gmp.co.uk
// Version:   1.1
//-----------------------------------------------------------------
//
// Set number of navigation DIVs
//------------------------------
  for (i=1; i < (navigator[0] + 1); i ++) {

    entry = navigator[i].split('/');

    if (entry[1] == 0) {
      navoptions = navoptions + 1;
    }

  }

//
// NAVIGATOR1: Build navigation and dropdown DIVs
//-----------------------------------------------
function navigator1 () {

  navwidth = 90;
  navheight = 18;

// Build main navigation bar
//--------------------------
  codehtml = "<table height=30 border=0 cellpadding=0 cellspacing=0 bgcolor=#ffffff><tr valign=top><td><table border=0 cellpadding=0 cellspacing=0><tr valign=top>"

  navcount = 0;

  for (i = 1; i < (navigator[0] + 1); i++) {

    entry = navigator[i].split('/');

    if (entry[1] == 0) {

      if (navcount == 0) {

        codehtml = codehtml + "<td width=" + navwidth + " height=" + navheight + " align=middle valign=middle class=navigation><a href=" + entry[3] + ">" + entry[2] + "</a></td>";

        navwidth = 12;

        navcount = navcount + 1;
      }

      else {

        codehtml = codehtml + "<td width=" + navwidth + " height=" + navheight + "><img src=images/navbar3a.jpg></td><td id=tdnav" + navcount + " align=centre valign=middle class=navigation onmouseover='navshow(" + navcount + ")'><a href=" + entry[3] + ">" + entry[2] + "</a></td>";

        navcount = navcount + 1;

      }
    }
  }

  codehtml = codehtml + "</tr></table></td></tr></table>";

// Build dropdown navigation
//--------------------------
  nav1count = 0;
  nav2count = 0;

  for (i = 2; i < (navigator[0] + 1); i++) {

    entry = navigator[i].split('/');

    if (entry[1] == 0) {

      nav1count = nav1count + 1;

      if (nav1count > 1) {
        if (nav2count == 0) {
          codehtml = codehtml + "</table></div>";
        }
        else {
          codehtml = codehtml + "<tr><td><img src=images/navbar2.jpg height=2 width=23 vspace=2></td><td><img src=images/navbar5.jpg height=4 width=100%></td></tr></table></div>";
        }

      }

      codehtml = codehtml + "<div id=divnavs" + nav1count + " style='position: absolute; z-index: 100; visibility: hidden; background: #ffffff' onmouseover='navshow(" + nav1count + ")'><table border=0 cellpadding=0 cellspacing=0>";

      nav2count = 0;

    }

    else {

      nav2count = nav2count + 1;

      codehtml = codehtml + "<tr><td height=" + navheight + "><img src=images/navbar3a.jpg></td><td id=divnavs" + nav1count + " abcdefghijklmno".charAt(nav2count) + " class=subnavigation><a href=" + entry[3] + ">" + entry[2] + "</a>&nbsp;&nbsp;&nbsp;</a></td></tr>";

    }
  }

  codehtml = codehtml + "<tr><td><img src=images/navbar2.jpg height=2 width=23 vspace=2></td><td><img src=images/navbar5.jpg height=4 width=100%></td></tr></table></div>";

  document.write(codehtml)

}
//
//-----------------------------------------------------
// NAVSHOW: Show individual navigation dropdown buttons
//-----------------------------------------------------
function navshow (navid) {

  elemid = window.event.srcElement.id;

  for (i = 1; i < navoptions; i++) {
  
    codejs = "divnavs" + i + ".style.visibility = '" + "hidden" + "';";
    eval(codejs)

  }

  codejs = "divnavs" + navid + ".style.left = divnavtab.offsetLeft + tdnav" + navid + ".offsetLeft - 23;"
  eval(codejs)

  codejs = "divnavs" + navid + ".style.top = divnavtab.offsetTop + tdnav" + navid + ".offsetTop + 20;"
  eval(codejs)

  codejs  = "divnavs" + navid + ".style.visibility = 'visible';"
  eval(codejs)

}

//----------------------------------------------
// NAVHIDE: Hide all navigation dropdown buttons
//----------------------------------------------
function navhide () {

  elemid = window.event.srcElement.id;

//  divdebug.innerhtml = elemid + " xxx";
// window.alert(elemid);

  if (elemid != "divnavtab") {

    for (i = 1; i < navoptions; i++) {
  
      codejs = "divnavs" + i + ".style.visibility = '" + "hidden" + "';";
      eval(codejs)

    }

    divnavs1.style.visibility = "hidden";

  }

}

function shownav (navid) {

  hidenav(0)

  if (navid != 0) {
    codejs = "divnav" + navid + ".style.visibility = '" + "visible" + "';";
    eval(codejs)
  }

}

//----------------------------------------------
// NAVHIDE: Hide all navigation dropdown buttons
//----------------------------------------------
function hidenav () {



}