function makeExternalLinks() { 

 if (!document.getElementsByTagName) return; 
 
 var aTags = document.getElementsByTagName("a"); 
 var aTagsLength = aTags.length;
 
    for (var i=0; i<aTagsLength; i++) { 
    var thisA = aTags[i]; 
        if (thisA.getAttribute("href") && thisA.getAttribute("rel") == "ext") {
            thisA.target = "_blank"; 
            thisA.title = thisA.title + " (opens in a new window)";
        }
    } 
}

function makePopUps() { 

 if (!document.getElementsByTagName) return; 
 
 var aTags = document.getElementsByTagName("a"); 
 var aTagsLength = aTags.length;
 
    for (var i=0; i<aTagsLength; i++) { 
    var thisA = aTags[i]; 
        if (thisA.getAttribute("href") && thisA.getAttribute("rel") == "popUp") {
            thisA.title = thisA.title + " (opens in a new window)";
            thisA.href = "javascript:popUp('"+thisA.href+"');";
        }
    } 
}


function popUp(sUrl) {
        newWin = window.open (sUrl,"mywindow","location=0,status=0,scrollbars=1,width=450,height=500,left=200,top=200");
        newWin.focus();
        newWin.moveTo(100,100);
}



// api_addEvent() 
// Gets around the problem of having multiple onload handlers
// http://www.onlinetools.org/articles/unobtrusivejavascript/chapter4.html
// http://www.quirksmode.org/js/events_advanced.html
function api_addEvent(obj, evType, fn) { 
    // W3C type of event registration model
    if (obj.addEventListener) { 
        obj.addEventListener(evType, fn, false); 
        return true; 
    // MS event registration model    
    } else if (obj.attachEvent) { 
        return obj.attachEvent("on"+evType, fn); 
    // Bad browsers that can't do either
    } else { 
        return false; 
    } 
}


api_addEvent(window, 'load', makeExternalLinks);
api_addEvent(window, 'load', makePopUps);

