//var menuId='left_menu'; 
var menuId = ['left_menu', 'left_menu1'];
var ahref=window.location.toString();
 $(document).ready(function() {
 	$("head").prepend('<style type="text/css">.hidd{display:none}</style>'); 
	  $(menuId).each(function(i) {
				//alert(menuId[i]);
				jmenu(menuId[i]);
        if(!$.browser.msie) $("#"+menuId[i]).show(); 
		});
    //jmenu(menuId);  
  });
 function jmenu(id){
 	$("#"+id+" li").each( function (index){ 
 	$(this).attr("id", id+'_'+index); 
 	if($(this).find("ul").size()) {
 		var stop = false;
 		$(this).find("a").each(function(){
         if(this.href==ahref){
          stop=true;
//          alert($(this).parent().attr("id"));
          $(this).parents("li").addClass("activeMI");	        
         };
       });
 		$(this).find("> a").click(function(){openJmenu(id+'_'+index); return false;}); 
  		if(!$(this).hasClass("activeMI") && stop == false){  
			$(this).find("> ul").addClass("hidd");
  	  }
    }
  });
 }

 function openJmenu(id){
   	if($("#"+id).find("> ul").hasClass("hidd")){ 
        $("#"+id).addClass("activeMI"); 
        $("#"+id+" > ul").animate({height: "hide"}, 'slow').animate({height: "show"/*,opacity: "show"*/}, 'slow').removeClass('hidd'); 
 	}else{
 		 $("#"+id+" > ul").animate({height: "hide"/*, opacity: "hide"*/}, "1000",'',
         function(){
        	$("#"+id).removeClass('activeMI');
         }).addClass("hidd"); 
 	}
 }
