// Determine browser type (Netscape 6 or IE 5.5/6.0).

var isIE5 = (navigator.userAgent.indexOf("MSIE 5.5") > 0  |
             navigator.userAgent.indexOf("MSIE 6.0") > 0) ? 1 : 0;
var isNS6 = (navigator.userAgent.indexOf("Gecko")    > 0) ? 1 : 0;

// For IE, adjust menu bar styling.

//Commented because they cause an error in ie5.5
//if (isIE5) {
//  document.styleSheets[document.styleSheets.length - 1].addRule("#menuBar", "padding-top:4px");
//  document.styleSheets[document.styleSheets.length - 1].addRule("#menuBar", "padding-bottom:3px");
//}

// Global variable for tracking the currently active button.

var activeButton = null;

// Capture mouse clicks on the page so any active button can be deactivated.

if (isIE5)
  document.onmousedown = pageMousedown;
if (isNS6)
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var className;

  // If the object clicked on was not a menu button or item, close any active
  // menu.

  if (isIE5)
    className = window.event.srcElement.className;
  if (isNS6)
    className = (event.target.className ?
      event.target.className : event.target.parentNode.className);

  if (className != "menuButton"  && className != "menuItem" &&
      className != "menuItemSep" && activeButton)
    resetButton(activeButton);
}

function buttonClick(button, menuName) {

//if (menuName == 'homeMenu'){document.location='./index.htm';return};
  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.

  if (!button.menu)
    button.menu = document.getElementById(menuName);

  // Reset the currently active button, if any.

  if (activeButton && activeButton != button)
    resetButton(activeButton);

  // Toggle the button's state.

  if (button.isDepressed)
    resetButton(button);
  else
    depressButton(button);

  return false;
}

function buttonMouseover(button, menuName) {

  // If any other button menu is active, deactivate it and activate this one.
  // Note: if this button has no menu, leave the active menu alone.

  if (activeButton && activeButton != button) {
    resetButton(activeButton);
    if (menuName)
      buttonClick(button, menuName);
  }
}

function depressButton(button) {

  // Save current style values so they can be restored later.
  // Only needs to be done once.

  if (!button.oldBackgroundColor) {
    button.oldBackgroundColor = button.style.backgroundColor;
    button.oldBorderBottomColor = button.style.borderBottomColor;
    button.oldBorderRightColor = button.style.borderRightColor;
    button.oldBorderTopColor = button.style.borderTopColor;
    button.oldBorderLeftColor = button.style.borderLeftColor;
    button.oldColor = button.style.color;
    button.oldLeft = button.style.left;
    button.oldPosition = button.style.position;
    button.oldTop = button.style.top;
  }

  // Change style value to make the button looks like it's
  // depressed.

  button.style.backgroundColor = "#0083ab";
  button.style.borderBottomColor = "#0083ab";
  button.style.borderRightColor = "#0083ab";
  button.style.borderTopColor = "#0083ab";
  button.style.borderLeftColor = "#0083ab";
  button.style.color = "#000000";
  button.style.left = "1px";
  button.style.position = "relative";
  button.style.top = "1px";

  // For IE, force first menu item to the width of the parent menu,
  // this causes mouseovers work for all items even when cursor is
  // not over the link text.

  if (isIE5 && !button.menu.firstChild.style.width)
    button.menu.firstChild.style.width =
      button.menu.offsetWidth + "px";

  // Position the associated drop down menu under the button and
  // show it. Note that the position must be adjusted according to
  // browser, styling and positioning.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  if (isIE5)
    y += 2;
  if (isNS6) {
    x--;
    y--;
  }
  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  // Set button state and let the world know which button is
  // active.

  button.isDepressed = true;
  activeButton = button;
}

function resetButton(button) {

  // Restore the button's style settings.

  button.style.backgroundColor = button.oldBackgroundColor;
  button.style.borderBottomColor = button.oldBorderBottomColor;
  button.style.borderRightColor = button.oldBorderRightColor;
  button.style.borderTopColor = button.oldBorderTopColor;
  button.style.borderLeftColor = button.oldBorderLeftColor;
  button.style.color = button.oldColor;
  button.style.left = button.oldLeft;
  button.style.position = button.oldPosition;
  button.style.top = button.oldTop;

  // Hide the button's menu.

  if (button.menu)
    button.menu.style.visibility = "hidden";

  // Set button state and clear active menu global.

  button.isDepressed = false;
  activeButton = null;
}

function getPageOffsetLeft(el) {

  // Return the true x coordinate of an element relative to the page.

  return el.offsetLeft + (el.offsetParent ? getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {

  // Return the true y coordinate of an element relative to the page.

  return el.offsetTop + (el.offsetParent ? getPageOffsetTop(el.offsetParent) : 0);
}

function WriteNS6Nav(){

	document.write("	<div id='menuBar'	>");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'AboutTKCMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'AboutTKCMenu');\"	");
	document.write("	>About TKC</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'ServicesMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'ServicesMenu');\"	");
	document.write("	>Services</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'ProjectsMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'ProjectsMenu');\"	");
	document.write("	>Projects</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'InvestorRelationsMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'InvestorRelationsMenu');\"	");
	document.write("	>Investor Relations</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'TKCNewsMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'TKCNewsMenu');\"	");
	document.write("	>TKC News</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'AffiliationsMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'AffiliationsMenu');\"	");
	document.write("	>TKC Entities</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'CareerOpportunitiesMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'CareerOpportunitiesMenu');\"	");
	document.write("	>Career Opportunities</a	");
	document.write("	>	");

	document.write("	<a class='menuButton'	");
	document.write("		href=''	");
	document.write("		onclick=\"return buttonClick(this, 'ContactUsMenu');\"	");
	document.write("		onmouseover=\"buttonMouseover(this, 'ContactUsMenu');\"	");
	document.write("	>Contact US</a	");
	document.write("	>	");

	document.write("	</div>	");






	document.write("	<div id='AboutTKCMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./abouttkc.htm'>Corporate Profile</a>	");
	document.write("	<a class='menuItem' href='./ceomessage.htm'>CEO&#039;s Message</a>	");

	document.write("	</div>	");

	document.write("	<div id='ServicesMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./civilengineering.htm'>Civil Engineering</a>	");
	document.write("	<a class='menuItem' href='./landplanning.htm'>Land Planning</a>	");
	document.write("	<a class='menuItem' href='./environmental.htm'>Environmental</a>	");
	document.write("	<a class='menuItem' href='./culturalresources.htm'>Cultural Resources</a>	");
	document.write("	<a class='menuItem' href='./waterresources.htm'>Water Resources</a>	");
	document.write("	<a class='menuItem' href='./surveyingmapping.htm'>Surveying &amp; Mapping</a>	");
	document.write("	<a class='menuItem' href='./industrialmanagement.htm'>Industrial</a>	");
	document.write("	<a class='menuItem' href='./landscapearct.htm'>Landscape Architecture</a>	");
	document.write("	<a class='menuItem' href='./constructionmgt.htm'>Construction Management</a>	");

	document.write("	</div>	");

	document.write("	<div id='ProjectsMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./projects.htm'>Residential</a>	");
	document.write("	<a class='menuItem' href='./commercial.htm'>Commercial</a>	");
	document.write("	<a class='menuItem' href='./recreational.htm'>Recreational</a>	");
	document.write("	<a class='menuItem' href='./telecomm.htm'>Communications</a>	");
	document.write("	<a class='menuItem' href='./transportation.htm'>Transportation</a>	");
	document.write("	<a class='menuItem' href='./waterre.htm'>Water Resources</a>	");
	document.write("	<a class='menuItem' href='./facilities.htm'>Facilities</a>	");
	document.write("	<a class='menuItem' href='./energy.htm'>Energy</a>	");

	document.write("	</div>	");

	document.write("	<div id='InvestorRelationsMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./corpprofile.htm'>Corporate Profile</a>	");
	document.write("	<a class='menuItem' href='./letter.htm'>Letter to Shareholders</a>	");
	document.write("	<a class='menuItem' href='./directorbios.htm'>Directors Bios</a>	");
	document.write("	<a class='menuItem' href='./clients.htm'>Clients</a>	");
	document.write("	<a class='menuItem' href='./financialinfo.htm'>Financial Info</a>	");
	document.write("	<a class='menuItem' href='./investorcontacts.htm'>Inverstor Contacts</a>	");
	document.write("	<a class='menuItem' href='http://www.freeedgar.com/' target='new'>SEC Filings</a>	");
	document.write("	<a class='menuItem' href='http://finance.yahoo.com/q?s=TKCI&d=t' target='new'>Stock Quote</a>	");
	document.write("	<a class='menuItem' href='./informationrequest.htm'>Information Requests</a>	");
	document.write("	<a class='menuItem' href='./Financial_Conf_Call.htm'>Financial Conference Calls</a>	");	
	
	document.write("	</div>	");

	document.write("	<div id='TKCNewsMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./tknews.asp'>TKC News</a>	");

	document.write("	</div>	");

	document.write("	<div id='AffiliationsMenu' class='menu'>	");
	//document.write("	<a class='menuItem' href='./tkc_communications.htm'>TKC Communications</a>	");
	document.write("	<a class='menuItem' href='/thompson.htm'>Thompson - Hysell</a>	");
	document.write("	<a class='menuItem' href='/tetterner.htm'>Tettemer &#38; Assoc.</a>	");
	document.write("	<a class='menuItem' href='/pec/pec_aboutpec.htm'>Pacific Engineering</a>	");
	document.write("	<a class='menuItem' href='/crosby.htm'>Crosby Mead Benton</a>	");
	document.write("	<a class='menuItem' href='/es1.htm'>ESI</a>	");
	document.write("	<a class='menuItem' href='/es2.htm'>ESII</a>	");
	document.write("	<a class='menuItem' href='/ayers_aboutus.htm'>Universal Energy, Inc</a>	");
	document.write("	<a class='menuItem' href='/es2.htm'>ALNM</a>	");
	document.write("	</div>	");

	document.write("	<div id='CareerOpportunitiesMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./eop.htm'>Career Opportunities</a>	");
	document.write("	<a class='menuItem' href='./eop.asp'>Search for Jobs</a>	");
	document.write("	<a class='menuItem' href='./submitresume.asp'>Submit Resume</a>	");

	document.write("	</div>	");

	document.write("	<div id='ContactUsMenu' class='menu'>	");
	document.write("	<a class='menuItem' href='./contactus.htm'>Contact Us</a>	");

	document.write("	</div>	");





}
