$(document).ready(function()
{
	// XHTML-compliant substitute for "target=_blank"
	$('a[rel=external]').attr('target','_blank');
	$('#target_external').attr('target','_blank');
});

/*
	Using the fancy image error recovery:

   <img class="image_error" src="first_image.jpg">
   <span class="image_error" title="second_image.jpg"></span>
   <span class="image_error" title="third_image.jpg"></span>
*/

function addImageErrorHandlers()
{
	if(typeof(jQuery) != 'undefined')
	{
		// Add error handlers to all images with the image_error class, and remove the class.
		jQuery('img.image_error').removeClass("image_error").error(function(){
   
			// The next span will contain the URL of another image.
			var failoverImage = jQuery(this).next('span.image_error');
            
			if(1 == failoverImage.length && failoverImage.attr('title').length > 0)
			{
				// Assign a new URL to this image.
				jQuery(this).attr('src', failoverImage.attr('title'));
			    			    
				// Remove this failover image, so we'll move on to the next one in the chain.
				failoverImage.remove();
			}
		});
	}
}


