


/* * * * * * * * popup window functions * * * * * * * * */

function popWin (url, windowName, width, height) {
	var attr = 'width=' + width + ',height=' + height;
	var wName = (windowName) ? windowName : 'XPop';
	window.open(url,wName,attr);
}





/* * * * * * * * addHoverMethod functions * * * * * * * *

   Internet Explorer (through version 6, at least) recognizes the 
   CSS2 'hover' state only for anchor elements, preventing the use
   of the :hover pseudoclass for other elements.
   
   These functions add a method to one or more elements that applies
   a class of 'hover' to the element(s) on mouseover. The purpose is 
   to mirror the behavior of the 'hover' state for the specified 
   element(s). To take advantage of this, for each :hover reference
   in the CSS rules, an application should also be included for the
   .hover class. 
   
   For example, if a rule needs to be applied to list items (<li>) 
   when they are moused over, the method should be added to the 
   particular items (see instructions below) and the stylesheet 
   should include both li:hover and li.hover as shown:

     li:hover, li.hover {...}

 */


/* adds hover methods to specified element object. Returns false if
   the element is null.
 */
function addHoverMethod(el) {
	if(el==null) return false;
	el.onmouseover=function() {
		this.className+=" hover";
	}
	el.onmouseout=function() {
		this.className=this.className.replace(new RegExp(" hover\\b"), "");
	}
	return true;
}


/* adds hover methods to one or more elements with specified ids.
   Returns false if any elements aren't found.
 */
function addHoverById(elid) {
//	return addHoverMethod(document.getElementById(elid));
	var ahStatus = false;
	var ids = addHoverById.arguments;
	for (var i=0; i<ids.length; i++) {
		ahStatus = addHoverMethod(document.getElementById(ids[i]));
	}
	return ahStatus;
}


/* adds methods to all elements of a given type within a container with
   the specified id. Returns false if no matching elements are found.
      cid = the id assigned to the enclosing container element.
   	  tag = the type of element
   example:
      addHoverMethodByContainer('NavMenu', 'LI');
   CSS:
      #NavMenu li:hover, #NavMenu li.hover {...}
 */
function addHoverMethodByContainer(cid,tag) {
	var ahStatus = false;
	return ahStatus;
}



/* end addHoverMethod functions */




/* * * * * * * * Embedded Menus formatting function * * * * * * * *

   This function is called only by pages using embedded dynamic 
   navigation menus.

   For Internet Explorer, it calls the addHoverMethod function for 
   list items within the navigation list.

 */

function XMenusFormat() {
	if(navigator.userAgent.indexOf('MSIE') < 0) return;
	var list = [];
	if(document.getElementById("XFlyoutMenu")) list = document.getElementById("XFlyoutMenu");
	else if(document.getElementById("XDropDownMenu")) list = document.getElementById("XDropDownMenu");
	else return false;
	var els = list.getElementsByTagName("li");
	for (var i=0; i<els.length; i++) {
		if(els[i].className.indexOf('menuLabel') < 0 && els[i].className.indexOf('XMenuSep') < 0)
			addHoverMethod(els[i]);
	}
}

