liltype.eqca = new liltype();

liltype.eqca.onPrimaryNavOver = function()
{
	var onmouseover;
	if (this.liltype &&
	    this.liltype.eqca)
	{
		if (this.liltype.eqca.onMouseOverOld)
		{
			onmouseover = this.onmouseover;
			this.onmouseover = this.liltype.eqca.onMouseOverOld;
			this.onmouseover();
			this.onmouseover = onmouseover;
		}

		if (this.liltype.eqca.imgRollover)
		{
			this.liltype.eqca.imgRollover.liltype.simpleRolloverA.onmouseover();
		}
	}
}

liltype.eqca.onPrimaryNavOut = function()
{
	var onmouseout;
	if (this.liltype &&
	    this.liltype.eqca)
	{
		if (this.liltype.eqca.onMouseOutOld)
		{
			onmouseout = this.onmouseout;
			this.onmouseout = this.liltype.eqca.onMouseOutOld;
			this.onmouseout();
			this.onmouseout = onmouseout;
		}

		if (this.liltype.eqca.imgRollover)
		{
			this.liltype.eqca.imgRollover.liltype.simpleRolloverA.onmouseout();
		}
	}
}

liltype.eqca.primaryNavXV = function(node)
{
	var srcOn;
	
	/*
		Set rollovers for nav bar top level items
	*/
		if (node.nodeType == 1)
		{
			if ((node.nodeName == "LI") &&
			    liltype.CNU.match(node.className, "bar"))
			{
				this.inLIBar = true;
				this.LIBar = node;
				this.nextAisFirst = false;
			}
			else if ((node.nodeName == "A") &&
			         this.nextAisFirst)
			{
				node.className = liltype.CNU.add(node.className, "first_item");
				this.nextAisFirst = false;
			}
			else if ((node.nodeName == "A") &&
			         this.inLIBar)
			{
				this.inLIBarA = true;
			}
			else if ((node.nodeName == "IMG") &&
			         this.inLIBar &&
			         this.inLIBarA)
			{
				if (node.src.match(/_ON\.[^\.]+/))
				{
					liltype.simpleRollover(node, node.src, node.src);
				}
				else
				{
					liltype.simpleRollover(node, node.src, node.src.replace(/\.([^\.]+)$/, "_ON.$1"));
				}
				this.inLIBar = false;
				this.inLIBarA = false;
				this.nextAisFirst = true;

				if (!this.LIBar.liltype)
				{
					this.LIBar.liltype = new liltype();
				}
				
				if (!this.LIBar.liltype.eqca)
				{
					this.LIBar.liltype.eqca = new liltype();
				}

				this.LIBar.liltype.eqca.onMouseOverOld = this.LIBar.onmouseover;
				this.LIBar.onmouseover = this.onPrimaryNavOver;

				this.LIBar.liltype.eqca.onMouseOutOld = this.LIBar.onmouseout;
				this.LIBar.onmouseout = this.onPrimaryNavOut;

				this.LIBar.liltype.eqca.imgRollover = node;
			}
		}
	
	return true;
}

liltype.eqca.initPrimaryNav = function(id)
{
	var sf = new liltype.SFMenu(id);
	sf.init(id);
	sf = null;

	this.inLIBar = false;
	this.nextAisFirst = false;
	this.LIBar = null;
	this.inLIBarA = false;

	liltype.xVerseNode(liltype.ds(id), this, "primaryNavXV");
}

/*
liltype.eqca.printRColAboveNavImg = function(idSrc, className, defaultSrc, w, h)
{
	var imgSrc, src;
	if (imgSrc = liltype.ds(idSrc))
	{
		src = imgSrc.src;
	}
	else
	{
		src = defaultSrc;
	}
	document.writeln('<img class="'+className+'"src="'+src+'" width="'+w+'" height="'+h+'" />');
}
*/
liltype.eqca.printRColAboveNavImg = function(classNameSrc, classNameTgt, defaultSrc, w, h)
{
	var i, c, img;
	for (i = 0, c = document.images.length; i < c; i++)
	{
		img = document.images[i];
		if (liltype.CNU.match(img.className.toLowerCase(), classNameSrc))
		{
			document.writeln('<img class="'+classNameTgt+'"src="'+img.src+'" width="'+w+'" height="'+h+'" />');
			return;
		}
	}
	document.writeln('<img class="'+classNameTgt+'"src="'+defaultSrc+'" width="'+w+'" height="'+h+'" />');
}

jQuery(document).ready
(
	function()
	{
		var lnks = document.links, i, c, lnk;
		var extRegexp = /\.(pdf|doc|docx)$/i;
		var click = function()
		{
			var m;
			if (m = this.href.toLowerCase().match(/\/([^\.\/]+)\.([^\.]+)$/))
			{
				try
				{
					pageTracker._trackPageview("/"+m[2]+"/"+m[1]);
				}
				catch (e)
				{
				}
			}
			return true;
		}
		for (i = 0, c = lnks.length; i < c; i++)
		{
			if ((lnk = lnks[i]).href.match(extRegexp))
			{
				jQuery(lnk).click(click);
			}
		}
	}
);
