All scripts require MooTools 1.2.x unless otherwise stated.

Open all external links in a new window

Tested with MooTools 1.2

Set http:// links to open in a new window automatically.

window.addEvent('domready', function() {
    $$('a[href^=http://]').setProperty('target', '_blank');
});

If for some reason you have all of your links with http:// in them, you will need to use something a bit more complicated. However, I do believe you should look into sorting out your URLs.

window.addEvent('domready', function() {
    var domain_name = 'http://www.yourdomain.com/';
    $$('a').each(function(el) {
        if(el.href.substring(0, a.length - 1) != domain_name) {
            el.setProperty('target', '_blank');
        }
    });
});