$(document).ready(function() {
  $('div#content a, div#contentbottom a').each(function() {
    var $atag = $(this);
    var href = $atag.attr('href');
    
    var regex = new RegExp('^http:\/\/'+document.location.hostname);
    var regex2 = new RegExp('^http');
    if(href && !regex.test(href) && regex2.test(href)) {
      $atag.click(function() {
        window.open(href,'_blank');
        return false;
      });
    }
  });
});

