How to open links in new window with JQuery

How to open links in new window with JQuery

It is very simple code.
Just have a look and enjoy!

[javascript]

$(document).ready(function() {
$("a[@href^=http]").click(function(){ //find the links pointing to a URL
if(this.href.indexOf(location.hostname) == -1) { //check if they point outside
window.open( $(this).attr(‘href’) ); //force open the new window return false;
}
});

});

[/javascript]