function to(url){
	window.location.href=url;
}
$(function(){
	var href = window.location.href;
	$("#page #select option").each(function(){
		if(href.indexOf($(this).attr("value"))>0){
			$(this).attr("selected","selected")
		}
	});
});

(function($){
	$(document).ready(function(){
		var show = function(){
			$(this).children(".childs").show();
			if($(this).data("childHeight")){
				$("#left").css("height", $(this).data("childHeight"));//-------
			}
		}
		var hide = function(){
			$(this).children(".childs").hide();
			$("#left").css("height", "auto");//-------
		}
		$("#left > li").hover(show, hide);
		/*
		var lis = $("#left > li:last ul.childs > li");
		if(lis.length){
			var h = 0;
			lis.each(function(){
				h+=$(this).height();
			});
			$("#left > li:last").css("margin-bottom", h);
		}
		*/
		var blih=0;
		var h=0;
		$("#left > li").each(function(o, i){
			var clih=0;
			$(this).find("ul.childs li").each(function(){
				clih+=$(this).height();
			});
			var nh = blih+clih;
			h=h>nh?h:nh;
			
			if(clih){
				$(this).data("childHeight", h);//-------
			}
			
			blih+=$(this).height();
		});
		//$("#left").height(h);//-------
		$("#left .childs").hide();
	});
})(jQuery);
