var timeoutID;

function SwapInPhoto(imgSrc)
{
	newImgLink = new String(imgSrc);
	newImgLink = newImgLink.replace(/m\.jpg/g, "b.jpg");
	if (timeoutID)
		window.clearTimeout(timeoutID);
	document.images['MainImage'].src = imgSrc;
	document.getElementById('ImageLink').href = newImgLink;
}

function SwapOutPhoto(imgSrc)
{
	if (timeoutID)
		window.clearTimeout(timeoutID);

	newImgLink = new String(imgSrc);
	newImgLink = newImgLink.replace(/m\.jpg/g, "b.jpg");
	var imgString = "document.images['MainImage'].src = \'"+imgSrc+"\'; document.getElementById('ImageLink').href = \'"+newImgLink+"\'";
	timeoutID = window.setTimeout(imgString, 2000);
}