/****************************/
/*** NAVIGATION FUNCTIONS****/
/****************************/

/*	PURPOSE:  Swap an image onMouseOver or onMouseOut.
	imgName: NAME attribute of an IMG tag to be swapped.
	sSrc: string path to the image to become the image source.
*/
function rollImage(imgName, sSrc)
{
	if(document.images){
		var objImg = eval(document.images[imgName])
		objImg.src = sSrc;
	}
}

/*
	PURPOSE:	Finds a the HTML object within the DOM with
				the name provided.
				theObj: The Name/ID of the HTML tag to find in the DOM.
				theDoc: disregard this param and don't use.
				example: findObj('myDiv');
*/
function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

/*
	PURPOSE:	Shows or hides a layer (SPAN or DIV) in the html page.
	Accepts a variable number of arguments, in triplets as follows:
	arg 1: name of a layer
	arg 2: ignored (for backward compatibility)
	arg 3: 'hide' or 'show'
	repeat...
	Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
*/
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}
/*
	PURPOSE:	Do rollover events and maintain current nav item for global navigation.
	globalNavName: the name of the global navigation item.
	language: the language code of the user.
	isCurrent: whether or not the rollover is for a currently selected item.
	Example: globalNav_over('ourCompany', 'en-us', false);
*/
function globalNav_over(globalNavName, language, isCurrent){
	// rollover state
	if(globalNavName != "language" && !isCurrent){
		rollImage("img" + globalNavName, "/" + language + "/images/" + globalNavName + "_on.gif");
	}
}
function globalNav_out(globalNavName, language, isCurrent){
	// rollout state
	if(globalNavName != "language" && !isCurrent){
		rollImage("img" + globalNavName, "/" + language + "/images/" + globalNavName + "_off.gif");	
	}
}

/*
	PURPOSE:	Sets the title of a html page.
	sTitle: The text to be assigned as the page's title.ently selected item.
	Example: setPageTitle('a lovely page');
*/
function setPageTitle(sTitle){
	document.title = sTitle;
}
