/*--------------------------------------------------------------------------------
 HEAVILY MODIFIED FROM ORIGINAL. DO NOT ATTEMPT NON TriTAG USE.
 ---------------------------------------------------------------------------------*/
 
/*--------------------------------------------------------------------------------
 SI.ClearChildren v1.0

 Instructions for use:

 0. Include the following rules in your CSS (IE Win 5 requires `clear_children` to 
	be display: inline; you can use the * html hack--just be sure to hide from IE 
	Mac):

 	.clear_children,.cc_tallest { position: relative; }
	.cc_tallest:after { content: ''; }

 1. Layout your elements using absolute positioning relative to a container with a 
	class of `clear_children` which contains only the absolutely positioned 
	elements (no other inline elements).

 2. This causes the containing element to collapse.

 3. Decide which contained element will be the deepest on the most occasions and 
	assign a class of `cc_tallest`. This will cause the containing element to 
	expand to the height of this element.

 4. Include this file.

 ---------------------------------------------------------------------------------*/
if (!SI) { var SI = new Object(); };
SI.ClearChildren =
{
	control			: null,
	watchInterval	: 50,
	height			: 0,
	initialize		: function()
	{
		// IE Mac chokes on this (width and height assignments in particular). Go fish.
		if (document.createElement && !(document.all && !window.print))
		{
			var c = document.createElement('div'), s = c.style;
			s.position		= 'fixed';
			s.top			= '0';
			s.visibility	= 'hidden';
			s.width			= '1.em';
			s.height		= '1.em';
			this.control = document.body.appendChild(c);
			this.height = 0;
			window.setInterval('SI.ClearChildren.monitor()', this.watchInterval);
		};
		this.clear();
	},
	
	monitor	: function()
	{
		var o = this.height;
		this.height = this.control.offsetHeight;
		if (o != this.height) { this.clear(); };
	},
	
	clear : function()
	{
		var content = document.getElementById("content");
		
		if (content.className != "standard") {
		  return;
		}
		var nav2 = document.getElementById("nav2");
		var content_right = document.getElementById("content_right");
		var nav2_ul;
		
		for (var i = 0; i < nav2.childNodes.length; i++) {
		  if (nav2.childNodes[i].nodeType == 1 && nav2.childNodes[i].tagName.toLowerCase() == "ul") {
		    nav2_ul = nav2.childNodes[i];
		  }
		}
		
		if (content_right.offsetHeight > nav2_ul.offsetHeight && content_right.offsetHeight > 540) { //Magic number must match the nav2 min-height in layout.css
		  content_right.className = "cc_tallest";
		  nav2.className = "";
		} else {
		  nav2.className = "cc_tallest";
		  content_right.className = "";
		}
	}
};

// Just do it.
SI.ClearChildren.initialize();

