function showcolors(idp,idk)
{
 if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {



        odata=new Date();
        date=odata.getTime();

    xmlHttp.open("GET", "ajax/pokaz_kolory.php?idp="+idp+"&idk="+idk+"&data="+date+"", true);
    xmlHttp.onreadystatechange = handleServerResponse;

    xmlHttp.send(null);

  }
  else
    setTimeout('showcolors()', 1000);

}








function handleServerResponse()
{


 if (xmlHttp.readyState == 1)
  {
  cel=document.getElementById("cart_img_pro");
  cel.innerHTML='<br/><b>Przetwarzanie danych...</b><br><br>';
  document.getElementById("fotosy").innerHTML = '<br/><b>Przetwarzanie danych...</b><br><br>';
  }else{
  cel=document.getElementById("cart_img_pro");
  cel.innerHTML='&nbsp;';


  }
  // kontynuuje jedynie jesli transakcja zostala zakonczona
  if (xmlHttp.readyState == 4)
  {
    // status 200 oznacza pomyslne ukonczenie transakcji
    if (xmlHttp.status == 200)
    {

     // xmlResponse = xmlHttp.responseXML;
      //xmlDocumentElement = xmlResponse.documentElement;
     // helloMessage = xmlDocumentElement.firstChild.data;

         //xmlHttp.setRequestHeader("Cache-Control","no-cache");
         helloMessage=xmlHttp.responseText;

      var duze=helloMessage.split("|");

      document.getElementById("cart_img_pro").innerHTML = duze[0];
      document.getElementById("fotosy").innerHTML = duze[1];

    }

    else
    {
      alert("Wystapil blad podczas uzyskiwania dostepu do serwera: " + xmlHttp.statusText);
    }
  }
}

