/**
 * Use this script to set the target attribute for external links
 * per JavaScript.
 *
 * @author Mario Volke <mario.volke@webholics.de>
 * @copyright 2007 Mario Volke
 */
 
function setExternalLinks() {
    if (!document.getElementsByTagName) {
        return false;
    }
    
    var anchors = document.getElementsByTagName("a");
    
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        
        if (anchor.getAttribute('rel') == 'external' && anchor.getAttribute('href')) {
            anchor.setAttribute('target', '_blank');
        }
    }
}

window.onload = setExternalLinks;
