function add_anchor(tag, to_self){
	var self = (function(){
		var i = location.pathname.lastIndexOf('/')
		if( i <= 0 ) i = location.pathname.lastIndexOf('\\')
		if( i >  0 ) i += 1
		return location.pathname.substr(i)
	})()

	var objs = document.getElementsByTagName(tag)
	for( var i=0; i!=objs.length; ++i ) {
		var h2 = objs[i];
		var txt       = h2.firstChild
		txt.nodeValue = " " + txt.nodeValue
		var id        = (to_self ? h2.id : h2.parentNode.id)
		var selfid    = location.hash.substr(1)
		{
			var a  = document.createElement("a")
			if( selfid != id )
			    a.href      = self + "#" + id
			    a.innerHTML = "*"
			h2.insertBefore( a, txt )
		}
	}
}
