// JavaScript Document
//animate the opening of the branch (span.grower jQueryElement)
function openBranch(jQueryElement, noAnimation) {
		jQueryElement.addClass('OPEN').removeClass('CLOSE');
		if(noAnimation)
			jQueryElement.parent().find('ul:first').show();
		else
			jQueryElement.parent().find('ul:first').slideDown();
}
//animate the closing of the branch (span.grower jQueryElement)
function closeBranch(jQueryElement, noAnimation) {
	jQueryElement.addClass('CLOSE').removeClass('OPEN');
	if(noAnimation)
		jQueryElement.parent().find('ul:first').hide();
	else
		jQueryElement.parent().find('ul:first').slideUp();
}

//animate the closing or opening of the branch (ul jQueryElement)
function toggleBranch(jQueryElement, noAnimation) {
	if(jQueryElement.hasClass('OPEN'))
		closeBranch(jQueryElement, noAnimation);
	else
		openBranch(jQueryElement, noAnimation);
}
//when the page is loaded...
$(document).ready(function () {
		toggleBranch($('ul.dhtml a.selected').parent().find('ul'));
		$('ul.dhtml a.selected').parent().find('ul').css('display', 'block');

		$('ul.dhtml .selected').parent().parent().each( function() {
			
			if ( $(this).is('ul') )
			{
				$(this).show();
				
				if( $(this).parent().parent().is('ul') )
				{
					$(this).parent().parent().show();
				}
			}
		});
});

