/************************************************************************************
* Changelog 
*
*  2010 01 18 - UB remove redundant links
*
*
*
************************************************************************************/

/* Alter "basePath" to be the base path to your website (usually this would be "/" unless the site is under development). */
/* Since 1.1 */
var basePath="/clients/acc/1.1/";


var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav6 = (is_nav && (is_major == 5));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
 

schedule("window", checkStyleSheet);
schedule("window", initTables);

function checkStyleSheet()
{
	agt=navigator.userAgent.toLowerCase();
	if(agt.indexOf('netscape6')!=-1)
	{
		setStylesheet("Basic");
	}
	else
	{
		setStylesheet("");
	}
}


function setStylesheet(styleTitle)
{
	var currTag;

	if (document.getElementsByTagName)
	{
		for (var i = 0; (currTag = document.getElementsByTagName("link")[i]); i++)
		{
			if (currTag.getAttribute("rel").indexOf("style") != -1 && currTag.getAttribute("title"))
			{
				currTag.disabled = true;

				if(currTag.getAttribute("title") == styleTitle)
				{
					currTag.disabled = false;
				}
			}
		}
	}
	
	return true;
};
 
function getChildrenByTagName(target, tagName)
{
	var children = target.childNodes;
	var matching = new Array();
	
	if (children != null)
	{
		for (var i = 0; i < children.length; i++)
		{
			if (children[i].nodeName.toLowerCase() == tagName)
			{
				matching[matching.length] = children[i];
			}
		}
	}
	
	return matching;
};




function isDescendantNode(descendant, ancestor)
{
	if (!descendant || !ancestor)
	{
		return false;
	}
	while (descendant.parentNode != null && descendant.parentNode.nodeName.toLowerCase() != "#document")
	{
		if (descendant.parentNode == ancestor)
		{
			return true;
		}
		else
		{
			descendant = descendant.parentNode;
		}
	}
	
	return false;
};




function attachEventListener(target, eventType, functionRef, capture)
{
	if (typeof target.addEventListener != "undefined")
	{
		target.addEventListener(eventType, functionRef, capture);
	}
	else if (typeof target.attachEvent != "undefined")
	{
		var functionString = eventType + functionRef;
		target["e" + functionString] = functionRef;
        
		target[functionString] = function(event)
		{
			if(typeof event == "undefined")
			{
				event = window.event
			};

			target["e" + functionString](event);
        };
        
		target.attachEvent("on" + eventType, target[functionString]);
	}
	else
	{
		eventType = "on" + eventType;

		if (typeof target[eventType] == "function")
		{
			var oldListener = target[eventType];

			target[eventType] = function()
			{
				oldListener();

				return functionRef();
			}
		}
		else
		{
			target[eventType] = functionRef;
		}
	}

	return true;
};


function initTables()
{
	var tables = document.getElementsByTagName("table");
	
	for (var i = 0; i < tables.length; i++)
	{
		var tbody = tables[i].getElementsByTagName("tbody")[0];
		var trs = tbody.getElementsByTagName("tr");
		
		for (var j = 1; j < trs.length; j += 2)
		{
			if (trs[j].className == "")
			{
				trs[j].className = "alt";
			}
			else
			{
				trs[j].className += " alt";
			}
		}
	}
	
	return true;
};



/* Since 1.1 */
function preloadNavigationImages()
{
	/* dummy */
};