var OffsiteLink = Behavior.create({
  
  notice: "(opens in a new window)",
  
  initialize: function() {
  		this.element.title = [this.element.title, this.notice].join(' ');
  },

  onclick: function(e) {
  	// Abort if a modifier key is pressed
  	if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
  		return true;
  	} else {
  	  var newWindow = window.open(this.element.getAttribute('href'), '_blank');
  		if (newWindow && newWindow.focus) {
  			newWindow.focus();
  		}
      Event.stop(event);
			return false;
  	}
  }
});

Event.addBehavior({
  ".offsite" : OffsiteLink
});
