function expandThumbnail(theTarget)
{
	var theBody = document.getElementsByTagName("body")[0];
	var theCanvasShadow = document.getElementById("canvasShadow");
	var theCloseLink = document.createElement("a");
	var theContentHeight = 561;
	var theDD = document.createElement("dd");
	var theDDInner = document.createElement("div");
	var theDL = document.createElement("dl");
	var theDT = document.createElement("dt");
	var theIDNum = 0;
	var theImage = document.createElement("img");
	var theLinksContainer = document.createElement("div");
	var theNextLink = document.createElement("a");
	var thePreviousLink = document.createElement("a");
	var theSpan = document.createElement("span");
	
	theIDNum = parseInt(this.id.replace(/.*thumbnailLink(.).*/, "$1"));

	theCanvasShadow.innerHTML = "";

	theBody.style.backgroundColor = "#000000";
	theCanvasShadow.className = "on";
	
	theImage.id = "exampleImage";
	theImage.src = this.href.replace(/\?.*/, "");
	theImage.width = this.href.replace(/.*\?(.*),.*/, "$1");
	theImage.height = this.href.replace(/.*,/, "");
	theImage.alt = this.title.replace(/View full size /, "");
	
	theDL.style.width = theImage.width + 10 +"px";
	theDL.style.marginTop = parseInt((theContentHeight - theImage.height - 10 - 27 - 10) / 2) + "px";
	
	theSpan.innerHTML = theImage.alt;
	
	theLinksContainer.id = "linksContainer";

	thePreviousLink.className = "previousLink";
	
	if (document.getElementById("thumbnailLink" + (theIDNum - 1)))
	{
		var thePreviousThumbnail = document.getElementById("thumbnailLink" + (theIDNum - 1));
		
		thePreviousLink.id = thePreviousThumbnail.id + "Previous";
		thePreviousLink.href = thePreviousThumbnail.href;
		thePreviousLink.onclick = expandThumbnail;
		thePreviousLink.title = thePreviousThumbnail.title;
	}
	else
	{
		thePreviousLink.name = "none";
		thePreviousLink.className += " off";
	}

	theCloseLink.id = "closeLink";	
	theCloseLink.href = "#";
	theCloseLink.onclick = closeThumbnail;
	theCloseLink.title = "Close this image";
	
	theNextLink.className = "nextLink";	
	
	if (document.getElementById("thumbnailLink" + (theIDNum + 1)))
	{
		var theNextThumbnail = document.getElementById("thumbnailLink" + (theIDNum + 1));
		
		theNextLink.id = theNextThumbnail.id + "Previous";
		theNextLink.href = theNextThumbnail.href;
		theNextLink.onclick = expandThumbnail;
		theNextLink.title = theNextThumbnail.title;
	}
	else
	{
		theNextLink.name = "none";
		theNextLink.className += " off";
	}

	theDT.appendChild(theImage);
	theDDInner.appendChild(theSpan);
	theDD.appendChild(theDDInner);
	theDL.appendChild(theDT);
	theDL.appendChild(theDD);
	theCanvasShadow.appendChild(theDL);
	theLinksContainer.appendChild(thePreviousLink)
	theLinksContainer.appendChild(theCloseLink)
	theLinksContainer.appendChild(theNextLink)
	theCanvasShadow.appendChild(theLinksContainer);
	
	return false;
}




function closeThumbnail()
{
	var theBody = document.getElementsByTagName("body")[0];
	var theCanvasShadow = document.getElementById("canvasShadow");
	
	theBody.style.backgroundColor = "#111111";
	theCanvasShadow.className = "";
	
	return false;
}




function nextThumbnail()
{
	
}




function previousThumbnail()
{
}
