//  requires "DOM.js"

if (!encodeURI) { var encodeURI = escape; }

function Here() {
    onLoad(function() {
        elements({tag: 'a'}).each(Here.processAnchor);
    });
}
    
Here.processAnchor = function (a) {
    var encodedAnchorHref = encodeURI(a.href.replace('///', '/'));
    var encodedLocation = encodeURI(location.href.replace('///', '/'));
    if (encodedAnchorHref == encodedLocation) {
        var anchorText = a.childNodes[0];
        var hereSpan = document.createElement('span');
        addClass(hereSpan, 'here');
        hereSpan.title = "You are here."
        hereSpan.appendChild(anchorText);
        a.parentNode.replaceChild(hereSpan, a); 
    } 
}

Here();
