// MENU

var obj = null;
var obj2 = null;

function checkHover() {
	if (obj) {
		obj.find('ul').hide();
	}
}
function checkHover2() {
	if (obj2) {
		obj2.children("ul.submenu").hide();
		obj2.children('a').removeClass('pushed');
	}
}

// DOWNLOAD PDF

function downloadPDF(id) {
	var box = document.getElementById('downloadPDF_'+id);
	
	if (box.style.display=='block') box.style.display='none';
	else box.style.display='block';
}

$(function() {
	$('ul.submenu').parent('li').hover(function() {
		if (obj2) {
			obj2.children("ul.submenu").hide();
			obj2.children('a').removeClass('pushed');
			obj2 = null;
		}
		$(this).children("ul.submenu").fadeIn('fast');
		$(this).children("a").attr('class',"pushed");
	}, function() {
		obj2 = $(this);
		setTimeout("checkHover2()", 600);
	});
	$('li.main').hover(function() {
		if (obj) {
			obj.find('ul.menu').hide();
			obj = null;
		}
		$(this).find('ul.menu').fadeIn('fast');
	}, function() {
		obj = $(this);
		setTimeout("checkHover()", 600);
	});
});

// SEARCHBOX

$(function() {
	$('#searchhook').hover(function() { $(this).find('ul').fadeIn('fast'); }, function() { $(this).find('ul').hide(); });
	$('#search_input').focus(function() { $('#searchhook').unbind('mouseout'); });
	$('#search_input').blur(function() { setTimeout( function() { $('#searchhook ul').fadeOut(); }, 700); });
	$('#searchhook a').click(function() { $('#searchhook ul').toggle(); return false; });
});
