// JavaScript Document

jQuery(document).ready( function() {
	jQuery('.thumbnails a').click( function(){
		img = jQuery(this).find("img")[0].src.replace(/_s.jpg$/g, "_m.jpg");
		title = jQuery(this).find("img")[0].alt;
		gallery = jQuery(this).parents("div.gallery");
		gallery.find('.thumbnails a').removeClass("selected");
		jQuery(this).addClass("selected");
      // set the title and caption
		gallery.find('.focus a img').attr('src', img);
		gallery.find('.focus a').attr('title', title);
		gallery.find('.focus p').html(title);
		return false;
	});
	// only select the first one if multiple galleris on page :(
	jQuery('.thumbnails').map(function(){
		jQuery(this).find("a:eq(1)").click();
	});
});
