$(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('ul.subitems_replace');

    $.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('ul.subitems_replace');

    $.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);
		
		//nu wel de goede! thanks riCK ;-)
		$("ul.tabs").tabs(".plane .listview", {
			effect: 'fade',
			fadeInSpeed: 550,
			fadeOutSpeed: 300
   		}).history();

	    $("#chained").scrollable({speed: 'slow', size: 1}).circular().navigator().autoscroll({
		    steps: 1,
		    interval: 5000,
		    autoplay: true
	    });

	    function btnHoverOver() { $(this).fadeTo(100, 0.9); }
	    function btnHoverOut() { $(this).stop().fadeTo(600, 0.4); }

	    var config2 = {
		    sensitivity: 50,
		    interval: 50,
		    over: btnHoverOver,
		    timeout: 0,
		    out: btnHoverOut
	    };

	    $(".overlay").css({'opacity': 0.8 });
	    $(".buttons").css({'opacity': 0.4 }).hoverIntent(config2);

});





