// List of websites without a warning
var safeList = new Array('mcedv.org', 'facebook.com', 'twitter.com','squareredmachine.com','google.com');
// Check whether links are external:
// (Only works with elements that have href):
$.extend($.expr[':'], {
    external: function(a, i, m) {
        if (!a.href) { return false; }
        if (a.hostname && a.hostname !== window.location.hostname) {
            var fixedHostname = a.hostname.replace(/^\s+|\s+$/g, '').replace('www.', '').toLowerCase();
            if (jQuery.inArray(fixedHostname, safeList) >= 0) {
                return false;
            }
            else return true;
        }
        else return false;
    }
});
$(document).ready(function() {
    $('a:external').click(function(e) {
    if (confirm('You are now leaving MCEDV.ORG, please press OK to continue or CANCEL to staty.')!=true) 
        e.preventDefault();
 
    }); // Selects all anchors which link to external site/page
});
