var menuItem = '';
var timer=0;
function openMenu(id){
	$('#'+id+':hidden').css({'display':''});
	menuItem = $('#'+id);
}
function closeMenu(){
	timer=0;
	menuItem.css({'display':'none'});
}
function closeTime(){
	timer = setTimeout(closeMenu,100);
}
function cancelHide(){
	if(timer){
		clearTimeout(timer);
	}
}

$(document).ready(function(){
	//color active button text
	$('.activebutton').each(function(){
		$(this).children().filter('a').css({'color':'#333333'});
	});
	//menu hover
	$('.button:not(.activebutton)').hover(function(){
		$(this).addClass('activebutton');
		//$(this).children().filter('a').css({'color':'#333333'});
		$(this).children().filter('.button_text').css({'color':'#333333'});
	},function(){
		$(this).removeClass('activebutton');
		//$(this).children().filter('a').css({'color':'#c4c4c4'});
		$(this).children().filter('.button_text').css({'color':'#c4c4c4'});
	});
	//menubutton click
	/*$('.button').click(function(){
		var id = $(this).attr('id');
		var a = $('a.'+id).attr('href')
		window.location = a;
	});*/
	//submenu hover
	$('.subbutton').hover(function(){
		$(this).children().filter('a').css({'color':'#ffffff'});
	},function(){
		$(this).children().filter('a').css({'color':'#c4c4c4'});
	});
	//hide submenus
	$('.submenu').css({'display':'none'});
});