<!--
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}
function buildTopNav() {
  document.write("<div>");
  document.write("<ul id='sddm'>");
  
  document.write("<li><a href='index.html'>Home</a>");
  document.write("</li>");
  
  document.write("<li><a href='#' onmouseover=\"mopen('m1')\" onmouseout='mclosetime()'>History</a>");
  document.write("<div id='m1' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='history.html'>Troop History</a>");
  document.write("<a href='photos.html'>Photographs</a>");
  document.write("<a href='troop140eagles.html'>Eagle Scouts</a>");
  document.write("</div>");
  document.write("</li>");

  document.write("<li><a href='#' onmouseover=\"mopen('m2')\" onmouseout=\"mclosetime()\">Activities</a>");
  document.write("<div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='calendar.php'>Calendar</a>");
  document.write("<a href='meetings.html'>Meetings</a>");
  document.write("<a href='adulttraining.html'>Adult Training</a>");
  document.write("<a href='fundraisers.html'>Fundraisers</a>");
  document.write("</div>");
  document.write("</li>");

  document.write("<li><a href='#' onmouseover=\"mopen('m3')\" onmouseout=\"mclosetime()\">News</a>");
  document.write("<div id='m3' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='forms.html'>Forms &amp; Docs</a>");
  document.write("<a href='faq.html'>FAQs</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("<div style='clear:both'></div>");

  document.write("<li><a href='#' onmouseover=\"mopen('m4')\" onmouseout=\"mclosetime()\">Advancement</a>");
  document.write("<div id='m4' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='rankreqs.html'>Rank Requirements</a>");
  document.write("<a href='rankreqsignoff.html'>Requirements Signoff</a>");
  document.write("<a href='meritbadges.html'>Merit Badges</a>");
  document.write("<a href='eaglescout.html'>Eagle Scout</a>");
  document.write("<a href='oa.html'>Order of Arrow</a>");
  document.write("<a href='patrolmethod.html'>Patrol Method</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("<div style='clear:both'></div>");

  document.write("<li><a href='links.html'>Helpful Links</a></li>");
  document.write("<li><a href='forms.html'>Forms &amp; Docs</a></li>");
  document.write("<li><a href='emailus.php'>Contact Us</a></li>");
  document.write("<li><a href='http://www.pyeatt.org/TroopApp/index.php'>TroopApp</a></li>");
  
  document.write("</div>");

}
function getQuote() {
  var quoteList = new Array();
  quoteList[0] = "We never fail when we try to do our duty, we always fail when we neglect to do it.";
  quoteList[1] = "The spirit is there in every boy; it has to be discovered and brought to light.";
  quoteList[2] = "The Scoutmaster teaches boys to play the game by doing so himself.";
  quoteList[3] = "The most worth-while thing is to try to put happiness into the lives of others.";
  quoteList[4] = "If you make listening and observation your occupation you will gain much more than you can by talk.";
  quoteList[5] = "To get a hold on boys you must be their friend.";
  quoteList[6] = "The most important object in Boy Scout training is to educate, not instruct.";
  quoteList[7] = "A boy carries out suggestions more wholeheartedly when he understands their aim.";
  quoteList[8] = "The sport in Scouting is to find the good in every boy and develop it.";
  quoteList[9] = "There is no teaching to compare with example.";
  
  var dt = new Date();
  var secs = dt.getSeconds();
  return quoteList[secs % 10] + " -- Lord Baden-Powell";
}

function addQuote() {
  var str = getQuote();
  var ele = document.getElementById("quoteContainer");
  ele.innerHTML = str;
  return;
}
function NavLink(urlLink, text) {
  this.link = urlLink;
  this.text = text;
  this.getLinkElement = function (id, cls) {
    var ele = document.createElement("a");
	ele.id = id;
	ele.setAttribute("class", cls);	ele.setAttribute("className", cls);
	ele.href = this.link;
	ele.innerHTML = this.text;
	return ele;
  }
}
function popupWindow(theURL, title, width, height) {
	if (theURL !== "") {
		var specs = "scrollbars=yes,width=" + width + ",height=" + height + ",top=50,left=332,resizable=yes";
		var win = open("", "", specs);
		win.name = title;
		win.location.replace(theURL);
		win.focus();
	}
}

function onMouseOverNav(ele) {
  if (ele != null) {
    var chgEle = ele.target;
    chgEle.className = "leftNavButtonHover";
  } else {
    this.className = "leftNavButtonHover";
  }
  return true;
}
function onMouseOutNav(ele) {
  if (ele != null) {
    var chgEle = ele.target;
    chgEle.className = "leftNavButton";
  } else {
    this.className = "leftNavButton";
  }
  return true;
}

function buildBottomBanner() {
  var span1 = document.createElement("span");
  span1.innerHTML = "Chartered by ";
  var a1 = document.createElement("a");
  a1.href = "http://www.stlukes-elca.org";
  a1.innerHTML = "St Luke's Lutheran Church";
  var br = document.createElement("br");
  
  var container = document.getElementById("bottomContainer");
  container.appendChild(span1);
  container.appendChild(a1);
  container.appendChild(br);
  var includeCounter = false;
  if (document.location.pathname == "/index.html") {
    includeCounter = true;
  }
  if (includeCounter) {
	  var span2 = document.createElement("span");
	  span2.innerHTML = "You are visitor number ";
	  var img = document.createElement("img");
	  img.src = "/cgi.share/counter.cgi?id=www@www.bsatroop140.com&amp;pageid=homepage";
	  var span3 = document.createElement("span");
	  span3.innerHTML = " to our website.";
  }
	  var p = document.createElement("p");
	  var a2 = document.createElement("a");
	  a2.href = "http://www.tdstelecom.com/index.asp";
	  var img2 = document.createElement("img");
	  img2.src = "images/tdslogo.gif"; img2.alt = "TDS"; img2.border = 0;
	    
      a2.appendChild(img2);
      p.appendChild(a2);
	  if (includeCounter) {
	      container.appendChild(span2);
	      container.appendChild(img);
	      container.appendChild(span3);
	  }
      container.appendChild(p);

}
function buildTopBanner() {
  var containerEle = document.getElementById("topContainer");
  var tableEle = document.createElement("table");

  tableEle.border = 0;  
  tableEle.cellpadding = 4; 
  tableEle.cellspacing = 4;

  var tbodyEle = document.createElement("tbody");
  var trEle = document.createElement("tr");
  var leftCell = document.createElement("td");

  var imgEle = document.createElement("img");
  imgEle.src = "images/bsa_color_small.gif";
  imgEle.alt = "BSA";
  imgEle.border = 0;
  leftCell.appendChild(imgEle);
  
  trEle.appendChild(leftCell);
 
  var rightCell = document.createElement("td");
  rightCell.setAttribute("class", "topBannerTitle"); rightCell.setAttribute("className", "topBannerTitle");
  var span1 = document.createElement("span");
  span1.innerHTML = "Boy Scout Troop 140";
  var br = document.createElement("br");
  var span2 = document.createElement("span");
  span2.innerHTML = "Middleton, Wisconsin";
  var quote = document.createElement("div");
  quote.setAttribute("id", "quoteContainer");
  quote.setAttribute("class", "topQuote"); quote.setAttribute("className", "topQuote");
  rightCell.appendChild(span1);
  rightCell.appendChild(br);
  rightCell.appendChild(span2);
  rightCell.appendChild(quote);
  
  trEle.appendChild(leftCell);
  trEle.appendChild(rightCell);
  tbodyEle.appendChild(trEle);
  tableEle.appendChild(tbodyEle);
  containerEle.appendChild(tableEle);


}

function registerOnLoad() {
  buildTopBanner();
  //buildLeftNav();
  buildBottomBanner();
  addQuote();
/*
	var menuEleArray = document.getElementsByTagName("*");
	for (i = 0; i < menuEleArray.length; i++) {
		var ele = menuEleArray[i];
		if (ele.className === "leftNavButton") {
	  	  ele.onmouseover = onMouseOverNav;
		  ele.onmouseout  = onMouseOutNav;
		}
	}
*/
  return;
}
//-->