var timeout = null;
var increment = 30;
var speed = 10;
function goto_anchor_up(name) {
	clearTimeout(timeout);
	var anchor = document.getElementById(name);
	var container = document.getElementById("container");
	var ot = anchor.offsetTop;
	var st = container.scrollTop;
	if(st < ot) {
		container.scrollTop += (((st + increment) > ot)? (ot - st): increment);
		timeout = setTimeout("goto_anchor_up('" + name + "');", speed);
	}
}

function goto_anchor_down(name) {
	clearTimeout(timeout);
	var anchor = document.getElementById(name);
	var container = document.getElementById("container");
	var ot = anchor.offsetTop;
	var st = container.scrollTop;
	if(st > ot) {
		container.scrollTop -= (((st - increment) < ot)? (st - ot): increment);
		timeout = setTimeout("goto_anchor_down('" + name + "');", speed);
	}
}

function goto_anchor(name) {
	clearTimeout(timeout);
	var ot = document.getElementById(name).offsetTop;
	var st = document.getElementById("container").scrollTop;
	if(st < ot) {
		timeout = setTimeout("goto_anchor_up('" + name + "');", speed);
	} else if(st > ot) {
		timeout = setTimeout("goto_anchor_down('" + name + "');", speed);
	}
	return false;
}