function showZeroFilled(inValue) {
if (inValue > 9) {
return "" + inValue;
}
return "0" + inValue;
}


function ileZostaloSec(){
  var sec=0;
  var dEnd = new Date(2010, 9, 10, 10, 10, 10);
  var d = new Date();

  secEnd=dEnd.getTime()/1000; //mS defalult
  sec=d.getTime()/1000; //mS defalult
  secRoz=secEnd-sec;  //sec pozostale do premiery...


  if (secRoz<0){
    var arrRes = new Array(0, 0, 0, 0); 
  }else{
    var arrRes=new Array();

    tmpDniS=60*60*24;
    dniS=secRoz/tmpDniS;
    arrRes[0]=Math.floor(dniS);
    
    tmpGodS=60*60;
    secRoz=secRoz-arrRes[0]*tmpDniS;
    godS=secRoz/tmpGodS;
    arrRes[1]=Math.floor(godS);

    tmpMinS=60;
    secRoz=secRoz-arrRes[1]*tmpGodS;
    minS=secRoz/tmpMinS;
    minS=Math.floor(minS);
    arrRes[2]=minS;

    secS=Math.ceil(secRoz-arrRes[2]*tmpMinS);
    if(secS==60){
      secS=0;
      //arrRes[2]=arrRes[2]+1;
    }
    arrRes[3]=secS;
  }

    
  return arrRes;
}

function pokazOdliczacz() {

  arrTmp=ileZostaloSec();
  document.getElementById("dni").innerHTML=arrTmp[0];
  document.getElementById("god").innerHTML=showZeroFilled(arrTmp[1]);
  document.getElementById("min").innerHTML=showZeroFilled(arrTmp[2]);
  document.getElementById("sek").innerHTML=showZeroFilled(arrTmp[3]);

  setTimeout("pokazOdliczacz()", 1000)
}

