// JavaScript Document
	
	// Load function loops through all divs looking for anything with _menu that matches the link class 
	// ie attorneys_menu where attorneys is the class applied to the link under the nav div
	// Hides anything it finds and instantiates the mouse over observer. 
	
	document.observe("dom:loaded", function (e)
		{
			$$('#aop a').each(function (element)
			{
				var menu = $($A(element.classNames()).first() + "_menu");
				if( menu) {
					menu.hide();
					element.observe('mouseover', function (e)
						{
							link_item = $A(Event.element(e).classNames());	
							show_drop(menu, link_item.first());
						});
					
				}
			});
		}
	);
	
	// Function to show and hide div menu items. looks for the div and the button to attach it to. 

	function show_drop(drop_div, button_class){
	
		$$('a.' + button_class).each(function (elm){
				button = elm.identify();
				//button_width = $(button).getWidth();
				button_height = $(button).getHeight() -1;
			}
		);
		
		$$('div.drop').each(function (elm){
			elm.hide();
			}
		);
		$(drop_div).show();
		
		//Find and attach to button
		Element.clonePosition(drop_div, button, { 
			//setLeft:true,
			//setTop:true,
			//setWidth: false,
			//setheight: false,
			//offsetLeft: 0,
			//offsetTop: button_height
			}
		);
		
		
		// Roll in out functions for the div's
		$(drop_div).observe('mouseout', function(){		
			clearTimeout(document.timer);	
			document.timer = setTimeout( function(){
				$(drop_div).hide()}, 
				10);
			}
		);
		
		$(drop_div).observe('mouseover', function(){
			$(drop_div).show();
			clearTimeout(document.timer);
			}
		);
		
		
	}
