
$(document).ready(function()
{
	var showPane=function(){
		$("#firstpane div.menu_head").css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideDown(300);
       	$("#firstpane div.menu_head").siblings().css({backgroundImage:"url(left.png)"});
	};
	
	var hidePane=function(){	
     $("#firstpane div.menu_head").css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideUp(300);
     $("#firstpane div.menu_head").siblings().css({backgroundImage:"url(left.png)"});
     };	
     
     var mouseinmenubody=false;
  	$("#firstpane div.menu_head").mouseover(showPane);

     $("#firstpane div.menu_head").mouseout(function(){
     setTimeout(function(){;if(!mouseinmenubody)hidePane();},200);
     });
     $("#menu_body").mouseenter(function(){    
      mouseinmenubody=false;
      $(this).mouseleave(function(){mouseinmenubody=false;hidePane();});
     });
	//slides the element with class "menu_body" when mouse is over the paragraph
	$("#secondpane div.menu_head").mouseout(function()
    {
	     $(this).css({backgroundImage:"url(down.png)"}).next("div.menu_body").slideDown(300).siblings("div.menu_body").slideDown("slow");
         $(this).siblings().css({backgroundImage:"url(left.png)"});
	});
});

