
var shopping = 0

function page (new_page) {
  var suffix = ""

  if (shopping == 0)
  {
    window.location.href = "../pages/" + new_page
  }
  else
  {
    suffix = new_page.substring (new_page.lastIndexOf("."), new_page.length)
    if (suffix == ".htm")
    {
      if (new_page.lastIndexOf("page=") < 0)
        document.cart.action = "../bin/shop.cgi?page=" + new_page
      else
        document.cart.action = "../pages/" + new_page
    }
    else
    {
      document.cart.action = "../pages/" + new_page
    }
    document.cart.page.value = new_page
    document.cart.submit()
  }
}

function hover_text (on_off, font_obj) {
var off = "#000000"  //black
var on  = "#FF0000"  //red
  if (on_off)
  {
//    font_obj.color = on
    font_obj.style.border = "2px solid "+on
  }
  else
  {
//    font_obj.color = off
    font_obj.style.border = "0px solid "+off
  }
}

function cart_nav () {
var page = window.location.href
  document.writeln("<table style=\"border: 1px solid #008000\" "+
    "cellspacing=0 cellpadding=8 bgcolor=YELLOW width=100%><tr><td>")
  document.writeln("<table align=center border=0 "+
    "style=\"border-collapse: collapse\" cellspacing=0 cellpadding=2 width=100%>")
  if (shopping)
  {
    page = document.forms(0).page.value
//    document.writeln(
//      "<tr align=center style=\"background-color: #FFFFCC\"><td colspan=2>"+
//        "<font id=browseshop_font size=2 color=BLACK>"+
//          "&nbsp;Browse&nbsp;&amp;&nbsp;Shop&nbsp;</font>"+
//      "</td></tr><tr align=center><td width=65%>"+
//        "<a href=\"javascript:document.cart.submit()\" "+
//          "style=\"text-decoration: none\" "+
//          "onMouseOver=\"javascript:hover_text(1,cart_font)\" "+
//          "onMouseOut=\"javascript:hover_text(0,cart_font)\">"+
//        "<font id=cart_font size=2 color=BLACK>&nbsp;VIEW&nbsp;Cart&nbsp;</font></a>"+
//      "</td><td width=35%>"+
//        "<a href=\"javascript:quit_check(\'../pages/"+page+"\')\" "+
//          "style=\"text-decoration: none\" "+
//          "onMouseOver=\"javascript:hover_text(1,quit_font)\" "+
//          "onMouseOut=\"javascript:hover_text(0,quit_font)\">"+
//        "<font id=quit_font size=2 color=BLACK>&nbsp;QUIT&nbsp;</font></a>"+
//      "</td></tr>")
  }
  else
  {
    page = page.substring (page.lastIndexOf("/")+1, page.length)
    if (page == "home.htm")  page = "mc_products.htm"
//    document.writeln(
//      "<tr align=center><td>"+
//        "<a href=\"javascript:page(\'../bin/shop.cgi?page="+page+"\')\" "+
//          "style=\"text-decoration: none\" "+
//          "onMouseOver=\"javascript:hover_text(1,browseshop_font)\" "+
//          "onMouseOut=\"javascript:hover_text(0,browseshop_font)\">"+
//        "<font id=browseshop_font size=2 color=BLACK>&nbsp;Browse&nbsp;&amp;&nbsp;Shop&nbsp;</font></a>"+
//      "</td></tr>")
  }
  document.writeln("</table>")
  document.writeln("</td></tr></table>")
}

function table_start () {
  document.writeln("<table style=\"border: 1px solid #008000\" "+
    "cellspacing=0 cellpadding=10 bgcolor=YELLOW width=100%><tr><td>")
  document.writeln("<table align=center border=0 "+
    "style=\"border-collapse: collapse\" cellspacing=0 cellpadding=0><tr>")
}

function table_end () {
  document.writeln("</tr></table>")
  document.writeln("</td></tr></table>")
}

function table_new_row () {
  document.writeln("</tr><tr>")
}

function load_nav_bar_images () {
var img_path = "../images/navigation/"
var img_file = ""
var img_size = " width=0 height=0"
var images_html = ""

  img_file = " src=\"" + img_path + "unselected.gif\""
  images_html = images_html + "<img border=0" + img_file + img_size + ">"

  img_file = " src=\"" + img_path + "selected.gif\""
  images_html = images_html + "<img border=0" + img_file + img_size + ">"

  img_file = " src=\"" + img_path + "hover_unselected.gif\""
  images_html = images_html + "<img border=0" + img_file + img_size + ">"

  img_file = " src=\"" + img_path + "hover_selected.gif\""
  images_html = images_html + "<img border=0" + img_file + img_size + ">"

  document.write(images_html)
}

function hover (on_off, selected, cell_obj) {
var img_path = "../images/navigation/"
var img_file = ""

  switch (on_off)
  {
    case 0:
      if (selected == 0)
      { img_file = "unselected.gif" }
      else
      { img_file = "selected.gif" };
      break;
    case 1:
      if (selected == 0)
      { img_file = "hover_unselected.gif" }
      else
      { img_file = "hover_selected.gif" };
      break;
    default:;
  }

  cell_obj.background = img_path + img_file
}

function nav_tab (tab_num, tab_link, tab_alt, selected, hover) {
var img_path = "../images/navigation/"
var img_src  = ""
var img_alt  = ""
var img      = ""
var a_img  = ""
var td_background  = ""
var td_onmouseover = ""
var td_onmouseout  = ""
var td             = ""

  img_src = " src=\"" + img_path + tab_num + ".gif\""
  img_alt = " alt=\"" + tab_alt + "\""
  img     = "<img border=0" + img_src + img_alt + ">"

  if (selected == 0)
  { td_background = " background=\"" + img_path + "unselected.gif\"" }
  else
  { td_background = " background=\"" + img_path + "selected.gif\"" }

  if (hover == 0)
  { td_onmouseover = ""
    td_onmouseout  = ""
    a_img          = img }
  else
  { td_onmouseover = " onmouseover=\"javascript:hover(1," + selected + ",this)\"" 
    td_onmouseout  =  " onmouseout=\"javascript:hover(0," + selected + ",this)\""
    a_img          = "<a href=\"" + tab_link + "\">" + img + "</a>" }

  td = "<td" + td_background + td_onmouseover + td_onmouseout + ">" + a_img + "</td>"

  document.writeln(td)
}

function nav_bar (level1_num, level1_hover, level2_num, level2_hover, level3_num, level3_hover) {
var selected = 0
var this_hover = 0
var l1 = ""
var l2 = ""

  cart_nav()

  l1 = "javascript:page ('"
  l2 = "')"

  load_nav_bar_images()

  table_start()

  if (level1_num == "00")
  { selected = 1; this_hover = level1_hover } else { selected = 0; this_hover = 1 }
  nav_tab ("tab00", l1+"home.htm"+l2, "Educational", selected, this_hover)
  table_new_row()

  nav_tab ("blank", "", "", 0, 0)
  table_new_row()

  if (level1_num == "01")
  { selected = 1; this_hover = level1_hover } else { selected = 0; this_hover = 1 }
  nav_tab ("tab01", l1+"mc_home.htm"+l2, "Multiplication Camp", selected, this_hover)
  table_new_row()

  if (level1_num == "01")
  {

    if (level2_num == "01")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab01/tab01", l1+"mc_how.htm"+l2, "How It Works", selected, this_hover)
    table_new_row()

    if (level2_num == "01")
    {
      if (level3_num == "01")
      { selected = 1; this_hover = level3_hover } else { selected = 0; this_hover = 1 }
      nav_tab ("tab01/tab01/tab01", l1+"mc_how_sample.htm"+l2, "Sample Pages", selected, this_hover)
      table_new_row()

      if (level3_num == "02")
      { selected = 1; this_hover = level3_hover } else { selected = 0; this_hover = 1 }
      nav_tab ("tab01/tab01/tab02", l1+"mc_how_contents.htm"+l2, "Book Contents", selected, this_hover)
      table_new_row()
    }

    if (level2_num == "02")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab01/tab02", l1+"mc_testimonials.htm"+l2, "Testimonials", selected, this_hover)
    table_new_row()

    if (level2_num == "03")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab01/tab03", l1+"mc_products.htm"+l2, "Product Info", selected, this_hover)
    table_new_row()

//    if (level2_num == "04")
//    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
//    nav_tab ("tab01/tab04", l1+"mc_ordering.htm"+l2, "Ordering", selected, this_hover)
//    table_new_row()

    if (level2_num == "05")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab01/tab05", l1+"mc_about.htm"+l2, "About Us", selected, this_hover)
    table_new_row()

    if (level2_num == "06")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab01/tab06", l1+"mc_contact.htm"+l2, "Contact Us", selected, this_hover)
    table_new_row()
  }

  if (level1_num != "00")
  {
    nav_tab ("blank", "", "", 0, 0)
    table_new_row()
  }

  if (level1_num == "02")
  { selected = 1; this_hover = level1_hover } else { selected = 0; this_hover = 1 }
  nav_tab ("tab02", l1+"sn_home.htm"+l2, "Sea Notes", selected, this_hover)
  table_new_row()

  if (level1_num == "02")
  {

    if (level2_num == "01")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab02/tab01", l1+"sn_how.htm"+l2, "How It Works", selected, this_hover)
    table_new_row()

    if (level2_num == "02")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab02/tab02", l1+"sn_testimonials.htm"+l2, "Testimonials", selected, this_hover)
    table_new_row()

    if (level2_num == "03")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab02/tab03", l1+"sn_products.htm"+l2, "Product Info", selected, this_hover)
    table_new_row()

//    if (level2_num == "04")
//    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
//    nav_tab ("tab02/tab04", l1+"sn_ordering.htm"+l2, "Ordering", selected, this_hover)
//    table_new_row()

    if (level2_num == "05")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab02/tab05", l1+"sn_about.htm"+l2, "About Us", selected, this_hover)
    table_new_row()

    if (level2_num == "06")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab02/tab06", l1+"sn_contact.htm"+l2, "Contact Us", selected, this_hover)
    table_new_row()
}

  if (level1_num != "00")
  {
    nav_tab ("blank", "", "", 0, 0)
    table_new_row()
  }

  if (level1_num == "03")
  { selected = 1; this_hover = level1_hover } else { selected = 0; this_hover = 1 }
  nav_tab ("tab03", l1+"ot_home.htm"+l2, "Other Products", selected, this_hover)
  table_new_row()

  if (level1_num == "03")
  {

//    if (level2_num == "00")
//    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
//    nav_tab ("tab03/tab00", l1+"ot_fundraisers.htm"+l2, "Fundraisers", selected, this_hover)
//    table_new_row()

    if (level2_num == "01")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab03/tab01", l1+"ot_products.htm"+l2, "Product Info", selected, this_hover)
    table_new_row()

//    if (level2_num == "02")
//    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
//    nav_tab ("tab03/tab02", l1+"ot_ordering.htm"+l2, "Ordering", selected, this_hover)
//    table_new_row()

    if (level2_num == "03")
    { selected = 1; this_hover = level2_hover } else { selected = 0; this_hover = 1 }
    nav_tab ("tab03/tab03", l1+"ot_contact.htm"+l2, "Contact Us", selected, this_hover)
    table_new_row()
}

  table_end()
}

function nav_map (doc_obj) {

  switch (doc_obj.title)
  {
    case ("Nancy's Artworks - Educational"):
      nav_bar ("00", 0)
      break;
    case ("Multiplication Camp"):
      nav_bar ("01", 0)
      break;
    case ("Multiplication Camp - How it Works"):
      nav_bar ("01", 1, "01", 0)
      break;
    case ("Multiplication Camp - How it Works - Sample Pages"):
      nav_bar ("01", 1, "01", 1, "01", 0)
      break;
    case ("Multiplication Camp - How it Works - Book Contents"):
      nav_bar ("01", 1, "01", 1, "02", 0)
      break;
    case ("Multiplication Camp - Testimonials"):
      nav_bar ("01", 1, "02", 0)
      break;
    case ("Multiplication Camp - Products"):
      nav_bar ("01", 1, "03", 0)
      break;
//    case ("Multiplication Camp - Ordering"):
//      nav_bar ("01", 1, "04", 0)
      break;
    case ("Multiplication Camp - About Us"):
      nav_bar ("01", 1, "05", 0)
      break;
    case ("Multiplication Camp - Contact Us"):
      nav_bar ("01", 1, "06", 0)
      break;
    case ("Sea Notes"):
      nav_bar ("02", 0)
      break;
    case ("Sea Notes - How it Works"):
      nav_bar ("02", 1, "01", 0)
      break;
    case ("Sea Notes - Testimonials"):
      nav_bar ("02", 1, "02", 0)
      break;
    case ("Sea Notes - Products"):
      nav_bar ("02", 1, "03", 0)
      break;
//    case ("Sea Notes - Ordering"):
//      nav_bar ("02", 1, "04", 0)
//      break;
    case ("Sea Notes - About Us"):
      nav_bar ("02", 1, "05", 0)
      break;
    case ("Sea Notes - Contact Us"):
      nav_bar ("02", 1, "06", 0)
      break;
    case ("Other Products"):
      nav_bar ("03", 0)
      break;
//    case ("Other Products - Fundraisers"):
//      nav_bar ("03", 1, "00", 0)
//      break;
    case ("Other Products - Products"):
      nav_bar ("03", 1, "01", 0)
      break;
//    case ("Other Products - Ordering"):
//      nav_bar ("03", 1, "02", 0)
//      break;
    case ("Other Products - Contact Us"):
      nav_bar ("03", 1, "03", 0)
      break;
    default:;
  }
}
