$(document).ready(function() {
  // Creating custom :external selector
  $.expr[':'].external = function(obj){
      return !obj.href.match(/^mailto\:/)
              && (obj.hostname != location.hostname);
  };

  // Add 'external' CSS class to all external links
  $('a:external').addClass('external');

  $('.external').click(function() {
    var link = $(this).attr('href');

	var leave = confirm('By accessing the noted link, you will be leaving the Polonia Bank website and entering a website hosted by another party. Polonia Bank has not approved this as a reliable partner site. Please be advised that you will no longer be subject to, or under the protection of, the privacy and security policies of the Polonia Bank website. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different than those of Polonia Bank.');
	
	if (leave == true) {
		window.open(link);
	} else {
		return false;
	}

    return false;
  });
});
