var xmlhttp;
var object = false;
/*

function Czas(){
setTimeout(pokazOkienko(1), 5000);

}
*/
function odswiezaj()
{
	
		pokazOkienko(1);
		pokazOkienko(2);
		pokazOkienko(3);
      setTimeout("odswiezaj()", 5000);
}


function pokazOkienko(typ)
{	
if(typ == 1){
	xmlhttp1=GetXmlHttpObject();
	xmlhttp = xmlhttp1;
}
else if(typ == 2){
	xmlhttp2=GetXmlHttpObject();
	xmlhttp = xmlhttp2;
}
else if(typ == 3){
	xmlhttp3=GetXmlHttpObject();
	xmlhttp = xmlhttp3;
}
else if(typ == 4){
	xmlhttp4=GetXmlHttpObject();
	xmlhttp = xmlhttp4;
}
else if(typ == 5){
	xmlhttp5=GetXmlHttpObject();
	xmlhttp = xmlhttp5;
}
else if(typ == 6){
	xmlhttp6=GetXmlHttpObject();
	xmlhttp = xmlhttp6;
}


if (xmlhttp==null)
{
  alert ("Browser does not support HTTP Request");
  return;
}
var url="okienko_specjalne.php";
url=url+"?typ="+typ;
url=url+"&sid="+Math.random();
if(typ == 1){
	xmlhttp.onreadystatechange=stateChanged1;
}
else if(typ == 2){
	xmlhttp.onreadystatechange=stateChanged2;
}
else if(typ == 3){
	xmlhttp.onreadystatechange=stateChanged3;
}
else if(typ == 4){
	xmlhttp.onreadystatechange=stateChanged4;
}
else if(typ == 5){
	xmlhttp.onreadystatechange=stateChanged5;
}
else if(typ == 6){
	xmlhttp.onreadystatechange=stateChanged6;
}

xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}


function stateChanged1()
{
if (xmlhttp1.readyState==4)
{
document.getElementById("okienko1").innerHTML=xmlhttp1.responseText;

}
}
function stateChanged2()
{
if (xmlhttp2.readyState==4)
{
document.getElementById("okienko2").innerHTML=xmlhttp2.responseText;

}
}

function stateChanged3()
{
if (xmlhttp3.readyState==4)
{
document.getElementById("okienko3").innerHTML=xmlhttp3.responseText;

}
}

function stateChanged4()
{
if (xmlhttp4.readyState==4)
{
document.getElementById("okienko4").innerHTML=xmlhttp4.responseText;

}
}

function stateChanged5()
{
if (xmlhttp5.readyState==4)
{
document.getElementById("okienko5").innerHTML=xmlhttp5.responseText;

}
}

function stateChanged6()
{
if (xmlhttp6.readyState==4)
{
document.getElementById("okienko6").innerHTML=xmlhttp6.responseText;

}
}



function getData(dataSource, divID)
{
    // kontynuuje wylacznie gdy obiekt nie jest zajety
    if (object.readyState==4 || object.readyState==0) 
    {
        // tworzy zmienna odpowiadajaca konkretnemu obiektowi na stronie
        var obj = document.getElementById(divID);
 
        // czyta z pliku lub wykonuje skrypt
        object.open("GET", dataSource);
 
        // definiuje metode obslugi odpowiedzi serwera
        object.onreadystatechange = function()
        {
            // kontynuuje jesli transmisja zostala zakonczona powodzeniem
            if (object.readyState == 4 && object.status == 200) 
            obj.innerHTML= object.responseText;
        }
        // wysyla zadanie do serwera
         object.send(null);
      }
}




function Czas2(){
setTimeout(Czas(1), 10000);
}




/*

function stateChanged()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("txtHint").innerHTML=xmlhttp.responseText;	
  //jeśli chciałbym tylko dopisać do treści linijkę to wtedy musze zrobić tak: 	 		
  // 	document.getElementById("koszykz").innerHTML= document.getElementById("koszykz").innerHTML+xmlhttp2.responseText

	}
}
*/


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

function goForIt() {
if (!document.getElementById('newlocation')) return;
var si = document.getElementById('newlocation').selectedIndex;
location.href = document.getElementById('newlocation').options[si].value;
}
function goForIt2() {
if (!document.getElementById('newlocation2')) return;
var si = document.getElementById('newlocation2').selectedIndex;
location.href = document.getElementById('newlocation2').options[si].value;
}
function goForIt3() {
if (!document.getElementById('newlocation3')) return;
var si = document.getElementById('newlocation3').selectedIndex;
location.href = document.getElementById('newlocation3').options[si].value;
}
function goForIt4() {
if (!document.getElementById('newlocation4')) return;
var si = document.getElementById('newlocation4').selectedIndex;
location.href = document.getElementById('newlocation4').options[si].value;
}
