function getActiveStyle(elem)
{
	var retval;
	
	if (window.getComputedStyle)
		retval = window.getComputedStyle(elem, null);
	else if (elem.currentStyle)
		retval = elem.currentStyle;
		
	return retval;
}

function findCSSStyle(styleSheet, selectorText)
{
	var rules = (styleSheet.cssRules) ? styleSheet.cssRules : styleSheet.rules;
	for (var i = 0; i < rules.length; i++)
	{
		if (rules[i].type && rules[i].type == 3)
		{
			var style = findCSSStyle(rules[i].styleSheet, selectorText);
			if (style)
				return style;
		}
		else if (rules[i].selectorText.toLowerCase().substr(0, selectorText.length) == selectorText)
		{
			return rules[i].style;
		}
	}
	
	if (styleSheet.imports)
	{
		for (var i = 0; i < styleSheet.imports.length; i++)
		{
			var style = findCSSStyle(styleSheet.imports[i], selectorText);
			if (style)
				return style;
		}
	}
}

function getCSSStyle(selectorText)
{
	for (var i = 0; i < document.styleSheets.length; i++)
	{
		var style = findCSSStyle(document.styleSheets[i], selectorText);
		if (style)
			return style;
	}
}

function hiliteLink(elem)
{
	elem.style.color = "white";
}

function restoreLink(elem)
{
	elem.style.color = getCSSStyle("table.navcloud").color;
}

function navigate(elem, url)
{
	restoreLink(elem);
	window.location = url;
}
