﻿var XMLHttp = null;

function AddSurveiledDocument(Document) {
	var RequestUrl = "AddSurveiledDocument.aspx" + "?Document=" + encodeURIComponent(Document);

	var XMLHttp = GetHTTPObjectAddSurveiledDocument();
	XMLHttp.onreadystatechange = OnReadyDoSomethingAddSurveiledDocument;
	XMLHttp.open("GET", RequestUrl, true);
	XMLHttp.send();
}

// Get the XML Http object.
function GetHTTPObjectAddSurveiledDocument() {
	var ___HttpRequest;

	try {
		___HttpRequest = new XMLHttpRequest();
		return ___HttpRequest;
	} catch (____Exception) {
		try {
			___HttpRequest = new ActiveXObject("Msxml2.XMLHTTP");
			return ___HttpRequest;
		} catch (____Exception) {
			try {
				___HttpRequest = ActiveXObject("Microsoft.XMLHTTP");
				return ___HttpRequest;
			} catch (____Exception) {
				alert("Your browser does not support AJAX!");
				return null;
			}
		}
	}
}

// Check when the XML http object is ready.
function OnReadyDoSomethingAddSurveiledDocument() {
	if (this.readyState == 4 && this.status == 200) {
		document.getElementById('SurveiledDocumentAdded').style.display = 'block';
	}
	else if (this.readyState == 4 && this.status != 200) {
	}
}
