$(document).ready(function() {

  $('a[href^="mailto"]').click(function(event){
    var scrollTop = $(window).scrollTop();
    var link = $(this).attr('href');
    event.preventDefault();  
    $('body').append('<div class=\"modalOverlay\"><div class=\"overlay\"></div><div style=\"top: ' + scrollTop + 'px;\" class=\"modal\"><p><strong>Note:</strong> Email is unencrypted! Please do not send sensitive information, such as account numbers, social security numbers, or other nonpublic information etc via email.</p><a class=\"UIButton\" href=\"' + link + '\">accept</a><a class=\"UIButton\" href=\"#\">cancel</a></div></div>');    
    $('.modal > a').click(function(){
      $('.modalOverlay').remove();
    });  
  });
  
  $('a[href^="http"]').click(function(event){
    if(!$(this).hasClass('trusted')){
      var scrollTop = $(window).scrollTop();
      var link = $(this).attr('href');
      event.preventDefault();
      $('body').append('<div class=\"modalOverlay\"><div class=\"overlay\"></div><div style=\"top: ' + scrollTop + 'px;\" class=\"modal\"><p><strong>Note:</strong> You are leaving TrustAtlantic Bank\'s website. Links that may be accessed via this site are for the convenience of informational purposes only. Any information, products, services or recommendations accessed through this link are not provided or guaranteed by TrustAtlantic Bank. The site you are about to visit may have a privacy policy and or a security policy that is different than TrustAtlantic Bank. Please review their privacy and Security policies. TrustAtlantic Bank does not endorse the content contained in these sites, nor the organizations publishing those sites, and 	hereby disclaims any responsibility for such content. You have clicked on a link to a third party Web site. The Web site is not owned or operated by TrustAtlantic. Bank. TrustAtlantic Bank is not responsible for the content of this site.</p><a class=\"UIButton\" href=\"' + link + '\" target=\"offsite\">accept</a><a class=\"UIButton\" href=\"#\">cancel</a></div></div>');    
      $('.modal > a').click(function(){
        $('.modalOverlay').remove();
      });
    }
  });
  
});
