function Loguj() {	
	    var xmlHttpReq = false;
	    var self = this;
	
	    if (window.XMLHttpRequest) {
	        self.xmlHttpReq = new XMLHttpRequest();
	    }
	    // IE
	    else if (window.ActiveXObject) {
	        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
	    }
	    
	    self.xmlHttpReq.open('POST', "/inc/loguj.inc.php", true);
	    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	    self.xmlHttpReq.onreadystatechange = function() {
	        if (self.xmlHttpReq.readyState == 4) {
	        	
				document.getElementById("advert").innerHTML =  self.xmlHttpReq.responseText;
				
				document.getElementById("zalogowany").innerHTML = "<i>Wyloguj</i>";				
							
	        }
	    }
		
		form = document.forms['logowanie'];
		x= "login=" + encodeURI(form.login.value)
		+"&password=" + encodeURI(form.password.value);
		
		self.xmlHttpReq.send(x);	
}
