        addEvent(window, "load", makeNiceTitles);

        var XHTMLNS = "http://www.w3.org/1999/xhtml";
        var CURRENT_NICE_TITLE;
        var browser = new Browser();

        function makeNiceTitles() {
            
            if (!document.createElement || !document.getElementsByTagName) return;
            // add namespace methods to HTML DOM; this makes the script work in both
            // HTML and XML contexts.
            if(!document.createElementNS)
            {
                document.createElementNS = function(ns,elt) {
                    return document.createElement(elt);
                }
            }
        }

        function getMousePos(e) {
            
            var posx = 0;
            var posy = 0;
            
            if (!e) var e = window.event;
            if (e.pageX || e.pageY)
            {
                posx = e.pageX;
                posy = e.pageY;
            }
            else if (e.clientX || e.clientY)
            {
                posx = e.clientX + document.body.scrollLeft;
                posy = e.clientY + document.body.scrollTop;
            }

            return [posx, posy];
        }
        
        function findPosition( oLink ) {
            if( oLink.offsetParent ) {
                for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
                    posX += oLink.offsetLeft;
                    posY += oLink.offsetTop;
                }
                return [ posX, posY ];
            } else {
                return [ oLink.x, oLink.y ];
            }
        }

        function showNiceTitle(e) {
            if (CURRENT_NICE_TITLE) hideNiceTitle(CURRENT_NICE_TITLE);
            if (!document.getElementsByTagName) return;
            if (window.event && window.event.srcElement) {
                lnk = window.event.srcElement
            } else if (e && e.target) {
                lnk = e.target
            }
            if (!lnk) return;
            if (lnk.nodeType == 3) {
                // lnk is a textnode -- ascend parents until we hit a link
                lnk = getParent(lnk,"A");
            }
            if (!lnk) return;
            nicetitle = lnk.getAttribute("nicetitle");

            var d = document.createElementNS(XHTMLNS,"div");
            d.className = "nicetitle";
            tnt = document.createTextNode(nicetitle);
            d.appendChild(tnt);

            mpos = getMousePos(e);
            mx = mpos[0];
            my = mpos[1];

            d.style.left = (mx + 10) + 'px';
            d.style.top = (my + 10) + 'px';

            document.getElementsByTagName("body")[0].appendChild(d);

            CURRENT_NICE_TITLE = d;
        }

        function hideNiceTitle(e) {
            if (!document.getElementsByTagName) return;
            if (CURRENT_NICE_TITLE) {
                document.getElementsByTagName("body")[0].removeChild(CURRENT_NICE_TITLE);
                CURRENT_NICE_TITLE = null;
            }
        }

        // Add an eventListener to browsers that can do it somehow.
        // Originally by the amazing Scott Andrew.
        function addEvent(obj, evType, fn){
            if (obj.addEventListener){
                obj.addEventListener(evType, fn, false);
                return true;
            } else if (obj.attachEvent){
                var r = obj.attachEvent("on"+evType, fn);
                return r;
            } else {
                return false;
            }
        }

        function getParent(el, pTagName) {
            if (el == null) return null;
            else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase())	// Gecko bug, supposed to be uppercase
            return el;
            else
            return getParent(el.parentNode, pTagName);
        }

        // Determine browser and version.

        function Browser() {
            // blah, browser detect, but mouse-position stuff doesn't work any other way
            var ua, s, i;

            this.isIE    = false;
            this.isNS    = false;
            this.version = null;

            ua = navigator.userAgent;

            s = "MSIE";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isIE = true;
                this.version = parseFloat(ua.substr(i + s.length));
                return;
            }

            s = "Netscape6/";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isNS = true;
                this.version = parseFloat(ua.substr(i + s.length));
                return;
            }

            // Treat any other "Gecko" browser as NS 6.1.

            s = "Gecko";
            if ((i = ua.indexOf(s)) >= 0) {
                this.isNS = true;
                this.version = 6.1;
                return;
            }
        }