var galleryPopupHook = function(linkId,relName,relName2)
{
	// html references and popup window properties
	this.galleryLink = (linkId && document.getElementById(relName)) ? document.getElementById(relName) : document.getElementById("gallerybox_popup");
	this.galleryLinkImage = (linkId && document.getElementById(relName2)) ? document.getElementById(relName2) : document.getElementById("gallerybox_popup_image");
	this.windowHeight = 700;
	this.windowWidth = 1000;
	this.windowSettings = "height=" + this.windowHeight + ",width=" + this.windowWidth + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no";
	// Not sure if I'll even end up using relName, but it may come in useful at some unforeseen point.
}
galleryPopupHook.prototype =
{
	initalise:function()
	{
		var objRef = this;
		if(this.galleryLink != null) // check we have a link to hang the popup on.
		{
			this.galleryLink.onclick=function()
			{
				objRef.handleClick();
				return false; // Cancel the hyperlink.
			}
		}
		
		if(this.galleryLinkImage != null) {
			this.galleryLinkImage.onclick=function()
			{
				objRef.handleClick2();
				return false; // Cancel the hyperlink.
			}
		}
	},
	handleClick:function()
	{
		var popupLocation = this.galleryLink.href; // Where are we going?
		window.open(popupLocation,"gallerybox_popup",this.windowSettings); // Okay, lets load it in a popup instead.
	},
	
	handleClick2:function()
	{
		var popupLocation = this.galleryLinkImage.href; // Where are we going?
		window.open(popupLocation,"gallerybox_popup",this.windowSettings); // Okay, lets load it in a popup instead.
	}
}
