/*
 * Firstly, we assume that jQuery is available.
 * 
 * Checks all "a href" links in the html pages,
 * it checks if the links are inbound or outbound links
 * if outbound then it will  track them
 */

try {
$(document).ready(function() {
	$('a').click(function() {
		// check whether hostname of the link is non-local
		if (!(this.href.indexOf(location.host) >=0)) {
		    $.post('/tracker/add', {outbound_link : this.href}, {});
		}
	    });
    });
} catch (e) {
    // probably no jQuery loaded
    // do nothing
}

