// this file is used for creating the gallery image viewer (large image view)



function openViewer(src, caption)
{
		//set image
		$('#imageViewerFile').attr('src',src);

		//set caption
		$('#imageViewerCaptionText').html(caption);
		
		//set size
		$('#imageViewer').width($(document).width() - 112);
		$('#imageViewer').height($(document).height());	
		
		//show
		$('#imageViewer').show();
		
}

function viewerSetup()
{

	//when a thumbnail gets clicked
	$('.gallimg').click(function(){ 
	
		//grab caption
		caption = $(this).next(".caption").html();
		//grab src 
		var src_array=$(this).attr("src").split("_");
		
		src = src_array[0] + "_" + src_array[1] + "_" + src_array[2] + ".jpg";
		
		openViewer(src, caption);
	
	});
	
	$('#imageViewerClose').click(function(){ $('#imageViewer').hide();  });


}
