var archMenu = {
	currentPage : null,
	init : function() {
		var self = this;
		if (this.currentPage) {
			$('#'+this.currentPage).addClass('current-menu-item').parents('li').addClass('current-menu-parent');
		}
		this.current = $('#menu-main > li.current-menu-parent');
		this.submenus = $('#menu-main .sub-menu');
		$('#menu-main > li').each(function() {
			$this = $(this);
			var submenu = $this.find('.sub-menu');
			if (submenu.length) {
				$.data(this, 'submenu', submenu);
				$this.hover(function() {
					self.submenus.hide();
					$(this).data('submenu').show();
				}, function() {
					self.submenus.hide();
					if (self.current.length) {
						self.current.data('submenu').show();
					}
				});
			}
		});
		if (this.current.data('submenu')) {
			this.current.data('submenu').show();
		}
	}
};
$(function() { archMenu.init(); });
