function doit(objid, count) {
	obj = document.getElementById(objid);
	if (count >= 0) {
		if (count % 2 == 0) {
			obj.className = "qa_hilite";
		} else {
			obj.className = "qa";
		}

		window.setTimeout("doit('" + objid + "', " + (count-1) + ");", 150);
	}
}

BOUNCES = 1;

function hilite_anchor(section) {
	var fromurl = false;
	if (!section) {
		var loc = document.location.href;
		var parts = loc.split(/#/);
		if (parts.length > 1) {
			var section = "" + parts[1];
		}
		fromurl = true;
	}

	if (section) {
		var questions = document.getElementsByTagName('div');
		for (var i=0; i<questions.length; i++) {
			a = questions[i];
			if (a.className == "qa" || a.className == "qa_hilite") {
				var id = a.getAttribute("id");
				if (id == ("question_" + section)) {
					if (!fromurl) 
						doit(id, BOUNCES * 2);
					else
						a.className = "qa_hilite";
				} else {
					a.className = "qa";
				}
			}
		}
	}
}

function install_hooks() {
	var pattern = /^#/;
	var links = document.getElementsByTagName('a');
	for (var i=0; i<links.length; i++) {
		var a = links[i];
		var href = a.getAttribute("href");
		if (pattern.test(href)) {
			a.onClick = a.onclick = new Function("hilite_anchor('" +
					href.replace(/^#/,"") + "');");
		}
	}
}

