$(document).ready(function() {
	
	/* open links with rel="external" in new window and amend link title */
	$('a[rel*="external"]').each(function() {
		var title = $(this).attr('title') ? $(this).attr('title') + ' (opens in a new tab or window)' : 'This link will open in a new tab or window';
		$(this).attr('title',title).click(function() {
			window.open($(this).attr('href'));
			return false;
		});
	});
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal',
		padding: 30,
		opacity: 0.55,
		showTitle: true,
		allowresize: true,
		counter_separator_label: '/',
		theme: 'facebook',
		callback: function(){}
	});
	
	$('#menu li ul').hide();

	$('#menu li a').hover(function() {
		if($(this).parent().find('ul')) {
			$(this).parent().find('ul').show();
		};
	}, function() {
		$(this).parent().find('ul').hide();
	});

	$('#menu li ul').hover(function() {
		$(this).show();
	}, function() {
		$(this).hide();
	});

});
