var Sender;
function getRequestObject()
{
	//create a XMLHttpRequest Object.
	if(window.XMLHttpRequest)
	{ 
		return new XMLHttpRequest();
	}
	else
	{
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
}

//call this function with url of document to open as attribute
function getSnippit(docId, criteria)
{
	
	Sender = document.getElementById("snippet_" + docId);
	var xmlhttp = getRequestObject();
	if(xmlhttp != null) {
		xmlhttp.open("GET", "GetSnippit.aspx?docid=" + docId + "&criteria=" + criteria + "&lang=" + jsLanguage, false);
		xmlhttp.onreadystatechange = function() {					
						if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
						{
							//xmlhttp.responseText is the content of document requested
							Sender.innerHTML = xmlhttp.responseText;
							
						}
						
		}
		xmlhttp.send(null);
	}
}
