$(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');

    $('<div>You are leaving Popular Association Banking website by clicking on the following link <br /> '+(link)+' <br /> are you sure you want to proceed?</div>').dialog({
      title: "Popular Association Banking",
      modal : true,
      overlay: {
        backgroundColor: '#000',
        opacity: 0.5
      },
      buttons: {
        'Okay': function() {
          $(this).dialog('close').remove();
          window.open(link);
        },
        'Cancel': function() {
          $(this).dialog('close').remove();
          return false;
        }
      }
    });

    return false;
  });
});
