function initMenus() {
	$('ul.menuL ul').hide();
	$.each($('ul.menuL'), function(){
		var cookie = $.cookie(this.id);
		/*if(cookie === null || String(cookie).length < 1) {
			$('#' + this.id + '.expandfirst ul:first').show();
		}
		else {			
			$('#' + this.id + ' .' + cookie)	.css("background", "url(leftmenu/images/out.gif) no-repeat 0px 8px")		
			//$('#' + this.id + ' .' + cookie).next();
		}*/
	});

	$('ul.menuL 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');
					
				}				
			}
			if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
				if($('#' + parent).hasClass('collapsible')) {
					$('#' + parent + ' ul:visible').slideUp('normal');

				}
				$(this)					.css("background", "url(../leftmenuscript/images/out.gif) no-repeat 0px 8px")
										.css("font-weight", "normal");
				return false;
			}
			if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
				$('#' + parent + ' ul:visible').slideUp('normal');
				var ob = $.cookie(parent); 
				$('#' + parent + ' .' + ob)  .css("background", "url(../leftmenuscript/images/out.gif) no-repeat 0px 8px");
				if((String(parent).length > 0) && (String(this.className).length > 0)) {
					$.cookie(parent, this.className);
					$(this)					.css("background", "url(../leftmenuscript/images/out.gif) no-repeat 0px 8px");
				}
						
				
				checkElement.slideDown('normal');
				//vikrant insert your code here
				$(this)					.css("background", "url(../leftmenuscript/images/down.gif) no-repeat 0px 8px")
										.css("font-weight", "bold")	
				return false;
			}
		}
	);
}
$(document).ready(function() {initMenus();});
