/* ------------------------------------------------------------------------
 Prototype DD

Funções para geração de DD com Ajax

--------------------------------------------------------------------------*/

function DoCallback(data)
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open('POST', urlSubmit, true);
		req.setRequestHeader('Content-Type', 'text/html; charset=iso-8859-1');
		req.send(data);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject('Microsoft.XMLHTTP')
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open('POST', urlSubmit, true);
			req.setRequestHeader('Content-Type', 'text/html; charset=iso-8859-1');
			req.send(data);
		}
	}
}

function processReqChange() {
	// only if req shows 'loaded'
	if (req.readyState == 4) {
		// only if 'OK'
		if (req.status == 200) {
			eval(what);
		} else {
			alert('There was a problem retrieving the XML data:\n' +
				req.responseText);
		}
	}
}