var Homepage = jZend.Module.extend( {
	init : function() {
		this.initMenuHover();
		this.initJqueryPlugins();
	},
	
	initMenuHover: function () {		
		// setting submenu fade timeout
		var submenuTimeout = 1000;
		// binding mouseovers
		$('#menu_container a').click(function () {
			if ($(this).attr('href') === '#' || $(this).attr('href') === '')
				return false;
		});
		$('#menu_container ul > li').mouseover(function () {
			// hiding all submenus
			$('#menu_container ul ul').hide();
			// looking for submenu (ul ul), adding aiding class and showing element + binding mouseout
			$(this).find('ul').addClass('hovered').show().mouseout(function () {
				var self = $(this);
				self.removeClass('hovered');
				// delayed call to fade
				setTimeout(function () {
					if (!self.hasClass('hovered'))
						self.hide();
				}, submenuTimeout)
			});
		});
	},
	initJqueryPlugins: function () {
		if ($.fancybox) {
			$('.fancybox').fancybox();
		}
	}
});
