/*
 * jquery utilities
 */


$(document).ready(function () {

	// Detect all the external links and add target blank to open them in a new window. It also adds a title and a class="external" to the link.

		$("#container a[href*='http://'],[href*='https://']:not([href*='"+location.hostname+"'])").attr("target","_blank").addClass("external").attr("title", function(){
		var linkName = $(this).html() + " - This link will open in a new browser window";
		return linkName
		});


	// Detect all pdfs and add a title and a class="pdf" to the link. It also adds a nobullet class to the parent LI.
		$("a[href$='.pdf']").attr("title","This links to a PDF document which can be downloaded and viewed.").addClass("pdf");
        $("a[href$='.pdf']").parent('li').addClass('nobullet');
		  

	// Add the "Print Page" link as first link in #page-tools
		$('<li><a href="#">Print page</a></li>').click(function(){window.print();}).insertBefore('#page-tools > ul li:first-child');

	// FAQs
		$('.faq dd').hide();
		$('.faq .back2top').hide();
		$('dt').hover(function(){$(this).addClass('hover')},function(){$(this).removeClass('hover')}).click(function(){
			$(this).next().slideToggle('normal');
		});

});

