function incUD(x,step){
 td=document.getElementById('inp'+x);
 ch=td.value*1;
 ch+=step;
 td.value=ch;
 td=document.getElementById('td'+x);
 td.innerHTML=ch;
}
function decUD(x,step){
 if(td=document.getElementById('inp'+x))
   ch=td.value*1;
  else
   ch=0;
 if(ch-step>0)
 {
  ch-=step;
  td.value=ch;
  td=document.getElementById('td'+x);
  td.innerHTML=ch;
 }else
 {
  td.value=0;
  document.getElementById('div'+x).innerHTML='<button onclick=showsch('+x+','+step+')>Заказать</button>';
 }
}
function eqUD(x,step){
  td=document.getElementById('inp'+x);
 if(td.value*1<=0)
 {
  decUD(x,step);
 }else{
  showsch(x,step);
 }
}
function showsch(x,step)
{
 if(document.getElementById('inp'+x).value<=0)document.getElementById('inp'+x).value=step;
 document.getElementById('div'+x).innerHTML=
               ('<table border=0 cellpadding=0 cellspacing=0>'+
                '<tr><td rowspan=2 id=td'+x+' class=inpUD>'+document.getElementById('inp'+x).value+'</td>'+
                '<td class=btUP><img border=0 src=/UpDown/i-up.gif onclick=\'javascript:incUD('+x+','+step+');\'></td></tr><tr><td class=btDN><img border=0 src=/UpDown/i-down.gif onclick=\'javascript:decUD('+x+','+step+');\'></td></tr>'+
                '</table>');
}

