$(document).ready(function(){
	// Do any BC Photo Gallery tables exist?
	if($('table.photogalleryTable').length != 0) {
		// Then add the HS rel attribute to all the image anchors in every album
		// For other lightboxes, e.g., prettyPhoto, substitute their required 'rel' attribute in the next line
		$('td.photogalleryItem a').attr('rel','highslide');
		// For each photogalleryTable, create a unique album id and prepare it's images
		$('table.photogalleryTable').each(function(i) {
			var albumCount = i+1;
			var albumID = "album"+albumCount;
			<!-- var galleryOptions = "miniGalleryOptions"+galleryCount; -->
			// Assign the albumID to the table id
			$(this).attr('id', albumID);
			// For each image anchor within the table assign the album's ID and parse a url to the photo gallery image
			// Parsing requires jquery.url.js and urlEncode.js files to be properly referenced in page/template head
			$('td.photogalleryItem a',this).attr("id",albumID).each(function() {
				var imgPath=$.URLDecode(jQuery.url.setUrl(this.href).param("Image"));
				var imgHost=jQuery.url.setUrl(this.href).attr("host");
				$(this).attr("href","http://"+imgHost+imgPath).addClass('highslide');
			});
		});
	//end if
	}
	// Lightboxes like prettyPhoto often require a universal call be added to the ready function
	// $("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_square'});
//end ready
});