(function($){

function initMenus() {
	$('ul.menu ul').hide();
	$('ul.menu').each(function(){
		var cookie = $.cookie(this.id);
//		if(cookie != null && String(cookie).length < 1) {
//			$('#' + this.id + '.expandfirst ul:first').show();
//		}
//		else {			
//			$('#' + this.id + ' .' + cookie).next().show();
//		}
	});
	$('#content ul.menu > li > a').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);
				}
				$(this).next().slideToggle('normal');
				//$('#fullDesc').hide('slow');
				
			}				
		}
		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
//			if ($('#' + parent).hasClass('collapsible')) {
				//$('#fullDesc').hide();
				$('#' + parent + ' ul:visible').slideUp('normal');
//			}
			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);
			}
			//$('#fullDesc').hide();
			checkElement.slideDown('normal');
			return false;
		}
	});
	
	$('#fullDesc').hide();
	$('#fullDesc2').hide();
	$('#fullDesc3').hide();
	$('#fullDesc4').hide();
	
	$('a#readMore').click(function() {
		$('#fullDesc').toggle('slow');
		return false;
	});
	$('a#readMore2').click(function() {
		$('#fullDesc2').toggle('slow');
		return false;
	});
	$('a#readMore3').click(function() {
		$('#fullDesc3').toggle('slow');
		return false;
	});
	$('a#readMore4').click(function() {
		$('#fullDesc4').toggle('slow');
		return false;
	});
}
$(document).ready(function() {initMenus();});


})(jQuery);