
function highlight()
{
var pattern = /#(.*)$/;
var result = document.URL.match(pattern);
if (result != null)
{
    var test = new RegExp('(^|\/n)' + result[1] + '\.[^\.]+$'); // do not use the double '/' literal way to construct a RegExp object, as we need to interpolate variable
    
    for (i = 0; i < document.links.length; i++)
    {
        if (document.links[i].href && document.links[i].href.match(test))
        document.links[i].style.background = 'yellow';
    }
    
}
}
function init()
{
	// quit if this function has already been called
	if (arguments.callee.done) return;

	// flag this function so we don't do the same thing twice
	arguments.callee.done = true;

	if (window.addEventListener)
    	window.addEventListener("DOMContentLoaded", highlight, false); //changed from "load" to "DOMContentLoaded" ff/mozilla non-standard
	else if (window.attachEvent)
    	window.attachEvent("onload", highlight);
	else
    	window.onload = highlight;
}
    
init();
