$(document).ready(function(){

	$("#menu li ul").hide();
	$("#menu li").click(function(){
		if ($("ul li",this).length){
			if ($("ul",this).css("display") == "none"){
				$("ul", this).slideDown("fast");
				$("a:first",this).attr({"class":"add"});
			}
			else
			{
				$("ul", this).slideUp("fast");
				$("a:first",this).attr({"class":"add2"});
			}

		}
		else {
			location.href = $("a",this).attr("href");
		}
		return false;
	});

	$("#menu li ul li a").each(function(){
		var hreflink = $(this).attr("href");

		if (hreflink.toLowerCase()==location.href.toLowerCase() || location.href.toLowerCase().search(hreflink.toLowerCase())>=0) {
			$("ul",$(this).parents("li")).css({"display":"block"});
			$("a:first",$($(this).parents("li")).parents("li")).attr({"class":"add"});
			$(this).attr({"class":"active"});
		}
	});
	$("#books li:odd").css({"background-color":"#eee"});
	$(".history td:even").css({"font-weight":"bold"});
	$("#home").hover(
	function(){
		$(this).attr({"src":"/img/home-h.jpg"});
	},
	function(){
		$(this).attr({"src":"/img/home.jpg"});
	}
	);
	
	$("#tree").hover(
	function(){
		$(this).attr({"src":"/img/tree-h.jpg"});
	},
	function(){
		$(this).attr({"src":"/img/tree.jpg"});
	}
	);
	
	$("#mail").hover(
	function(){
		$(this).attr({"src":"/img/mail-h.jpg"});
	},
	function(){
		$(this).attr({"src":"/img/mail.jpg"});
	}
	);
});
