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.onclick = function () { popup(this.getAttribute("href"), 350, 500); return false; };
        }
        else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external_landscape")
        {
            anchor.onclick = function () { popup(this.getAttribute("href"), 500, 350); return false; };
        }
        else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "newwindow")
        {
            anchor.target = "_blank";
        }
        else if (anchor.getAttribute("rel") == "selfclose")
        {
            this.window.close();
        }
    }
}

function popup(popurl, wwidth, wheight)
{
    var popWindow = window.open(popurl,"popup","width="+wwidth+",height="+wheight+",status,scrollbars,resizable");
    popWindow.focus();
    return popWindow;
}