$(function () {
	$("a[name]").each(function() {
		$(this).addClass("namelink").attr("id", "infol"+$(this).attr("name")).attr("name", "");
	});
	$(".infobox ul:not(.ignore)").hide().click(function(e) {
		e.stopPropagation();
		$(this).slideUp("slow");
	});
	$(".infobox h6,.infobox h5").click(function(e) {
		e.stopPropagation();
		$(this).next("ul:visible").slideUp("slow");
		$(this).next("ul:hidden").slideDown("slow");
	});
	$(".infobox a").click(function(e) {
		e.stopPropagation();
	});
	$("a[href^=/information-center.asp#],a[href^=#]").click(function(e) {
		$("a.namelink").css({fontSize: "11px", color: "#0B4FA0", background: "", fontWeight: "normal"});
		var ele = $("#infol"+$(this).attr("href").replace("/information-center.asp#", "").replace("#", "")).css({fontSize: "13px", color: "yellow", background: "red", fontWeight: "bold"});
		ele.parents("ul:hidden").show();
		scrollToEle(ele);
	});
	var pieces = window.location.href.split("#");
	if(pieces.length == 2) {
		var ele = $("#infol"+pieces[1]).css({fontSize: "13px", color: "yellow", background: "red", fontWeight: "bold"});
		ele.parents("ul:hidden").show();
		scrollToEle(ele);
	}
});

function scrollToEle(ele) {
	var parents = ele.parents("li");
	var needele = true;
	var h5ele;
	for(var i = 0;i < parents.length && needele;i++) {
		h5ele = ele.parents("li").eq(i).find("h5");
		if(h5ele.length > 0) {
			needele = false;
		}
	}
	if(needele) {
		$.scrollTo(ele, 800);
	}
	else {
		$.scrollTo(h5ele, 800);
	}
}