I need some help to create jquery script :) I have some of link like this on my HTML.
Google
This function seems to be easier if you have a subdomain:
$('a').attr('target', function() { if(this.host == location.host) return '_self' else return '_blank' });