if(typeof(Linkify)=='undefined') Linkify = {}

Linkify.Html = {
    go: function(){ try {
        var notInTags=['a', 'head', 'noscript', 'option', 'script', 'style', 'title', 'textarea'];
        var res = document.evaluate("//text()[not(ancestor::"+notInTags.join(') and not(ancestor::')+")]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 
        var i, el, l, m, p, span, txt, urlRE=/((?:https?|ftp):\/\/[^\s'"'<>()]*|[-\w.+]+@(?:[-\w]+\.)+[\w]{2,6})/gi;
        for (i=0; el=res.snapshotItem(i); i++) {
            txt=el.textContent;
            span=null;
            p=0;
            while (m=urlRE.exec(txt)) {
                if (null==span) {
                    span=document.createElement('span');
                }

            l=m[0].replace(/\.*$/, '');
            span.appendChild(document.createTextNode(txt.substring(p, m.index)));
            a=document.createElement('a');
            a.className='linkifyplus';
            a.appendChild(document.createTextNode(l));
            if (-1==l.indexOf('://')) l='mailto:'+l;
            a.setAttribute('href', l);
            span.appendChild(a);
            p=m.index+m[0].length;
        }
        if (span) {
            span.appendChild(document.createTextNode(txt.substring(p, txt.length)));
            el.parentNode.replaceChild(span, el);
        }
    }
    } catch(e) {dump('Linkify Plus Error ('+e.lineNumber+'): '+e+'\n');} }
}

Linkify.addLoadEvent = function(f) {
    var old = window.onload;
    if (typeof old != 'function') {
        window.onload = f;
    }
    else {
        window.onload = function() { old(); f()}
    }
}

Linkify.addLoadEvent(Linkify.Html.go)
