	
	var lastFile = '';
	function enlarge(imgPath)
	{
		window.scrollTo(0, 0);
		lastFile = imgPath;
		//alert(imgPath);
		if ($('overlayBlack')) document.body.removeChild($('overlayBlack'));
		if ($('theimg')) document.body.removeChild($('theimg'));
		
		
		var newdiv = document.createElement('div');
		newdiv.setAttribute('id', 'overlayBlack');
		newdiv.innerHTML = '';
		
		document.body.appendChild(newdiv);
		newdiv.className = "semiTrans";

		document.body.style.overflow = "hidden";
		newdiv.onmousedown = function()
		{
			//closePopup();
		}
		
		
		var newimg = document.createElement('div');
		newimg.innerHTML = '<h2>Email this fact sheet</h2>To email this fact sheet to a friend or colleague simply complete the details below and click "Send".<br /><br />'+
		'<input id="senderName" type="text" name="senderName" value="Your name" onmousedown="if (this.value==\'Your name\') this.value = \'\';" style="width:122px;"/>'+
		'<input id="senderEmail" type="text" name="senderEmail" value="Your email address" onmousedown="if (this.value==\'Your email address\') this.value = \'\';" style="width:150px;"/>'+
		'<input id="theEmail" type="text" name="email" value="Recipients email address" onmousedown="if (this.value==\'Recipients email address\') this.value = \'\';"/>'+
		'<input type="submit" value="Send" onclick="doSendEmail();"/><a class="closeButton" onclick="closePopup()" href="#"></a>';
		//newimg.setAttribute('src', 'images/'+imgPath);
		newimg.setAttribute('id', 'theimg');
		newimg.className = "popupImg";
		document.body.appendChild(newimg);
		
		
		var test = $('newPageHeader');
		// to right of screen is ObjectPosition(test)[0] + 902
		
		//alert(newimg.style.width);
	}
	
	function doSendEmail()
	{
		var theEmail = $('theEmail').value;
		var senderName = $('senderName').value;
		var senderEmail = $('senderEmail').value;
		
		//alert(theEmail);
		var xmlHttp = ajaxFunction();
		
		xmlHttp.onreadystatechange = function() {
			//alert('xmlHttp.readyState='+xmlHttp.readyState);
			if(xmlHttp.readyState == 4) {

				var strArray=xmlHttp.responseText;
				if (strArray=='true')
				{
					alert('Your email has been sent.');
					closePopup();
				}
				else
				{
					alert(strArray);
				}
				
				
			}
		}
		
		xmlHttp.open('GET','includes/sendFactsheet.asp?e='+theEmail+'&f='+lastFile+'&sN='+senderName+'&sE='+senderEmail, false);
		xmlHttp.send(null);
		
	}
	function closePopup()
	{
		document.body.removeChild($('overlayBlack'));
		document.body.removeChild($('theimg'));
		document.body.style.overflow = "auto";
	}
	
	function ObjectPosition(obj) {
		var curleft = 0;
		var curtop = 0;
		if (obj.offsetParent) {
			do {
				curleft += obj.offsetLeft;
				curtop += obj.offsetTop;
			} while (obj = obj.offsetParent);
		}
		return [curleft,curtop];
	}
	
	
	
	function ajaxFunction() {
		var xmlHttp;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			// Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');
			}
			catch (e)
			{
				try
				{
					xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
				}
				catch (e)
				{
					alert('Your browser does not support AJAX!');
					return false;
				}
			}
		}
		return xmlHttp;
	}


