function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
		var cookie = $.cookie(this.id);
		if(cookie === null || String(cookie).length < 1) {
			$('#' + this.id + '.expandfirst ul:first').show();
			$('#' + this.id + '.expandfirst h2:first').addClass('active'); /** adds the class "active" to the cookie'd h2 **/
		}
		else {			
			$('#' + this.id + ' .' + cookie).next().show();
			$('#' + this.id + ' .' + cookie).addClass('active'); /** adds the class "active" to the cookie'd h2 **/
		}
	});
	$('ul.menu li h2').click(
		function() {

			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				if((String(parent).length > 0) && (String(this.className).length > 0)) {
					if($(this).next().is(':visible')) {
						$.cookie(parent, null);
					}
					else {
						$.cookie(parent, this.className, {path: '/'}); /** need the path so it's not folder specific cookies **/
					}
					$(this).next().slideToggle('normal');
				}				
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
					$('#menu li h2').removeClass('active'); /** removes "active" class on all h2's **/
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				if((String(parent).length > 0) && (String(this.className).length > 0)) {
					$.cookie(parent, this.className, {path: '/'}); /** need the path so it's not folder specific cookies **/
				}
				checkElement.slideDown('normal');
				$('#menu li h2').removeClass('active'); /** removes "active" class on all h2's **/
				$(this).addClass('active'); /** adds "active" class to clicked h2 **/
				return false;
			}
		}
	);
}
$(document).ready(function() {initMenus();});



/**function initMenus() {
	$('ul.menu ul').hide();
	$.each($('ul.menu'), function(){
		$('#' + this.id + '.expandfirst ul:first').show();
		$('#' + this.id + '.expandfirst h2:first').addClass('active');
	});
	$('ul.menu h2').click(
		function() {
			var checkElement = $(this).next();
			var parent = this.parentNode.parentNode.id;

			if($('#' + parent).hasClass('noaccordion')) {
				$(this).next().slideToggle('normal');
				return false;
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');
					$('#menu li h2').removeClass('active');
				}
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				checkElement.slideDown('normal');
				$('#menu li h2').removeClass('active');
				$(this).addClass('active');
				return false;
			}
		}
	);
	}
	$(document).ready(function() {initMenus();});

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function initMenu() {
 $('#menu ul').hide();
 $('#menu li h2').click(
   function() {
     var checkElement = $(this).next();
     if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
               return false;
       }
     if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
       $('#menu ul:visible').slideUp('normal');
       checkElement.slideDown('normal');
       $('#menu li h2').removeClass('active');
       $(this).addClass('active');
       return false;
       }
     }
   );
 }
$(document).ready(function() {initMenu();});

//	$('#menu li h2').click (
//		function() {
//			var checkElement = $(this).next();
//			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
//				$('#menu li h2').addClass('active');
//				return false;
//				}
//			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
//				$('#menu li h2').removeClass('active');
//				return false;
//			}
//		}
//		);
//  }
//$(document).ready(function() {initMenu();});

**/

