function zaokrouhli(n,m) {
  l=n.length;
  if (m<0) m=0;
  if (n<0)
  {
    minus="-"; nm="";    
    for (pom=1;pom<l;pom++) nm=nm+n.charAt(pom);
    n=nm;
  }
    else minus="";
  xx=n.indexOf(".");
  zstr="0000000000000000000000";
  cele=""; frakce=""; rfac=""; rfacx=0; nx=0;
  xt=parseInt(m)+1;
  rstr=""+zstr.substring(1,xt);
  rfac="."+rstr+"5";
  rfacx=parseFloat(rfac);
  if (xx==-1) cele=n;
    else if (m==0) cele=Math.round(n);
    else if (xx==0)
    {
      cele="0";
      nx=0+parseFloat(n)+parseFloat(rfacx);
      n=nx+zstr;
      frakce=""+n.substring(1,n.length);
    }
    else	
    {
      cele=n.substring(0,xx);
      nx=parseFloat(n)+rfacx;
      n=""+nx+zstr;
      frakce=""+n.substring(xx+1,xx+1+parseInt(m));
    } 
  frakce=frakce.substring(0,parseInt(m));
  if (frakce=="") tecka=".00";
    else tecka=".";
  return minus+cele+tecka+frakce;
}
