      var MAX = 200;
      var MIN = 100;
      var HEIGHT = 100;
      var timer = 0;
      var XR = 0;
      var XZ = 0;

      function rozwin()
      {
         XR = XR + 2;
         XZ = 0;  
         clearTimeout(timer);
         HEIGHT = HEIGHT + XR;
         if (HEIGHT < MAX) {   
            document.getElementById("bannerr").style.clip = "rect( 0px 750px " + HEIGHT + "px 0px)";
            timer = setTimeout("rozwin()",30);
         } else {
            document.getElementById("bannerr").style.clip = "rect( 0px 750px " + MAX + "px 0px)";
         }
      }
      function zwin()
      {
         XR = 0;
         XZ = XZ + 2;      
         clearTimeout(timer);
         HEIGHT = HEIGHT - XZ;
         if (HEIGHT > MIN) {   
            document.getElementById("bannerr").style.clip = "rect( 0px 750px " + HEIGHT + "px 0px)";
            timer = setTimeout("zwin()",30);
         } else {
            document.getElementById("bannerr").style.clip = "rect( 0px 750px " + MIN + "px 0px)";
         }
      } 
      
   function zamknij() {
         document.getElementById("toplayer").style.display = 'none';
         document.getElementById("toplayer2").style.display = 'none';
         html = document.getElementsByTagName('html');
         html[0].style.overflow = 'auto';
               
      //tlo_off()
      
   }      
   
   

      function otworz() {
              window.scroll(0,0);
              html = document.getElementsByTagName('html');
              html[0].style.overflow = 'hidden'; 
      }
  
   
      function tlo (){


       if (self.pageYOffset) {
              yScroll1 = self.pageYOffset;
              xScroll1 = self.pageXOffset;
       } else if (document.documentElement &&  document.documentElement.scrollTop){        // Explorer 6 Strict
              yScroll1 = document.documentElement.scrollTop;
              xScroll1 = document.documentElement.scrollLeft;
       } else if (document.body) {// all other Explorers
              yScroll1 = document.body.scrollTop;
              xScroll1 = document.body.scrollLeft;
       }




   var xScroll, yScroll;

       if (window.innerHeight && window.scrollMaxY) {
              xScroll = window.innerWidth + window.scrollMaxX;
              yScroll = window.innerHeight + window.scrollMaxY;
       } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
              xScroll = document.body.scrollWidth;
              yScroll = document.body.scrollHeight;
       } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
              xScroll = document.body.offsetWidth;
              yScroll = document.body.offsetHeight;
       }

       var windowWidth, windowHeight;

//       console.log(self.innerWidth);
//       console.log(document.documentElement.clientWidth);

       if (self.innerHeight) {       // all except Explorer
              if(document.documentElement.clientWidth){
                     windowWidth = document.documentElement.clientWidth;
              } else {
                     windowWidth = self.innerWidth;
              }
              windowHeight = self.innerHeight;
       } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
              windowWidth = document.documentElement.clientWidth;
              windowHeight = document.documentElement.clientHeight;
       } else if (document.body) { // other Explorers
              windowWidth = document.body.clientWidth;
              windowHeight = document.body.clientHeight;
       }

       // for small pages with total height less then height of the viewport
       if(yScroll < windowHeight){
              pageHeight = windowHeight;
       } else {
              pageHeight = yScroll;
       }

//       console.log("xScroll " + xScroll)
//       console.log("windowWidth " + windowWidth)

       // for small pages with total width less then width of the viewport
       if(xScroll < windowWidth){
              pageWidth = xScroll;
       } else {
              pageWidth = windowWidth;
       }

         var selects = document.getElementsByTagName("select");
               for (i = 0; i != selects.length; i++) {
                      selects[i].style.visibility = "hidden";
               }
               
         document.getElementById("nawigacja").style.visibility = "hidden";

        document.getElementById("toplayer").style.height= pageHeight + "px";
        document.getElementById("toplayer").style.width= pageWidth + "px";
        document.getElementById("toplayer").style.display = 'block';

        //document.getElementById("toplayer2").innerHTML= "<script type='text/javascript' src='http://www.reklama.resinet.pl/openx/www/delivery/al.php?zoneid=62&cb=INSERT_RANDOM_NUMBER_HERE&layerstyle=geocities&align=center&padding=2&closetext=&collapsetime=15'></script>";
        document.getElementById("toplayer2").style.display = 'block';
/*        var x, y;
        y = yScroll1-50+(windowHeight/2);
        x = xScroll1-150+(windowWidth/2);
        document.getElementById("myalert").style.top= y + "px";
        document.getElementById("myalert").style.left= x + "px";
        document.getElementById("myalert").innerHTML = '<p>'+ txt + 
'</p><table align="center" border="0" cellspacing="0" 
cellpadding="0"><tr><td><a href="javascript:void(0);" class="b_green" 
style="text-align: center;">OK</a></td></tr></table>';
        document.getElementById("myalert").style.display = 'block';

        clearTimeout(pm);*/
        
        pm = setTimeout('tlo_off()', 12000);

         }
         
         function tlo_off(){
            var selects = document.getElementsByTagName("select");
               for (i = 0; i != selects.length; i++) {
                      selects[i].style.visibility = "visible";
               }

         document.getElementById("nawigacja").style.visibility = "visible";
         
         
         document.getElementById("toplayer").style.display = 'none';
         document.getElementById("toplayer2").style.display = 'none';
         html = document.getElementsByTagName('html');
         html[0].style.overflow = 'auto'; 
         }
   

      function urodziny (){
         var body = document.getElementsByTagName("body");
         var contener = document.getElementById("contener");
         
         body[0].style.background = "Black url(tlom.gif) repeat center top";
         contener.style.background = "transparent url(tlo.jpg) no-repeat center top";
      }


      
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var xmlHttp = createXmlHttpRequestObject();
var temp = "";

function createXmlHttpRequestObject() 
{
  //przechowa odwołanie do obiektu XMLHttpRequest
  var xmlHttp;
  // powinno działać dla wszystkich przeglądarek z wyjątkiem IE6 i starszych
  try
  {
    // próbuje stworzyć obiekt XMLHttpRequest
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  {
    // zakładając, że IE6 lub starsza
    var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0",
      "MSXML2.XMLHTTP.5.0",
      "MSXML2.XMLHTTP.4.0",
      "MSXML2.XMLHTTP.3.0",
      "MSXML2.XMLHTTP",
      "Microsoft.XMLHTTP");
    // sprawdza każdy prog id aż któryś zadziała
    for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++) 
    {
      try 
      { 
        // próbuje stworzyć obiekt XMLHttpRequest
        xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
      } 
      catch (e) {}
    }
  }
  // zwraca stworzony obiekt albo wyświetla komunikat o błędzie
  if (!xmlHttp)
    alert("Błąd podczas tworzenia obiektu XMLHttpRequest.");
  else 
    return xmlHttp;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function zaladuj (co, ile, ktora, styl) {
   if (xmlHttp) {
      try {
         var link = "/class/ajax_newsy.php?co=" + co + "&ktora=" + ktora + "";
         //alert (link);
         xmlHttp.open("GET", link, true);
         xmlHttp.onreadystatechange = czekaj;
         xmlHttp.send(null);
         for (var i = 1; i <= ile; i++) {
            document.getElementById(co+'_a'+i).className = (i==ktora)?styl+" on":styl;
         }
         temp = co;
      }
      catch (e) {
         alert("Nie moge nawiazac połaczenia z serwerem:\n" + e.toString());
      }
   }
}

function czekaj() {
   //kiedy readyState ma wartość 4, jesteśmy gotowi do odebrania odpowiedzi z serwera
   if (xmlHttp.readyState == 4) {
      // kontynuuje tylko, gdy status HTTP ma wartość "OK"
      if (xmlHttp.status == 200) {
         try {
            //przetwarza wiadomość z serwera
            podmien();
         }
         catch(e) {
            //komunikat o błędzie
            alert("Błąd odczytu odpowiedzi: " + e.toString());
         }
      } else {
         //wyświetla wiadomość o statusie
         alert("Pojawił się problem przy pobieraniu danych:\n" + xmlHttp.statusText);
      }
   }
}

function podmien()
{
   var response = xmlHttp.responseText;
   var myDiv = document.getElementById(temp);
   myDiv.innerHTML = decodeURI(response);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function przelacz (co, ile, ktora, styl) {
   for (var i = 1; i <= ile; i++) {
      document.getElementById(co+'_z'+i).style.display = (i==ktora)?"block":"none";
      document.getElementById(co+'_a'+i).className = (i==ktora)?styl+" on":styl;
   }
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function nowe_okno (url,szerokosc,wysokosc) {
   var Win = window.open(url,"","scrollbars=yes,resizable=0,width="+szerokosc+",height="+wysokosc+",menubar=no" );
   Win.moveTo((screen.width / 2) - szerokosc/2,(screen.height / 2) - wysokosc/2);
   Win.focus();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function pokaz (co, id, styl) {
   document.getElementById(co+'_d_'+id).style.display = "block";
   document.getElementById(co+'_n_'+id).className = styl+"_on";
   document.getElementById(co+'_n_'+id).href = "javascript:ukryj('"+co+"', "+id+", '"+styl+"');";
}
function ukryj (co, id, styl) {
   document.getElementById(co+'_d_'+id).style.display = "none";
   document.getElementById(co+'_n_'+id).className = styl;
   document.getElementById(co+'_n_'+id).href = "javascript:pokaz('"+co+"', "+id+", '"+styl+"');";
}
