// XML REQUEST
var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
try { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); }                
catch (e) { }
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

// MS 
function _openWindow(file) {
	_getWindowContent("GET",file,'');
}
function _openWindowPOST(file,vars) {
	_getWindowContent("POST",file,vars);
}
function _openWindowGET(file,vars) {
	_getWindowContent("GET",file,vars);
}
function _getWindowContent(method, url, vars) {
	if ((vars == "") || (vars == "undefined")) vars = null;
	if (xmlhttp != null && xmlhttp.readyState !=0 && xmlhttp.readyState !=4) {
		xmlhttp.abort(); /* IE fix */
	}
	if ((!method) || (!url)) return false; // caso algum dos elementos necessários não exista, termina-se
	document.body.style.cursor = "wait";
	try { xmlhttp.open(method, url, true); }
	catch (e) { url = url.replace(/www./i,""); xmlhttp.open(method, url, true); } // fix para urls absolutos em que www.x.pt é o mesmo que x.pt, mas não para o browser
	if (method == "POST") {
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttp.setRequestHeader("Connection", "close");
	}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			xmlhttp.onreadystatechange=function() { };
			resposta.doAction(xmlhttp.responseText);
			document.body.style.cursor = "";
		}
	}
	xmlhttp.send(vars); /* IE Fix: readystate depois de open e antes de send */
}
//---
