/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

	function black()
	{
		setStyleByClass('UL','toggle','left','-6em');
	}
	
	function red()
	{
		setStyleByClass('UL','toggle','left','-999em');
	}
	
	
	//init var when page loads
	lastOpened = '';
	function navPopup(elementID)
	{
		var browserName = navigator.appName;
		classSyntax = "className";
		
		if(browserName == "Microsoft Internet Explorer")
		{
			classSyntax = "className";
		}
		else
		{
			classSyntax = "class";
		}
		
		//alert(lastOpened);
		//alert(elementID);
		//reset all to off position
		document.getElementById('ul_links').setAttribute(classSyntax, "toggleOff");
		document.getElementById('ul_groupdocs').setAttribute(classSyntax, "toggleOff");
		document.getElementById('ul_mail').setAttribute(classSyntax, "toggleOff");
		document.getElementById('ul_info').setAttribute(classSyntax, "toggleOff");
		document.getElementById('ul_tool').setAttribute(classSyntax, "toggleOff");


		//turn the clicked one on
		//if the clicked one is the one that was last opened, then don't make it pop up
		if ( lastOpened != elementID )
		{
			document.getElementById(elementID).setAttribute(classSyntax, "toggleOn");
			lastOpened = elementID;
		}
		else
		{
			lastOpened = '';
		}
		
	}
	
	
	
// setStyleByClass: given an element type and a class selector,
// style property and value, apply the style.
// args:
//  t - type of tag to check for (e.g., SPAN)
//  c - class name
//  p - CSS property
//  v - value
var ie = (document.all) ? true : false;

function setStyleByClass(t,c,p,v){
	var elements;
	if(t == '*') {
		// '*' not supported by IE/Win 5.5 and below
		elements = (ie) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue == c) {
					eval('node.style.' + p + " = '" +v + "'");
				}
			}
		}
	}
}
	
	
	

