$(document).ready(function() {
	var currentSite = window.location.host;
	
	$('a[href^="http://"]:not(:has(img),:empty,[href*="'+currentSite+'"])').addClass('external_link');
	$('a[href^="https://"]:not(:has(img))').addClass('external_link');
	$('a[href^="http://"]:not([href*="'+currentSite+'"])').attr({
			target: "_blank"
	});
	$('a[href^="https://"]:not([href*="'+currentSite+'"])').attr({
			target: "_blank"
	});
	$('a[href$=".pdf"]').attr({
			target: "_blank"
	});
	// mbakonyi: it's not possible to add class via attr directly (http://www.ventanazul.com/webzine/articles/javascript-expected-identifier-error-internet-explorer)
	$('a[href$=".pdf"]:not(:has(img))').each(function(){
		// mbakonyi: for pdfs within filelinks preview images are generated so no icon needed
		if(!$(this).parents().hasClass('csc-filelinks')){
                        $(this).addClass('pdf');
		}
	});
	$("tr:odd").css("background-color", "#eee");
	
});


