'use strict';

(function($){

	$(document).ready(function() {
		// mainmenu (level 1)
		$('#primary-navigation > li').hoverIntent({
			over: function() {
				$(this)
					.parent()
						.children().removeClass('selected')
						.end()
					.end()
					.addClass('selected')
					.find('ul').show();
			},
			out: function() {
				$(this)
					.removeClass('selected')
					.find('ul').hide();
			},
			timeout: 200
		});
		
		// submenu (level 2)
		$('#subnav > li').hoverIntent({
			over: function() {
				$(this)
					.parent()
						.children().removeClass('selected')
						.end()
					.end()
					.find('ul').show();
			},
			out: function() {
				$(this).find('ul').hide();
			},
			timeout: 200
		});
	});

})(jQuery);

