$(function() {
	$("DIV.menuTree UL:not(.open) LI").css("display","none");
	$("DIV.menuTree P.select").parents("DIV.menuTree UL").children("LI").css("display","block");
	$("DIV.menuTree P.select").parents("UL").children("P:not(.select)").addClass("up");
	if($("DIV.menuTree P.select").parent("UL").children("LI").length>0) {
		$("DIV.menuTree P.select").parent("UL").addClass("open");
		$("DIV.menuTree P.select").addClass("up");
	} else {
		$("DIV.menuTree P.select").parent("UL").parent("LI").parent("UL").addClass("open");
	}
	$("DIV.menuTree P.select").parents("UL").children("P:not(.select)").addClass("up");
	$("DIV.menuTree LI").parent("UL").children("P:not(.up)").addClass("down");
	$("DIV.menuTree LI").parent("UL").children("P").click(function() {
		$("DIV.menuTree UL").removeClass("open");
		$("DIV.menuTree UL.this").removeClass("this");
		$(this).parents("UL").addClass("this");
		$("DIV.menuTree UL:not(.this) LI").css("display","none");
		$("DIV.menuTree UL:not(.this) LI").parent("UL").children("P").removeClass("up");
		$("DIV.menuTree UL:not(.this) LI").parent("UL").children("P").addClass("down");
		if($(this).parent().children("LI").css("display")=="block") {
			$(this).parent().children("LI").css("display","none");
			$(this).removeClass("up");
			$(this).addClass("down");
			$(this).parent("UL").parent("LI").parent("UL").addClass("open");
		} else {
			$(this).parent().children("LI").css("display","block");
			$(this).removeClass("down");
			$(this).addClass("up");
			$(this).parent("UL").addClass("open");
		}
	});
	$("DIV.menuTree A").hover(function () {
		$(this).addClass("link");
		$(this).parent("P:not(.select)").addClass("link");
	}, function () {
		$(this).removeClass("link");
		$(this).parent("P:not(.select)").removeClass("link");
	});
	$("DIV.menuTree P:not(P.select)").hover(function () {
		$(this).addClass("hover");
		$(this).children("A").addClass("hover");
	}, function () {
		$(this).removeClass("hover");
		$(this).children("A").removeClass("hover");
	});
	$("DIV.menuTree LI").parent("UL").children("P:not(.select)").hover(function () {
		$(this).addClass("toggle");
	}, function () {
		$(this).removeClass("toggle");
	});
});
