// JavaScript Document
var xmlHttp = createXMLHttpRequestObject();

function createXMLHttpRequestObject(){
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch(e)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
	}
	if(!xmlHttp)
	alert("Błąd przy tworzniu obiektu");
	else
	return xmlHttp;
}


function add(zmienna){
	if(xmlHttp)
	{
		try
		{
				var param1 = document.getElementById("client").value;
			var params = "wiersz=" + param1;
			xmlHttp.open("GET","class/client.php?" + params,true);
			xmlHttp.onreadystatechange = handleRequestStateChange;
			xmlHttp.send(null);
		}
		catch(e)
		{
			alert("Nie można połączyć się z serwerem");
		}
	}
}
function handleRequestStateChange(){
	if(xmlHttp.readyState == 4)
	{
		if(xmlHttp.status == 200)
		{
			try
			{
				handleServerResponse();
			}
			catch(e)
			{
				alert("Error");
			}
		}
		else
		{ 
		alert('Problem przy pobieraniu danych');
		}
	}
}

function handleServerResponse(){

	var response = xmlHttp.responseText;
	var myDiv = document.getElementById("client_is");
	myDiv.innerHTML = response;
}
