function get_manual_menu()
{
	var req = new JsHttpRequest();
	req.onreadystatechange = function() 
	{
		if (req.readyState == 4) 
		{
			document.getElementById('manual_menu').innerHTML = req.responseJS.result;
		}
	}

	req.open(null, '/ajax_menu/?get_manual=1', true);
	req.send(null);
}

function putClass(){
	$("#nav .wiki").addClass("wiki-hover");
}

$(function() {
/*
	$("#nav .wiki").hover(function() {
		if($('.wiki .dropdown').css('display') == 'none')
			window.setTimeout(putClass, 2000, true);
	}, function() {
		if($('wiki .dropdown').css('display') !== 'none')
			$(this).removeClass("wiki-hover");
	});
*/
		

});

$(document).ready(function () {
	get_manual_menu();
	
	function show() {
		$(this).addClass("wiki-hover");
    	$('.wiki .dropdown').slideDown();
   	}
	function hide() { 
		$(this).removeClass("wiki-hover");
    	$('.wiki .dropdown').slideUp();
   	}
   	$("#nav .wiki").hoverIntent({
    	sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
     	interval: 100,   // number = milliseconds for onMouseOver polling interval
     	over: show,     // function = onMouseOver callback (required)
     	timeout: 300,   // number = milliseconds delay before onMouseOut
     	out: hide       // function = onMouseOut callback (required)
   	});
   	
   	$("#categories .show-hide").each(function() {
		$(this).click(function(event) {
			event.preventDefault();
			$(this).parent().toggleClass("cat-hide");
		});
	});
    	
});
