// Applies window.open events to any offsite links, and adds a CSS class to define an external link icon
function styleLinks (){
	$('a').each(function() {
		var docDomain = 'http://' + document.domain;
		if ( ( (this.href).substr(0,docDomain.length) != docDomain)
		 	&& ((this.href).substr(0,6) != 'mailto' )) {
			if (!($(this).children('img').length)) {
				$(this).addClass('external');	
			}
			$(this).click( function() {
				window.open( $(this).attr('href') );
				return false;
		    });
		}
		
	});
}

function styleTable() {
	$('div.content table').each(function() {
		var rcount = 0;
		$(this).find('tr').each(function() {
			if (rcount%2 == 0) $(this).addClass('highlight');
			rcount++;
		});
	});
}

$(document).ready(function(){
	styleLinks();
	styleTable();
});
