
var zxcTO;
var pos = "0px";

function ScrollDiv(id,dis, maxPosun){
  
  aktualni_pozice = getPosun(pos);
  if(aktualni_pozice <= 0 && aktualni_pozice >= maxPosun){
    document.getElementById(id).style.left= (aktualni_pozice*1+dis*1)+'px';
  
    pos = document.getElementById(id).style.left;
    zxcTO=setTimeout( function(){ ScrollDiv(id,dis, maxPosun); },10);
  } else {
    if(aktualni_pozice > 0) pos = "0px";
    if(aktualni_pozice < maxPosun) pos = maxPosun+"px";
  }
  
  
}
function getPosun(posun) {
  var cislo = posun.substring(0, posun.length-2);
  //alert(cislo);
  return cislo;
}

function formatujDatum(input, posunDnu) { 
   var rok = input.substring(0,4);
   var mesic = input.substring(5,7);
   var den = input.substring(8,10);
   var myDate=new Date();
   myDate.setFullYear(rok);
   myDate.setMonth(mesic-1);
   myDate.setDate(den);
   myDate.setTime(myDate.getTime()+ posunDnu *24*60*60*1000);
      
   var _mesic = myDate.getMonth()+1;
   if(_mesic <10) {
    _mesic = "0"+_mesic;
   }
   var _day = myDate.getDate();
   if(_day <10) {
    _day = "0"+_day;
   }
   return myDate.getFullYear()+"-"+_mesic+"-"+_day;
} 

