  function count_down(id, czas_hh)
  {
    this.poz=document.getElementById(id);
    this.czas_hh=czas_hh;
    this.nId=null;
    this.czas_hh=czas_hh;

    this.countDown = function ()
    {
      var self=this;
      if (this.czas_hh>0)
      {
        var czas_hh1=new this.getHiS(this.czas_hh--);

        var tmp='';
        if(czas_hh1.d>0)
        {
         tmp+=czas_hh1.d;
         tmp+=' Dni ';
        }
        tmp+=(czas_hh1.h<10?'0'+czas_hh1.h:czas_hh1.h);
        tmp+=':';
        tmp+=(czas_hh1.m<10?'0'+czas_hh1.m:czas_hh1.m);
        tmp+=':';
        tmp+=(czas_hh1.s<10?'0'+czas_hh1.s:czas_hh1.s);

        this.poz.innerHTML=tmp;
        this.nId = setTimeout(function() {self.countDown()}, 1000);
      }
      else
      {
        this.nId=null;
        this.poz.innerHTML='koniec';
      }
    }
    this.getHiS= function (value)
    {
      this.value = parseInt(value);
      this.d=Math.floor(this.value/(86400));
      this.h=Math.floor((this.value-this.d*86400)/(3600));
      this.m=Math.floor((this.value-this.d*86400-this.h*3600)/60);
      this.s=Math.floor((this.value-this.d*86400-this.h*3600-this.m*60));
    }
  
  }
