
function getobject(obj)
{
 if (document.getElementById)
return document.getElementById(obj)
 else if (document.all)
return document.all[obj]
}
var Currinp = 0;
var Maxfile = 60;
var dsp = new Image();
var hid = new Image();
dsp.src = "images/display.gif";
hid.src = "images/hidden.gif";

function zInputDisplay(n)
{
  elem = getobject(n);

   if(elem.style.display == "none" )
   {
    
        elem.style.display = "block";
        insertInput(n);
     
   }
   else
   {
     elem.style.display = "none";
     elem.innerHTML = "";
     this.currinp = 0;
   }
}
function insertInput(id)
{

 zinp="";
  for(i=0;i <= Currinp; i++)
  {

     down = Currinp > 0 && i == ( Currinp-1)? "&nbsp;<img src=\""+hid.src+"\" onclick=\"reduceInput('"+id+"');\">":"";
     up = i == Currinp ? "&nbsp;<img src=\""+dsp.src+"\" onclick=\"insertInput('"+id+"');\">":"";

     zinp += (i < Maxfile)? "<br> Od <input type=\"text\" name=\"od_d[]\" size=\"5\" value=\"\">-<input type=\"text\" name=\"od_m[]\" size=\"5\" value=\"\">-<input type=\"text\" name=\"od_r[]\" size=\"10\" value=\"\"> Do <input type=\"text\" name=\"do_d[]\" size=\"5\" value=\"\">-<input type=\"text\" name=\"do_m[]\" size=\"5\" value=\"\">-<input type=\"text\" name=\"do_r[]\" size=\"10\" value=\"\">"+up+down :"";
  }

  this.Currinp +=1;
 getobject(id).innerHTML = zinp;

}
function reduceInput(id)
{
  this.Currinp -= 2;
  insertInput(id);
}

function showWeek() {

   getobject('info').style.visibility = getobject('cyklic').checked ? 'visible' : 'hidden';

  if(getobject('cyklic').checked)
  {
   this.Currinp = 0;
   this.Maxfile = 1;
  }
  else
  {
   this.Currinp = 0;
   this.Maxfile = 60;
  }
  insertInput('dateinp');
}


