if (document.getElementsByTagName && document.getElementById)
{
	if (window.addEventListener) window.addEventListener('load', prepareImageSwap, false);
	else if (window.attachEvent) window.attachEvent('onload', prepareImageSwap);
}

//-------------------------------------------------

function prepareImageSwap()
{
//Based upon "Non-Obtrusive Image Swap Script V1.1 by Hesido.com"
// http://www.hesido.com/web.php?page=imageswapping

	elem = document.body;
	var regg = /(.*)(_thumb\.)([^\.]{3,4})$/ 
	var prel = new Array(), img, imgList, imgsrc, mtchd;
	imgList = elem.getElementsByTagName('img');

	for (var i=0; img = imgList[i]; i++)
	{ 
		if (!img.mdownSRC && img.src.match(regg))
		{
			mtchd = img.src.match(regg);
			img.mdownSRC = mtchd[1] + '.' + mtchd[3];
			preLoadImg(img.mdownSRC)
			img.onmousedown = imgSwap;
		}
	}

	function preLoadImg(imgSrc)
	{
		prel[prel.length] = new Image();
		prel[prel.length-1].src = imgSrc;
	}

// added in for the timedCount() function
newText = 'Please <a href="contact.htm" title="Contact Bella Boom Booms">contact us</a> with any enquiry as this is only a small sample of our extensive range.';
oldText = document.getElementById('textSwap').innerHTML;
timedCount();
}

function imgSwap()
{
	document.images.placeholder.src = this.mdownSRC;
}

//----------------------------------------------------

function timedCount()
{
	var swapArea = document.getElementById('textSwap');

	if (swapArea.innerHTML == oldText) swapArea.innerHTML = newText;
	else swapArea.innerHTML = oldText;

	setTimeout("timedCount()", 8000);
}
