$(document).ready(function() {
    $('a').each(function(n, el) {
        el = $(el);
        var link = el.attr('href');
        var server = document.location.hostname; // for IE
        if (link && link.search(/^http:\/\//) != -1 && link.indexOf(server) == -1) {
            el.attr('class', 'external');
            el.attr('target', '_blank');
        }
        if (link && link.search(/\.pdf$/) != -1) {
            el.attr('class', 'external');
            el.attr('target', '_blank');
        }
    });
});

function popup(link, w, h)
{
    var url = link.getAttribute('href') + '?popup=true';
    var x = screen.availWidth/2-w/2;
    var y = screen.availHeight/2-h/2;
    window.open(url, 'popup', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',top='+y+',screenX='+x+',screenY='+y);
    return false;
}


