
if (activeLyr == null)
{
 var activeLyr = "";
 var activeImg01 = "";
 var activeImg02 = "";
}


var NS4 = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var IE4 = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
if (IE4) {
	var MAC = (navigator.platform.lastIndexOf("Mac") > -1);
}

// Function to 'activate' images.
function imgOn(imgName) {
 if (document.images) {
  document[imgName].src = eval(imgName + "on.src");
 }
}

// Function to 'deactivate' images.
function imgOff(imgName) {
 if ((imgName == activeImg01) || (imgName == activeImg02)) {}
 else {
  if (document.images) {
   document[imgName].src = eval(imgName + "off.src");
  }
 }
}
/*
function swap(imgDocID,imgObjName) {
 if (document.images) {
  document.images[imgDocID].src = eval(imgObjName + ".src");
 }
}
*/
/*
function hideLayer(name) {
 var layer = getLayer(name);
 if (document.layers) {
  if (name == activeLyr) {}
  else {
   layer.visibility = "hide";
  }
 }
 else if (document.all) {
  if (name == activeLyr) {}
  else {
   layer.visibility = "hidden";
   }
    }
}
*/

function getLayer(name) {
 // Returns a handle to the named layer.
 if (document.layers)
  return(document.layers[name]);
 else if (document.all) {
  layer = eval('document.all.' + name + '.style');
  return(layer);
 }
 else {
  return(null);
 }
}

function showLayer(name) {
 var layer = getLayer(name);
 if (document.layers) {
  layer.visibility = "show";
 }
 else if (document.all) {
  layer.visibility = "visible";
 }
}

if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
  winW = window.innerWidth;
  winH = window.innerHeight;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
  winW = document.body.offsetWidth;
  winH = document.body.offsetHeight;
 }
}


//off images for top menu
tn01off = new Image();
tn01off.src = "../share/images/g_nav_home.gif";
tn02off = new Image();
tn02off.src = "../share/images/g_nav_about.gif";
tn03off = new Image();
tn03off.src = "../share/images/g_nav_locations.gif";
tn04off = new Image();
tn04off.src = "../share/images/g_nav_investor.gif";
tn05off = new Image();
tn05off.src = "../share/images/g_nav_news.gif";
tn06off = new Image();
tn06off.src = "../share/images/g_nav_careers.gif";

//on images for top menu
/*
tn01on = new Image();
tn01on.src = "../share/images/g_roll_home.gif";
tn02on = new Image();
tn02on.src = "../share/images/g_roll_about.gif";
tn03on = new Image();
tn03on.src = "../share/images/g_roll_locations.gif";
tn04on = new Image();
tn04on.src = "../share/images/g_roll_investor.gif";
tn05on = new Image();
tn05on.src = "../share/images/g_roll_news.gif";
tn06on = new Image();
tn06on.src = "../share/images/g_roll_careers.gif";
*/
tn01on = new Image();
tn01on.src = "../share/images/g_roll_home.gif";
tn02on = new Image();
tn02on.src = "../share/images/g_roll_about.gif";
tn03on = new Image();
tn03on.src = "../share/images/g_roll_locations.gif";
tn04on = new Image();
tn04on.src = "../share/images/g_roll_investor.gif";
tn05on = new Image();
tn05on.src = "../share/images/g_roll_news.gif";
tn06on = new Image();
tn06on.src = "../share/images/g_roll_careers.gif";


var isDHTML = 0; 
var isID = 0; 
var isAll = 0; 
var isLayers = 0;
if(document.getElementById)
{
	isID = 1; isDHTML = 1;
}
else{
	if(document.all) { isAll = 1; isDHTML = 1; }
	else {
		browserVersion = parseInt(navigator.appVersion);
		if((navigator.appName.indexOf('Netscape') != -1) && (browserVersion) == 4)
		{	isLayer = 1;
			isDHTML = 1;
		}
	}
}

function findDom (ObjectId, withStyle)
{
	if(withStyle ==1)
	{
		if(isID)
		{ return(document.getElementById(ObjectId).style); }
		else
		{
			if(isAll)
			{ return(document.all[ObjectId].style); }
			else
			{
				if(isLayers)
				{ return(document.layers[ObjectId]); }
			}
		}
	}
	else
	{
		if(isID)
		{ return(document.getElementById(ObjectId)); }
		else
		{
			if (isAll)
			{ return(document.all[ObjectId]); }
			else
			{
				if(isLayers)
				{ return(document.layers[ObjectId]);}
			}
		}
	}
}

var menuIndex = new Array(6);
menuIndex[0]='Home'; menuIndex[1]='About_Sub'; menuIndex[2]='Location_Sub'; 
menuIndex[3]='Investor_Sub'; menuIndex[4]='News_Sub'; menuIndex[5]='Careers_Sub';

function showMenu(menuId){
	var SubName = menuIndex[menuId];
	var dom = findDom(SubName, 1);
	var imgX;
	switch(menuId)
	{
		case 1:
			imgX = NS4?document["tn02"].x:getAbsPos(document["tn02"],"Left");
			dom.width = 420;
			//alert('imgX =' + imgX);
			break;
		case 2:
			imgX = NS4?document["tn03"].x:getAbsPos(document["tn03"],"Left");
			dom.width = 200;
			break;
		case 3:
			imgX = NS4?document["tn01"].x:getAbsPos(document["tn01"],"Left");
			imgX = imgX + 20;
			dom.width = 550;
			break;
		case 5:
			imgX = NS4?document["tn01"].x:getAbsPos(document["tn01"],"Left");
			imgX = imgX + 380;
			dom.width = 200;
			break;
		default: 
			imgX = NS4?document["tn01"].x:getAbsPos(document["tn01"],"Left");
	}
	var imgY = NS4?document["tn01"].y:getAbsPos(document["tn01"],"Top");
	if(menuId >=0 && menuId < 6)
	{
		dom.visibility = 'visible';
		if (menuId == 3)
		{
			dom.left = imgX;
		}
		else{
			dom.left = imgX+8;
		}
		dom.top = imgY + 22;
		
		for (i=0; i < menuId; i++)
		{
			SubName = menuIndex[i];
			dom = findDom(SubName, 1);
			dom.visibility = 'hidden';
		}
		for (i=5; i > menuId; i--)
		{
			SubName = menuIndex[i];
			dom = findDom(SubName, 1);
			dom.visibility = 'hidden';
		}

	}
}
function hideAllMenu() {
		var SubName;
		for (i=0; i < menuIndex.length; i++)
		{
			SubName = menuIndex[i];
			dom = findDom(SubName, 1);
			dom.visibility = 'hidden';
		}
}
function getAbsPos(element,position) {
 iPos = 0;
 while (element != null) {
  iPos += element["offset" + position];
  element = element.offsetParent;
  //alert(element + " " + iPos);
 }
 return iPos;
}

function getLeftPos(element){
	var leftPos;
	leftPos = NS4?document["tn02"].x:getAbsPos(document["tn02"],"Left");
	alert("left postion : " + leftPos);
	return leftPos;
}

function getBottomPos(element){
	var bottomPos;
	bottomPos = NS4?document["tn02"].y:getAbsPos(document["tn02"],"Top");
	bottomPos +=22;
	alert("bottom postion : " + bottomPos);
	return bottomPos;
}

function DL_GetElementLeft(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner

   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nLeftPos = eElement.offsetLeft;       // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy
      if(DL_bIE)                             // if browser is IE, then...
      {
         if(eParElement.tagName == "TD")     // if parent a table cell, then...
         {
            nLeftPos += eParElement.clientLeft; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nLeftPos += 1;             // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nLeftPos += nParBorder;       // append the border width to counter
            }
         }
      }

      nLeftPos += eParElement.offsetLeft;    // append left offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nLeftPos;                          // return the number calculated
}

function DL_GetElementTop(eElement)
{
   if (!eElement && this)                    // if argument is invalid
   {                                         // (not specified, is null or is 0)
      eElement = this;                       // and function is a method
   }                                         // identify the element as the method owner

   var DL_bIE = document.all ? true : false; // initialize var to identify IE

   var nTopPos = eElement.offsetTop;         // initialize var to store calculations
   var eParElement = eElement.offsetParent;  // identify first offset parent element

   while (eParElement != null)
   {                                         // move up through element hierarchy
      if(DL_bIE)                             // if browser is IE, then...
      {
         if(eParElement.tagName == "TD")     // if parent a table cell, then...
         {
            nTopPos += eParElement.clientTop; // append cell border width to calcs
         }
      }
      else                                   // if browser is Gecko, then...
      {
         if(eParElement.tagName == "TABLE")  // if parent is a table, then...
         {                                   // get its border as a number
            var nParBorder = parseInt(eParElement.border);
            if(isNaN(nParBorder))            // if no valid border attribute, then...
            {                                // check the table's frame attribute
               var nParFrame = eParElement.getAttribute('frame');
               if(nParFrame != null)         // if frame has ANY value, then...
               {
                  nTopPos += 1;              // append one pixel to counter
               }
            }
            else if(nParBorder > 0)          // if a border width is specified, then...
            {
               nTopPos += nParBorder;        // append the border width to counter
            }
         }
      }

      nTopPos += eParElement.offsetTop;      // append top offset of parent
      eParElement = eParElement.offsetParent; // and move up the element hierarchy
   }                                         // until no more offset parents exist
   return nTopPos;                           // return the number calculated
}
