$(document).ready(function(){
	$('.mainmenu > a').click(function(){
		if(
			/*(!$(this).hasClass("active"))
			&&*/($(this).next().hasClass("menu2"))
			){
			$(this).prevAll('a').removeClass("active");
			$(this).nextAll('a').removeClass("active");
			$('.menu2 a').removeClass("active");
			Cufon.refresh();
			$(this).prevAll('.menu2').slideUp("slow", function (){
				//$(this).prevAll('a').removeClass("active");
			  });
			$(this).nextAll('.menu2').slideUp("slow", function (){
				//$(this).nextAll('a').removeClass("active");
			  });
			$('.mainmenu .menu2 .menu3').slideUp("slow", function (){
			  });
			if($(this).next('.menu2').css('display') != 'block'){
					$(this).next('.menu2').slideDown("slow");
					$(this).addClass("active");
				}else $(this).removeClass("active");
			return false;
		}else{return;};
	});
	
	$('.menu2 a').click(function(){
		if(
			/*(!($(this).hasClass("active")))
			&&*/($(this).next().hasClass("menu3"))
			){
			$(this).prevAll('a').removeClass("active");
			$(this).nextAll('a').removeClass("active");
			Cufon.refresh();
			$(this).prevAll('.menu3').slideUp("slow", function (){
			  });
			$(this).nextAll('.menu3').slideUp("slow", function (){
			  });
			
			if($(this).next('.menu3').css('display') != 'block'){
				$(this).next('.menu3').slideDown("slow"); 
				$(this).addClass("active");
			}else $(this).removeClass("active");
			
			return false;
		}else{return;};
	}); 
});


