function createRequestObject() {
	var req;
	try {
		// Firefox, Opera & Safari
		req = new XMLHttpRequest();
	}
	catch(E) {
		// Internet Explorer
		try {
			// IE 6
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(E) {
			try {
				// IE 5
				req = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(E) {
				alert('This website requires features which are not available in your current web browser.');
			}
		}
	}
	return req;
}

var http = createRequestObject();

function doUpdate(sid, elem) {
	var val = validate(elem);
	if(val != null) {
		http.open('GET', 'work.php?id=' + sid + '&pid=' + elem + '&v=' + val, true);
		http.onreadystatechange = handleUpdate;
		http.send(null);
	}
}

function handleUpdate() {
	if(http.readyState == 4 && http.status == 200) {
		var response = http.responseXML;
		if(response) {
		}
	}
}

function checkanum(anum) {
	var val = anum;
	if(val != null) {
		http.open('GET', 'work.php?m=1&id=' + val, true);
		http.onreadystatechange = handleanum;
		http.send(null);
	}
}

function handleanum() {
	if(http.readyState == 4 && http.status == 200) {
		var response = http.responseText;
		if(response) {
			if(response == 'no')  document.getElementById('newy').checked = true;
			if(response == 'yes') document.getElementById('newn').checked = true;
		}
	}
}
