	
var loading = false;	
	
	function load(url, params, target) 
	{
	loading = url;

		//document.getElementById(target).innerHTML = ' Fetching data...';
		if (window.XMLHttpRequest) 
		{
	    req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
		req = new ActiveXObject("Microsoft.XMLHTTP");
		}


		if (req != undefined) 
		{
		req.open("POST", url, true);
		
		//Send the proper header information along with the request
		req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		req.setRequestHeader("Content-length", params.length);
		req.setRequestHeader("Connection", "close");
		
			req.onreadystatechange = function() 
			{
			get_content_done(url, target);
			};  

		req.send(params);
		}
	
		function get_content_done(url, target) 
		{
		
			if (req.readyState == 4) // only if req is "loaded"
			{ 
	    
				if (req.status == 200) // only if "OK"
				{ 
				document.getElementById(target).innerHTML = req.responseText;
				loading = false;
				} else {
				load_fail(url);
				}
				
			}
		
		}


	}
	
	
	
	
	
	
function load_fail(url)
{

	if(url == 'system/components/emailFriend.asp')
	{ 
	alert('There was an error sending your request. Please refresh the page and try again.');
	} else if(url == 'system/components/send_voucher.asp') {
	alert('There was an error sending your voucher. Please refresh the page and try again.');
	} else {
	alert('There was an error sending your guess. Please refresh the page and try again.');
	}
}