$(document).ready(function(){
		
	$(window).load(function () {
		
		//Configuration Options
		var max_width = 640; 	//Sets the max width, in pixels, for every image
		var selector = 'img'; 	//Sets the syntax for finding the images.  Defaults to all images.
		
		//For images inside of a particular element (id="abc") or class (class="abc"),
		//use '.abc img' or '#abc img' respectively.  Don't leave off the img tag!!!
		//End configuration options.  You don't need to change anything below here.
		
		$(selector).each(function(){
			
			var width = $(this).width();
			var height = $(this).height();
			
			if (width > max_width) {
			
				//Set variables	for manipulation
				var ratio = (height / width );
				var new_width = max_width;
				var new_height = (new_width * ratio);
				
				//Shrink the image and add link to full-sized image
				$(this).height(new_height).width(new_width);
				
				$(this).hover(function(){
					$(this).attr("title", "This image has been scaled down.  Click to view the original image.")
					$(this).css("cursor","pointer");
				});
					
				$(this).click(function(){
					window.location = $(this).attr("src");
				});
				
			} //ends if statement
			
		}); //ends each function
		
	}); //ends load function
	
   
	// for loading a few links into a new window
	$('A[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
});