// google analytics - track outbound links

function ga_outbound_init() {
    var basedom = document.domain.replace(/^(http:\/\/|https:\/\/)*(www\.)*/i, '');

    $$('a').each(function(a) {
        // skip js link
        if (a.href.indexOf('javascript:') != -1) {
            return;
        }
    
        var uh = a.href.replace(/^(http:\/\/|https:\/\/)*(www\.)*/i, '');
        var ud = uh.substring(0, uh.indexOf('/'));
        
        if (ud != basedom) {
            Event.observe(a, 'click', function() { urchinTracker('/outgoing/' + uh); });
        }
    });
}
