
/* 

This function opens a link in external window
source: http://www.sitepoint.com/article/standards-compliant-world/3/

add this to the header of the xhtml file
<script type="text/javascript" src="./js/externalLinks.js">
</script>

and add the "rel" attribute with the value "external"
<a href="http://www.w3.org/" rel="external">http://www.w3.org/</a>

*/
function externalLinks()
{
    if( ! document.getElementsByTagName ) return;
    var anchors = document.getElementsByTagName( "a" );
    for( var i = 0; i < anchors.length; i++ )
    {
        var anchor = anchors[ i ];
        if( anchor.getAttribute( "href" ) &&
        anchor.getAttribute( "rel" ) == "external" )
        anchor.target = "_blank";
    }
}
window.onload = externalLinks;
