Adding NoFollow and Target Blank To Ghost Links Using Javascript

$('a').each(function() {
var a = new RegExp('/' + .host + '/');
if(!a.test(this.href)) {
$(this).attr('rel','nofollow');
$(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});
}
});