$(document).ready(function() {
	
	// Update wordpress generated navigation if in a subpage
	$link = null;
	$url = document.location.href;
	$('#sidebar ul a').each(function() {
		$href = $(this).attr('href');
		if ($href == $url.substring(0, $href.length)) $link = $(this);
	});
	if ($link != null) $link.parent().addClass('current_page_item');
	$('#sidebar ul ul a').each(function() {
		$(this).prepend('<span>- </span>');
	});
	
	// Initialise shadowbox, load skin separately in header because of cms
	Shadowbox.init({
		skipSetup: true,
		handleOversize: 'resize'
	});
	
	// Setup shadowbox manually as links with images are managed by wordpress, exlcude location page as it destroys google maps
	if ($('#map').length == 0) {
		Shadowbox.setup($('#content a:has(img)'));
		Shadowbox.setup($('#content p.letterJpg a'));
	}

	$('tr:even').addClass('even');
});