$(document).ready(function() {
 
  // Creating custom :external selector
  $.expr[':'].external = function(obj){
      return !obj.href.match(/^mailto\:/) && (obj.hostname != "asutechnopolis.org") && (obj.hostname != "www.asutechnopolis.org") && (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 now leaving an ASU hosted website and entering an external website.  ASU is not responsible for the content of this website.<br /><br /> Do you wish to continue?</div>').dialog({
      title: "External Link Alert",
      modal : true,
      overlay: {
        backgroundColor: '#000',
        opacity: 0.2
      },
      buttons: {
        'Yes': function() {
          $(this).dialog('close').remove();
          window.location.href=link; 
		  //use the following to have the link open in a new window: "window.open(link);"
        },
        'No': function() {
          $(this).dialog('close').remove();
          return false;
        }
      }
    });
 
    return false;
  });
});