//initiate drop down menus for the vehicle-specific nav menu

window.addEvent('domready', function() {
																	 
	//loop through each menu item
	$$(".vehicle_item").each(function(f){
		f = $(f);
		
		//check if it contains a drop down
		if($E('.features_menu_container', f)) {
			
			//create a slide effect on the container
			var mySlide = new Fx.Slide($E('.features_menu_container', f), {wait:false, duration: 300, fps:100, transition: Fx.Transitions.Quad.easeInOut}).hide();
			
			//make the menu contents appear after it has been loaded as a slide
			//they are set to hidden so you wont see them while the javascript is loading
			f.getElements("ul").setStyle('visibility','visible');
			$E('.features_menu_container', f).setStyle('visibility','visible');
			$E('.features_menu_pos', f).setStyle('visibility','visible');
			
			//add slide in and out effects on mouse handling events
			f.addEvent("mouseenter", function(e) {
					new Event(e).stop();
					mySlide.slideIn();
					$E('.vehicle_nav_sub_link', f).addClass('on');
				}
			);
			f.addEvent("mouseleave", function(e) {
					new Event(e).stop();
					mySlide.slideOut();
					$E('.vehicle_nav_sub_link', f).removeClass('on');
				}
			);
		}
		//check to see if the current page is in this menu
		//if so, activate it as an active link
		if(f.getElement('#'+currentPage)) {
			//if the active page is contained in a drop down
			//make both the parent of the drop down and the menu item in the drop down active
			if($E('a.vehicle_nav_sub_link', f)) {
				if($E('a.vehicle_nav_sub_link', f).id == subNav) {
					$E('a.vehicle_nav_sub_link', f).addClass('features_menu_on');
					f.getElement('#'+currentPage).addClass('features_sub_menu_on');
				}
			}
			//if the link is not a drop down, make it active
			if($E('a.vehicle_nav_link', f)) {
				if($E('a.vehicle_nav_link', f).id == currentPage)
					$E('a.vehicle_nav_link', f).addClass('features_menu_on');
			}
		}
		
	});
});