jQuery.noConflict();

jQuery(document).ready(function($) {
    // remove links

    // reorder the menu

    $('#container').find('a.nohref').each(function() {
        $(this).attr('href', '#' + $(this).attr('href'));
    });

    // reorder the menu
    var subs = $('#nav #menu').find('div.subitems');

    $.each(subs, function(i, sub) {
        var _item = $(this).html();

        $(this).prev().find('.subitems').empty();
        $(this).prev().find('.subitems').append(_item);
        $(this).remove();
    });

    // reorder the footer menu
    var subs = $('#footer').find('div.subitems');

    $.each(subs, function(i, sub) {
        var _item = $(this).html();

        $(this).prev().append(_item);
        $(this).remove();
    });


	function megaHoverOver(){
		$(this).find(".hover").stop().fadeTo(100, 1).show();
		$(this).find(".sub").stop().fadeTo(100, 1).show();
	}

	function megaHoverOut(){
	  $(this).find(".hover").stop().fadeTo(0, 0, function() {
		  $(this).hide();
	  });
	  $(this).find(".sub").stop().fadeTo(0, 0, function() {
		  $(this).hide();
	  });
	}

	var config = {
		 sensitivity: 50, // number = sensitivity threshold (must be 1 or higher)
		 interval: 0, // number = milliseconds for onMouseOver polling interval
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
		 timeout: 0, // number = milliseconds delay before onMouseOut
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)
	};

	$("ul#menu li .sub, .hover").css({'opacity':'0'});
	$("ul#menu li").hoverIntent(config);
});