$(function() 
{
	// initialize scrollable 
	$("div.scrollable").scrollable(
	{
		size: 7
	}); 

	$(".items img").click(function() { 
	 
		// calclulate large image's URL based on the thumbnail URL (flickr specific) 
		var url = $(this).attr("src").replace("_thumb", ""); 
	 	var wrap = $("#image_wrap");
		
		$('#CaptionBar').children('p').text($(this).attr('alt'));
		
		// get handle to element that wraps the image and make it semitransparent 
		if(!$.browser.msie || $.browser.msie && $.browser.version != '6.0')
		{
			wrap.fadeTo("medium", 0.5); 
	 
			// the large image from flickr 
			var img = new Image(); 
		 
			// call this function after it's loaded 
			img.onload = function() { 
		 
				wrap.fadeTo("fast", 1); 
		 
				// change the image 
				wrap.find("img").attr("src", url); 
		 
			}; 
		 
			// begin loading the image from flickr 
			img.src = url; 
		}
		else
		{
			wrap.find('img').attr('src', url);	
		}
	 
	// when page loads simulate a "click" on the first image 
	}).filter(":first").click();

}); 