//safelist the code uses to determine internal links, all others are considered external and will fire the external link lightbox
//add to safeList as needed
//Lightbox styling is controlled through colorbox.css in /jquery/css/
//tagg@millermeiers.com
var safeList = new Array('millermeiersclient.com', 'www.millermeiersclient.com', 'securemail.cornerbanks.com', 'cornerbanks.com', 'www.cornerbanks.com','www.cornerbank.com','cornerbank.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 == 'www.cornerbanksonline.com') { return false; }
		if (a.hostname == 'www.netteller.com') { return false; }
		if (a.hostname == 'securemail.cornerbanks.com') { 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;
    }});

//fires the hidden div externalLinkWarning when an external link is clicked
$(document).ready( function(){
	 $('a:external').click(function(e) {
	 	$(this).colorbox({width:"545px", inline:true, href:"#externalLinkWarning", onOpen:function(){ var href=$(this).attr('href'); $('#lightboxProceedBtn').attr('href',href); }
		}); // Selects all anchors which link to external site/page
	});
});
