function initGallery()
{
	$(".img-box/img").each(function(i){
			centreGalleryImg($(this));
		});
	
	$('.gallery a').click(function(){return false;});
	
	$(".gallery img").click(function(event)
	{
		
		var strID = event.target.id;
		
		//get the gallery block
		var strGalleryID = $(event.target).parents("div.gallery-box").attr('id');

		$("#"+strGalleryID+" .img-box img[@id!='large"+strID+"']").hide();
		
		$('#large'+strID).fadeIn("slow");
		//$("#"+strGalleryID+"/.mainpiccontainer").height($('#large'+strID).height());

		$('#large'+strID).load(
			function()
			{
				centreGalleryImg($('#large'+strID));
			}
		);
		
		
	});
}

function centreGalleryImg(oImage)
{
	/*
		if (oImage.width() > 0 && oImage.height() > 0)
		{
			var intLeftMargin = Math.floor((551 - oImage.width())/2);
			if (intLeftMargin <= 1) intLeftMargin = 0;
	
			var intTopMargin = Math.floor((369 - oImage.height())/2);
			if (intTopMargin <= 1) intTopMargin = 0;
			
			oImage.css("margin-left",intLeftMargin);
			oImage.css("margin-top",intTopMargin);
		}
	*/	
		
}

function initCommentForm()
{
	$('#showcommentlink').click(function()
	{
		$('#addyourcommentform').slideDown('fast');
		return false;
	});
}