	

	function submitCartForm(product, quantity)
	{	
		document.cartForm.product.value = product;
		document.cartForm.quantity.value = quantity;
		document.cartForm.submit();
	}
	
	function showSubMenu(subID, menuItem)
	{
		var subMenu = document.getElementById('sub_' + subID);
		if(menuItem)
		{
			subMenu.style.left = (findLeft(menuItem) - 50) + 'px';
			subMenu.style.top = (findTop(menuItem) + menuItem.clientHeight - 22) + 'px';
			//alert(menuItem.clientHeight);
		}
		subMenu.style.visibility = 'visible';
	}

	function hideSubMenu(subID)
	{
		document.getElementById('sub_' + subID).style.visibility = 'hidden';
	}

	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 && parent1 > 7) showSubMenu(parent1);
		if (parent2 && parent2 > 7) 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 mailto(recipient)
	{
		document.location.href = 'mailto:' + recipient + '@tfp-architects.co.uk?subject=Website Enquiry';
	}
	
	function goTo(url)
	{
		document.location.href = url;
	}

	function openWindow(url, width, height, sizeable)
	{
		if (sizeable) sizeable = ',resizable,scrollbars'
		else sizeable = '';
		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();
	}
	
	
	
	var curOpen = '';
	function boxClick(divToResize)
	{
		//Check to see if this is the first click, if so don't close any div's
		if(curOpen!='')
		{
			new Effect.BlindUp(curOpen, {duration: 0.6, scaleTo: 5} );
			document.getElementById(curOpen + 'Arrow').src = "/images/pf_arrow_right.jpg"
		}
		//Check to see if the user has not clicked on the open div
		if(divToResize!=curOpen)
		{
			new Effect.BlindDown(divToResize, {duration: 0.6, delay: 0.6, scaleFrom: 5});
			curOpen = divToResize;
			document.getElementById(divToResize + 'Arrow').src = "/images/pf_arrow_down.jpg"
		}
		else
		{
			curOpen = ''
			
		}
	}