﻿var xmlHttp = createXmlHttpRequestObject();



function createXmlHttpRequestObject()

{

	var xmlHttp;

	if( window.ActiveXObject )

	{

		try

		{

			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

		}

		catch(e)

		{

			xmlHttp = false;

		}

	}

	else

	{

		try

		{

			xmlHttp = new XMLHttpRequest();

		}

		catch(e)

		{

			xmlHttp = false;

		}

	}



	if(!xmlHttp)

		alert("zomg");

	else

		return xmlHttp;

}



function zmien(wartosc)

{

	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)

	{

		xmlHttp.open("GET", "skrypt.php?id="+wartosc, true);

		xmlHttp.onreadystatechange = handleServerResponse;

		xmlHttp.send(null);

	}

	else

		setTimeout('zmien('+wartosc+')', 1000);

}



function handleServerResponse()

{

	if( xmlHttp.readyState == 4)

	{

		if( xmlHttp.status == 200)

		{

			response = xmlHttp.responseText;

			document.getElementById("main_3").innerHTML = response;

		}

	}

}
