var mainmenu = function() {
	return {
		init: function() {
			var instance = this;
			var listItem = jQuery('.mainmenu').find("li");

			instance.childmenu = jQuery(listItem);
			instance.childmenu.hoverIntent({
				over: instance.childHover,
				out: instance.childHoverOut,
				interval: 0,
				timeout: 50
			});
		},
		childHover: function() {
			var li = jQuery(this);
			var childmenu = li.find('> ul.child-menu');
			childmenu.css({ display:"block" });
			childmenu.slideDown("fast");
		},
		childHoverOut: function() {
			var li = jQuery(this);
			var childmenu = li.find('> ul.child-menu');
			childmenu.css({ display:"none" });
			childmenu.slideUp("normal");
		}
	};
}();

jQuery(document).ready(

	/*
	This function gets loaded when all the HTML, not including the portlets, is
	loaded.
	*/

	function() {
		mainmenu.init();
		jQuery('ul.side li:last-child').addClass('last');
	}
);

Liferay.Portlet.ready(

	/*
	This function gets loaded after each and every portlet on the page.

	portletId: the current portlet's id
	jQueryObj: the jQuery wrapped object of the current portlet
	*/

	function(portletId, jQueryObj) {
	}
);

jQuery(document).last(

	/*
	This function gets loaded when everything, including the portlets, is on
	the page.
	*/

	function() {
	}
);