/**
 * jQuery functions file
 *
 * @author Martin Bean <martin@mcbwebdesign.co.uk>
 **/
$(document).ready(function() {
	externalLinks();
	partnerLinks();
});

/**
 * Opens non-local links in a new window; replacement for target="_blank" in XHTML 1.0 strict
 */
function externalLinks() {
	$('a[rel="external"]').each(function() {
		var oldTitle = $(this).attr('title');
		var newTitle = $(this).attr('title', oldTitle + ' (opens in a new window)');
		$(this).addClass('external');
		$(this).click(function() {
			window.open(this.href);
			return false;
		});
	});
};

/**
 * Gently fades in partner links to combat stark contrast of normal roll-over
 * @todo investigate why $(this + ' img') wasn't working as a selector within the hover function
 */
function partnerLinks() {
	$('#partners li a').each(function() {
		$(this).hover(function() {
			var img = '#partners li#' + this.parentNode.id + ' a img';
			$(img).hide();
			$(img).fadeIn(200);
		});
	});
}