// tpmenu.js
// Copyright Tired Parents Web Design
// August 29, 2002
//
// Notes:  
//
//////////////////////////////////////////////////////////////////////////



var BaseImage = 'TPCicon.gif';
var Open = true;
var Closed = false;

function BuildMenu(Page) {


// This is the code that set's the base image for the page

  document.write('<TABLE>');
  document.write('<TR><TH><form name = "clock"><input type="text" name="clockfield"></form></TH></TR>\n');
  document.write('<TR><TH><IMG SRC="./images/');
  document.write(BaseImage);
  document.write('" alt="Tired Parents LOGO"><BR><BR></TH></TR>');


// The next section prints out the various menu items



// The following is a typical code block to add one item to the menu.
// The block checks if the calling page is the block page, and makes
// a call to AddMenu() for the page with an Open or Closed state,
// providing the item name to be displayed in the menu, the image
// to be displayed during a mouseover event, and the link destination page. 
// Copy/paste as needed.
  if (Page == "index.html")
  { AddMenu(Open, "HOME", "home.gif", "index.html"); }
  else { AddMenu(Closed, "HOME", "home.gif", "index.html"); }
// End Menu Item code block

  if (Page == "services.html")
  { AddMenu(Open, "SERVICES", "service.gif", "services.html"); }
  else { AddMenu(Closed, "SERVICES", "service.gif", "services.html"); }

  if (Page == "prices.html")
  { AddMenu(Open, "PRICES", "prices.gif", "prices.html"); }
  else { AddMenu(Closed, "PRICES", "prices.gif", "prices.html"); }

  if (Page == "order.html")
  { AddMenu(Open, "ORDER", "order.gif", "order.html"); }
  else { AddMenu(Closed, "ORDER", "order.gif", "order.html"); }

  if (Page == "about.html")
  { AddMenu(Open, "ABOUT US", "about.gif", "about.html"); }
  else { AddMenu(Closed, "ABOUT US", "about.gif", "about.html"); }

  document.write('       <TR><TH><BR><HR><BR><DIV Class="small">\n');
  document.write('        <A Class="menu" HREF="http://www.cafeshops.com/tiredparents">\n');
  document.write('         <IMG SRC="images/CafePress.gif" alt="Buy Tired Parents Stuff" border="0"></A><BR><BR>')
  document.write('        <A Class="menu" HREF="http://www.cafeshops.com/tiredparents">Buy Tired Parents Merchandise</A>\n');
  document.write('       <DIV Class="small"></TH></TR>\n');

  document.write('</TABLE>');
}


// AddMenu() accepts the menu item state, the menu display name, and the 
// mouseover image, and outputs the correct HTML for that menu item.

function AddMenu(Status, DisplayName, Image, Destination) {
  document.write('<TR><TD><DIV Class="menu">');
  if(Status) {
    document.write('<IMG SRC="./images/thisArrow.gif"> ');
  }
  else
  {
    document.write('<IMG SRC="./images/noArrow.gif"> ');
  }
  document.write('<A class="menu" HREF="');

  document.write(Destination);
  document.write('" onMouseOver="document.images[0].src=\'images/');
  document.write(Image);
  document.write('\';"\n');
  document.write('onMouseOut="document.images[0].src=\'images/');
  document.write(BaseImage);
  document.write('\';">');
  document.write(DisplayName);
  document.write('</A>\n');
  document.write('</DIV></TD></TR>');
}


function Footer() {
  document.write('<CENTER><DIV class="menu">\n');
  document.write('<A class="menu" HREF="index.html">HOME</A> |\n');
  document.write('<A class="menu" HREF="services.html">SERVICES</A> |\n');
  document.write('<A class="menu" HREF="prices.html">PRICES</A> |\n');
  document.write('<A class="menu" HREF="order.html">ORDER |</A>\n');
  document.write('<A class="menu" HREF="about.html">ABOUT US</A>\n');
  document.write('<DIV class="Byline">Copyright © 2002, <A class="byline" HREF="http://www.tiredparents.com" Target=_top>Tired Parents Web Designs</A>.</DIV>\n');
  document.write('</DIV></CENTER>\n');
}




function UpdateClock() {

	var CurrentTime = new Date();
	var hours = CurrentTime.getHours();
	if (hours >= 12) {
          ampm = "PM";
	  hours = hours - 12;
        } else {
          ampm = "AM";
        }
        if (hours == 0) { hours = hours + 12 }

	var min = CurrentTime.getMinutes();
        if (min < 10) { dmin = "0" + min; } else { dmin = min; }	

	var sec = CurrentTime.getSeconds();
        if (sec < 10) { dsec = "0" + sec; } else { dsec = sec; }	

	var timeString = " Time:  " + hours + ":" + dmin + ":" + dsec + " " + ampm;
	document.clock.clockfield.value = timeString;

	setTimeout("UpdateClock()", "1000");

}

