window.onerror = null
window.onresize = startMenus

var strLastMenu = "divAbout"

function showMenu(strMenu) {
	
	var objLayer

	hideMenu(strLastMenu)

	if (document.all) {
		objLayer = document.all[strMenu]
	}
	else if (document.getElementById) {
		objLayer = document.getElementById(strMenu)
	}
	else if (document.layers) {
		objLayer = getLayer(strMenu)
	}
	
	// show
	if (document.all || document.getElementById) {
		//if (document.all)
			objLayer.style.visibility = "visible"
			
	}
	else if (document.layers) {
		
		if (parseFloat(navigator.appVersion) >= 4.08) {
			// move to position relative to image
			/*objImage = getImage("l_" + strMenu.substring(3, strMenu.length))
			intTop = getImagePageTop(objImage)
			intLeft = getImagePageLeft(objImage)
			objLayer.top = intTop + objImage.height
			objLayer.left = intLeft + 8*/
			
			// show
			objLayer.visibility = "show"
		}
	}
	
	strLastMenu = strMenu
}



function hideMenu(strMenu) {
	var objLayer
	var isIn = false
	var i = 0
		//alert(navigator.appVersion);
	if (strMenu == "")
		strMenu = strLastMenu

	if (document.all) {
		objLayer = document.all[strMenu]
	}
	else if (document.getElementById) {
		objLayer = document.getElementById(strMenu)
	}
	else if (document.layers) {
		objLayer = getLayer(strMenu)
	}
	
	// hide
	if (document.all) {
		while (!isIn && i < document.all[strMenu].all.length) {
			if (window.event.toElement == document.all[strMenu].all[i])
				isIn = true
			i++
		}
		if (!isIn) {
			document.all[strMenu].style.visibility = "hidden"
			// add code to swap image
			parseImgName(strMenu)
		}
	}
	else if (document.getElementById) {
		objLayer.style.visibility = "hidden"
		// add code to swap image
		parseImgName(strMenu)
	}
	else if (document.layers) {
		if (parseFloat(navigator.appVersion) >= 4.08) {
			objLayer.visibility = "hide"
			// add code to swap image
			parseImgName(strMenu)
		}
	}
}



function parseImgName(strName) {
	var strImgName = strName
	strImgName = strImgName.substring(3, strImgName.length)
	
	change("l_" + strImgName, "/img/l_" + strImgName + ".gif")
}



function startMenus() {
	// position menu hiders for netscape 4
	if (document.layers) {
		if (parseFloat(navigator.appVersion) >= 4.08) {
			var objImage = getImage('l_about')
			var intTop = getImagePageTop(objImage)
			var intLeft = getImagePageLeft(objImage)
			
			document.leftHide.left = intLeft - 10
			document.leftHide.top = intTop
			
			document.topHide.left = intLeft - 10
			document.topHide.top = intTop - 10
			
			document.rightHide.left = intLeft + 414
			document.rightHide.top = intTop
		}
	}
	if (document.getElementById && navigator.appName == "Netscape") {
		document.onclick = handler
	}
}
function handler(e) {
	var objElement
	var blnIsIn = false
	
	objElement = e.target
	
	while(objElement.parentNode && !blnIsIn) {
		if (objElement.id != null && objElement.id != "" && objElement.id.substring(0, 3) == "div")
			blnIsIn = true
		objElement = objElement.parentNode
	}
	
	if (blnIsIn != true)
		hideMenu('')
}

if (document.images) {
l_home_i = new Image(); l_home_i.src = "img/l_home.gif";
lo_home_i = new Image(); lo_home_i.src = "img/lo_home.gif";
l_about_i = new Image(); l_about_i.src = "img/l_about.gif";
lo_about_i = new Image(); lo_about_i.src = "img/lo_about.gif";
l_culture_i = new Image(); l_culture_i.src = "img/l_culture.gif";
lo_culture_i = new Image(); lo_culture_i.src = "img/lo_culture.gif";
l_services_i = new Image(); l_services_i.src = "img/l_services.gif";
lo_services_i = new Image(); lo_services_i.src = "img/lo_services.gif";
l_activities_i = new Image(); l_activities_i.src = "img/l_activities.gif";
lo_activities_i = new Image(); lo_activities_i.src = "img/lo_activities.gif";
l_careers_i = new Image(); l_careers_i.src = "img/l_careers.gif";
lo_careers_i = new Image(); lo_careers_i.src = "img/lo_careers.gif";
l_dotnet_i = new Image(); l_dotnet_i.src ="img/l_claritydotnet.gif";
lo_dotnet_i = new Image(); l_dotnet_i.src = "img/lo_claritydotnet.gif";

}

/* Function that swaps images. */

function change(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

/* Functions that track and set toggle group button states. */

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}






/******************************************************************************
* dhtmllib.js                                                                 *
*                                                                             *
* Copyright 1999 by Mike Hall.                                                *
* Web address: http://www.brainjar.com                                        *
* Last update: February 26, 2000.                                             *
*                                                                             *
* Provides basic functions for DHTML positioned elements which will work on   *
* both Netscape Communicator and Internet Explorer browsers (version 4.0 and  *
* up).                                                                        *
******************************************************************************/

// Determine browser.

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;


//-----------------------------------------------------------------------------
// Layer utilities.
//-----------------------------------------------------------------------------

function getLayer(name) {

  if (document.layers)
    return findLayer(name, document);
  if (isMinIE4)
    return eval('document.all.' + name);
  return null;
}

function findLayer(name, doc) {

  var i, layer;

  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == name)
      return layer;
    if (layer.document.layers.length > 0)
      if ((layer = findLayer(name, layer.document)) != null)
        return layer;
  }
  return null;
}

//-----------------------------------------------------------------------------
// Image utilities.
//-----------------------------------------------------------------------------

function getImage(name) {

  if (document.layers) {
    return findImage(name, document);
  }
  if (isMinIE4)
    return eval('document.all.' + name);
  return null;
}

function findImage(name, doc) {

  var i, img;

  for (i = 0; i < doc.images.length; i++)
    if (doc.images[i].name == name)
      return doc.images[i];
  for (i = 0; i < doc.layers.length; i++)
    if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  return null;
}

function getImagePageLeft(img) {

  var x, obj;

  if (document.layers) {
    if (img.container != null)
      return img.container.pageX + img.x;
    else
      return img.x;
  }
  if (isMinIE4) {
    x = 0;
    obj = img;
    while (obj.offsetParent != null) {
      x += obj.offsetLeft;
      obj = obj.offsetParent;
    }
    x += obj.offsetLeft;
    return x;
  }
  return -1;
}

function getImagePageTop(img) {

  var y, obj;

  if (document.layers) {
    if (img.container != null)
      return img.container.pageY + img.y;
    else
      return img.y;
  }
  if (isMinIE4) {
    y = 0;
    obj = img;
    while (obj.offsetParent != null) {
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
    y += obj.offsetTop;
    return y;
  }
  return -1;
}