// jQuery script to handle printing of news images
jQuery(document).ready(function($){

	// bind clicks on thumbnails
	var bindClickThumbnails = function() {
		$('.imageThumb').each(
  			
			// For each delete button, bind the onclick behavior.
			function() {
  
				// Bind the onclick event 
				$(this).click(
					function() {
						
						var theId = $(this).attr('id'); // get ID of clicked element, eg: image_123_456
						var imageArray = theId.split('_');
						var postId	= imageArray[1]; 
						var imageId = imageArray[2];
						
						$('#largeImage' + postId).load('/ajax/printNewsImage.php?id=' + imageId);
						
						return false; // return false so the link doesn't actually click anywhere

					}
				);
			}
		);
	};
	
	// bind onclick events on initial pageload
	bindClickThumbnails();

});
