	function showSpeechBubble(subID, menuItem)
	{
		var subMenu = document.getElementById('sub_' + subID);
		if(menuItem)
		{
			subMenu.style.left = (findLeft(menuItem) + 35) + 'px';
			subMenu.style.top = (findTop(menuItem) + menuItem.clientHeight + 15) + 'px';
		}
		subMenu.style.display = '';
	}
	
	function showSpeechBubbleRight(subID, menuItem)
	{
		var subMenu = document.getElementById('sub_' + subID);
		if(menuItem)
		{
			subMenu.style.left = (findLeft(menuItem) - 245) + 'px';
			subMenu.style.top = (findTop(menuItem) + menuItem.clientHeight + 15) + 'px';
		}
		subMenu.style.display = '';
	}
	
	function showSearchDD(subID, menuItem)
	{
		var subMenu = document.getElementById('sub_' + subID);
		if(menuItem)
		{
			subMenu.style.left = (findLeft(menuItem) - 235) + 'px';
			subMenu.style.top = (findTop(menuItem) + menuItem.clientHeight - 3) + 'px';
		}
		subMenu.style.display = '';
	}

	function hideSubMenu(subID)
	{
		document.getElementById('sub_' + subID).style.display = 'none';
	}

	function hideDropdown(subID, parent1, parent2)
	{
		document.getElementById('sub_' + subID).style.visibility = 'hidden';
		if (parent1) hideSubMenu(parent1);
		if (parent2) hideSubMenu(parent2);
	}
	
	function showDropdown(subID, menuItem, parent1, parent2)
	{
		var subMenu = document.getElementById('sub_' + subID);
		if(menuItem)
		{
			subMenu.style.left = (findLeft(menuItem) + menuItem.offsetWidth) + 'px';
			subMenu.style.top = findTop(menuItem) + 'px';
		}
		if (parent1) showSubMenu(parent1);
		if (parent2) showSubMenu(parent2);
		subMenu.style.visibility = 'visible';
	}
	
	function findLeft(obj)
	{
		var curleft = 0;
		if (obj.offsetParent) {
			curleft = obj.offsetLeft;
			while (obj = obj.offsetParent) curleft += obj.offsetLeft;			
		}
		return curleft;
	}
	
	function findTop(obj)
	{
		var curtop = 0;
		if (obj.offsetParent) {
			curtop = obj.offsetTop
			while (obj = obj.offsetParent) {curtop += obj.offsetTop}
		}
		return curtop;
	}
	
	var newImage, imageList, preloadCount, preloadInterval;
	var preloadCount = 0;
	imageList = new Array();
	
	function addPreloadImage(url)
	{
		imageList[imageList.length] = url;
	}
	
	function startPreloading()
	{ 
		if(imageList.length != 0)
		{
			newImage = new Image;
			newImage.src = imageList[0]
			preloadInterval = setInterval('preloadCheck()', 1000);
		}
	}
	
	function preloadCheck()
	{
		if (newImage.complete)
		{
			preloadCount += 1;
			if (preloadCount < imageList.length)
			{
				newImage.src = imageList[preloadCount];
				clearInterval(preloadInterval);
				preloadInterval = setInterval('preloadCheck()', 1000);
			}
			else
			{
				clearInterval(preloadInterval);
			}
		}
	}
	
	function imageSwap(key, url)
	{
		eval('document.' + key + '.src = \'' + url + '\'');
	}
	
	function swapSky(key, mouseOn)
	{
		if (!mouseOn) eval('document.' + key + '.src = \'/images/services/' + key + '.gif\'');
		else eval('document.' + key + '.src = \'/images/services/' + key + 'Light.gif\'');
	}

	function mailto(recipient)
	{
		document.location.href = 'mailto:' + recipient + '@perco.co.uk?subject=Website Enquiry';
	}
	
	function goTo(url)
	{
		document.location.href = url;
	}

	function openWindow(url, width, height, sizeable)
	{
		if (sizeable==null) sizeable=true;
		if (sizeable) sizeable = ',resizable,scrollbars'
		else sizeable = '';
		if (!width) width=screen.availWidth*.8;
		if (!height) height=screen.availHeight*.8;
		var openWin = window.open(url,'_blank','width=' + width + ',height=' + height + ',screenX=' + ((screen.availWidth-width)/2) + ',left=' + ((screen.availWidth-width)/2) + ',screenY=' + ((screen.availHeight-height)/2) + ',top=' + ((screen.availHeight-height)/2) + sizeable);
		openWin.focus();
	}
	
//#-- VARIABLE TO TRACK IF CURRENT FORM FIELD IS A TEXT AREA - IF SO, microsoftKeyPress SHOULDN'T RUN
var textArea = false;
//#-- FUNCTION TO HANDLE KEYPRESSES IN IE BROWSERS
	function microsoftKeyPress() 
	{	
		if (!textArea)
		{
	  	  if (window.event.keyCode == 13)
			{
				submitForm();
				window.event.returnValue = false;
			}
		}
	}
