/**
 * Use this script to set the target attribute for external links
 * per JavaScript.
 * Only tested with JQuery 1.1.3.1
 *
 * @author Mario Volke <mario.volke@webholics.de>
 * @copyright 2007 Mario Volke
 */
 
$(document).ready(
    function() {
        $('a[@rel]').each(
            function() {
                var rel = $(this).attr('rel');
                var parts = rel.split(' ');
                var found = false;
                
                for(var i in parts) {
                    if(parts[i] == 'external') {
                        found = true;
                    }
                }

                if(found) {
                    $(this).addClass('external').attr('target', '_blank');
                }
            }
        );
    }
);
 
/*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;*/
