var httpRequest;
var markReadId;
var readImgSrc;
var readImgAlt;

function makeRequest(url, handler)
{
	if (window.XMLHttpRequest)
	{
		httpRequest = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
	}

	httpRequest.onreadystatechange = handler;
	httpRequest.open('GET', url, true);
	httpRequest.send('');
}

function markRead(url, id, img, alt)
{
	markReadId = id;
	readImgSrc = img;
	readImgAlt = alt;

	makeRequest(url, function () {
		if (httpRequest.readyState == 4 && httpRequest.status == 200)
		{
			if (httpRequest.responseText == "1")
			{
				bg = document.getElementById("ajax_"+markReadId+"_bg");
				t  = document.getElementById("ajax_"+markReadId+"_t");
				a  = document.getElementById("ajax_"+markReadId+"_a");

				bg.style.backgroundImage = "url("+readImgSrc+")";
				t.title = readImgAlt;

				if (a != null)
				{
					a.style.display = "none";
				}
			}
		}
	});

	prefetchImg = new Image();
	prefetchImg.src = readImgSrc;

	return true;
}
