function getdata(what,where,par){

document.getElementById(where).innerHTML ="<center><img src='/img/loading.gif'></center>";

if(window.XMLHttpRequest)
{
 http = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
 http = new ActiveXObject("MSXML2.XMLHTTP");
}

http = new XMLHttpRequest();

http.open("POST", what, true);

http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", par.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {
	if(http.readyState == 4 && http.status == 200) {
		document.getElementById(where).innerHTML = http.responseText;
		if(http.responseText == "<label style='color:red;'>* Utilizador indisponível</label>")
			document.getElementById('username').value="";
	}
}
http.send(par);
}

function changeLang(abrv, where){
	
	if(window.XMLHttpRequest)
	{
	 http = new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
	 http = new ActiveXObject("MSXML2.XMLHTTP");
	}
	
	http = new XMLHttpRequest();
		
	var par = "lang=" + abrv;	
		
	http.open("POST", where, true);
	
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", par.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function() {
		if(http.readyState == 4 && http.status == 200) {
			if(http.responseText == 1){
				window.location.reload();
			}
		}
	}
	http.send(par);
}


