(function(){
    var className = "formula";
    $.gmath = function(){
        $("img." + className).each(function(){
            this.setAttribute(
                "src",
                'http://chart.apis.google.com/chart?cht=tx&chl=' +
                encodeURIComponent(this.getAttribute("alt"))
            );
        });
    };
})();

$(function(){
//	$('a[href*=#]').click(function(){
	$('a.footnote').click(function(){
		var scrollTo = $(this.hash).offset().top;
		$('html,body').animate({ scrollTop: scrollTo }, 500);
		return false;
	});
	$('a[href=#]').click(function(){
		$('html,body').animate({ scrollTop: 0 }, 500);
		return false;
	});
	$('ul.footnote>li>a.back').click(function(){//javascriptで挿入？
		target_hash = '#' + $(this).parent().attr('id');
		var scrollTo = $('a[href="' + target_hash + '"]').offset().top;
		$('html,body').animate({ scrollTop: scrollTo }, 500);
	});
    $.gmath();
});
