
var jojo = '';

//manage quantity

function add_qte(champ, position, action) {
  position = 0-0+position - 1;
  if (champ.length) {
    qtei = champ[position].value;
  }
  else {
    qtei = champ.value;
  }
  step = Math.abs(parseInt(action));
  if (parseInt(action) > 0) {
    qtei = (Math.floor(parseInt(qtei) / step)) * step;
  }
  else {
    qtei = (Math.ceil(parseInt(qtei) / step)) * step;
  }
  qte = parseInt(qtei) + parseInt(action);
  if (qte > 999) { qte = qtei; }
  if (qte < 0) { qte = 0; }
  if (champ.length) {
    champ[position].value = qte;
  }
  else {
    champ.value = qte;
  }
  return true ;
}

