/*****************************************/
/*       Created by Piotr Kaluzynski     */
/*              Prostin                  */
/*       www.prostin.w.inds.pl           */
/*       email: prostin@inds.pl          */
/*****************************************/
xmlHttp = createXmlHttpRequest();
busy = false;

///-----------------------------------------------------------------///
///-------------*/ FUNKCJA WYSWIETLA WIADOMOSCI */------------------///
///-----------------------------------------------------------------///
function pokazWiadomosc (idNews) {

   
   if (xmlHttp) {
      if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) {
         if (!busy) {
         var oDivCont = document.getElementById ('wiadCont');
         if (!czyIE()) {
            fade.setOpacity (oDivCont, 1);
            fade.fadeOut (oDivCont, 0.1, 60);
          }
         busy = true;
         try {
            params = "action=pokazWiad&idNews=" + idNews;
            xmlHttp.open ("GET", "moduly/aktualnosci.ajax.php?" + params, true);
            xmlHttp.send (null);                  
            xmlHttp.onreadystatechange = handleRequestPokazWiad;

         } catch (e) {
            alert ("Wystapił błąd w trakcie pobierania danych.");
         }
      }
      } 
      
   }

}

function handleRequestPokazWiad () {
   if (xmlHttp.readyState == 4) {
      if (xmlHttp.status == 200) {
         handleResponsePokazWiad();
      }
   }                  
}

function handleResponsePokazWiad() {
   var response = xmlHttp.responseText;
   var oDivCont = document.getElementById ('wiadCont');
   
   if (!czyIE()) {
      setTimeout (function() {
         fade.setOpacity (oDivCont, 0);
         fade.fadeIn (oDivCont, 0.1, 60);
         oDivCont.innerHTML = response;
         busy = false;
      }, 800);
   } else {
      oDivCont.innerHTML = response;
      busy = false;
   }
   
}


