setTimeout ("changePage()", 0);
function changePage()
{
	if (self.parent.frames.length != 0)
	self.parent.location= "index.html";
}

function buildHeader (fromPage) {
	// Home page is at the root.  All the rest are in subdirectories.
  if (fromPage == "home")
  { 
    imagePath = "../images/";
    rootPath = "../main/";
  }
  else
  { 
    imagePath = "../images/";
    rootPath = "../main/";
  }

  document.write("<div align=center><center>");
	document.write("<table border=0 width=600 cellpadding=6>");
  // MRPC.gif is the line drawing of the Manchester RP Church
	document.write("<tr><td align=center colspan=1>	<img border=0 src=\"" + imagePath + "MRPC.gif\" width=187 height=110 align=left alt=\"Picture of Manchester Reformed Presbyterian Church\"></TD>");
  // MHRP.gif is the MANCHESTER RPC text.
  document.write("   <td align=left><img border=0 src=\"" + imagePath + "MHRP.gif\" width=184 height=37 alt=\"Manchester Reformed Presbyterian Church\"><br>");
  document.write("      <b><font class=MyTextFormat>204 Manchester Hill Road<br>New Kensington, PA&nbsp; 15068<br>Pastor Vince Scavo<br>724-339-1551</font></b></td>");
  document.write("   <td width=20% valign=bottom><p align=right><img border=0 src=\"" + imagePath + "banner.gif\" width=81 height=137 alt=\"Reformed Presbyterian Church Banner -- For Christ's Crown and Covenant\"></td></tr></table>");

	document.write("<table border=0 width=100% cellpadding=6>");
  document.write("<tr><td colspan=3><hr size=5 color=#FFCC00></td></tr>");
	document.write("<tr><td valign=top align=left width=20%>");
	document.write("	<!-- Menu on the side --> ");
  document.write("	<font class=MyTextFormat><b>");
  writeLinks(fromPage, rootPath, "h");
  document.write("</b></font>");
	document.write("</td><td colspan=2 valign=top width=80%>");
  // The client area of the page is in this table cell.
  document.write("<p>");
}

function buildFooter(fromPage) {
	// Home page is no longer at the root.  All the rest are in subdirectories.
  if (fromPage == "home")
  { 
    rootPath = "../main/";
  }
  else
  { 
    rootPath = "../main/";
  }

  document.write("<p></td></tr>");
  document.write("<tr><td colspan=3><hr size=5 color=#FFCC00></td></tr>");
  document.write("<tr><td colspan=3 align=center>");
  document.write("	<font class=MyTextFormat><b>");
  writeLinks(fromPage, rootPath, "f");
  document.write("<a href=\"#TOP\">Top</a>");
  document.write("<p align=center>manchesterrpchurch.org<br>");
  document.write("The Online home of the Manchester Reformed Presbyterian Church<br>");
  document.write("204 Manchester Hill Road<br>New Kensington, PA&nbsp; 15068<br>Pastor Vince Scavo<br>724-339-1551<br>");
  document.write("Please report all site problems to <a href='mailto:info@manchesterrpchurch.org'>info@manchesterrpchurch.org</a><br>");
  document.write("</b></font></td></tr></table></center></dir>");
}

function writeLinks(fromPage, rootPath, headerOrFooter)
{
  // This will suppress the hyperlink from each page to itself.
  // It also handles the difference between the header and footer.
  if (headerOrFooter == "h")
  {
    // Header has paragraph on start of line and nothing on end of line.
    lineStart = "<p>";
    lineEnd = "";
  } else
  {
    // Footer has nothing on start of line and Pipe on end of line.
    lineStart = "";
    lineEnd = " | ";
  }

  if (fromPage == "home")
  {
    document.write(lineStart + "<font color=black>Home</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "home.shtml\">Home</a>" + lineEnd);
  }
  
  if (fromPage == "location")
  {
    document.write(lineStart + "<font color=black>Location</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "location.html\">Location</a>" + lineEnd);
  }

  if (fromPage == "bulletin")
  {
    document.write(lineStart + "<font color=black>Bulletin</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "bulletin.html\">Bulletin</a>" + lineEnd);
  }

  document.write(lineStart + "<a href=\"http://feeds.feedburner.com/mrpc\">Bulletin-Sermon RSS Feed</a>" + lineEnd);

  if (fromPage == "services")
  {
    document.write(lineStart + "<font color=black>Services</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "services.html\">Services</a>" + lineEnd);
  }

  if (fromPage == "contact")
  {
    document.write(lineStart + "<font color=black>Contact</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "contact.html\">Contact</a>" + lineEnd);
  }

  if (fromPage == "calendar")
  {
    document.write(lineStart + "<font color=black>Calendar</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "calendar.html\">Calendar</a>" + lineEnd);
  }

  if (fromPage == "beliefs")
  {
    document.write(lineStart + "<font color=black>Our Beliefs</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "beliefs.html\">Our Beliefs</a>" + lineEnd);
  }

  if (fromPage == "resources")
  {
    document.write(lineStart + "<font color=black>Bible Study Helps</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "resources.html\">Bible Study Helps</a>" + lineEnd);
  }

  if (fromPage == "links")
  {
    document.write(lineStart + "<font color=black>Links</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "links.html\">Links</a>" + lineEnd);
  }
  if (fromPage == "library")
  {
    document.write(lineStart + "<font color=black>Library</font>" + lineEnd);
  } else
  {
    document.write(lineStart + "<a href=\"" + rootPath + "library.html\">Library</a>" + lineEnd);
  }
}
