$(document).ready(addTrackingToOutboundLinks);

function addTrackingToOutboundLinks()
{
	var server = window.location.href.replace(/https?:\/\//, "").replace(/www\./, "").replace(/\-/, "").split("/")[0];
	$("a").each(
		function() {
			var url = this.href;
			if (
				url.length > 0 
				&& url.indexOf(server) == -1 
				&& url.indexOf("javascript:") == -1
				&& !url.match(/mass-?vacation.com/)
			)
			{
				$(this).click(trackLink);
			}
		}
	)
}

function trackLink()
{
	$.post("/_reports/link_tracking.php", {url: this.href, page: window.location.href, org_id: $.query.get('org_id'), event_id: $.query.get('evt_id')});
}