﻿function InitNav()
{
	jQuery(".leftcol ul li.seemore a").click(function(e) { aSeeMore_Click(e); return false; }); 
	jQuery(".leftcol ul li.seemore").prev().each(function(index, domElement)
	{
//		alert("looping over LI index " + index + ", # children=" + jQuery("ul", domElement).children().length);
		var listHeight = jQuery("ul", domElement).height();
		if (listHeight <= 150)
		{
			var jqSeeMore = jQuery(domElement).next();
			jqSeeMore.hide();
		}
	});
}

function aSeeMore_Click(jqEvent)
{
	var jqViewAll = jQuery(jqEvent.target);
	var jqPrev = jqViewAll.parent().prev();
	if (jqPrev.hasClass("collapsed"))
	{
		jqPrev.animate({maxHeight:'1000'}, 500, function() 
		{ 
//			alert("complete function, this=" + this); 
			jQuery(this).removeClass("collapsed"); 
			jQuery(this).css('max-height','');
		});
		jqViewAll.text("(Collapse)");
	}
	else 
	{
		jqPrev.addClass("collapsed");
		jqViewAll.text("(View All)");
	}
}

jQuery(function() 
{
	InitNav();
})
