function up(obj)
{
   val = parseInt(document.getElementById(obj).value);
   if(val >= 0) new_val = val + 1;
   else new_val = 0;
   document.getElementById(obj).value = new_val;
}

function down(obj)
{
   val = parseInt(document.getElementById(obj).value);
   if(val >= 0) new_val = val - 1;
   else new_val = 0;
   if(new_val < 0) new_val = 0;
   document.getElementById(obj).value = new_val;
}

function showReturnFieldOr()
{
   if(document.order_frm.organization)
   {
      if(document.order_frm.organization.value != '' && document.order_frm.show_return.value == 1) document.getElementById('return_date').style.display = 'block';
      else document.getElementById('return_date').style.display = 'none';
   }
}

function countPoints(amount)
{
   if(document.order_frm.points_number)
   {
      points = parseInt(document.order_frm.points_number.value,10); //alert(points);
      discount = parseFloat(points*amount);
      if(discount > 0)
      {
         disc = discount.toString();
         if(disc.indexOf(".") == -1) disc += '.00';
         splitArr = disc.split('.');
         disc = splitArr[0]+'.'+splitArr[1].substring(0,2);
         document.getElementById('points_discount').innerHTML = 'Korting: &euro;'+disc.replace(".",",");
         document.order_frm.pdiscount.value = discount;
      }
      else
      {
         document.getElementById('points_discount').innerHTML = '';
         document.order_frm.pdiscount.value = 0;
      }
   }
}

function changeChoice(id)
{
   obj1 = "choice1";
   obj2 = "choice2";
   if(id == 1)
   {
      document.getElementById(obj1).style.display = 'block';
      document.getElementById(obj2).style.display = 'none';
   }
   else
   {
      document.getElementById(obj2).style.display = 'block';
      document.getElementById(obj1).style.display = 'none';
   }
}

function submit_form(loc)
{
  document.order_frm.from.value=loc;
  if(document.getElementById('inform_box'))
  {
     location.href='/'+loc;
     return true;
  }
  else
  {
     document.order_frm.submit();
     return false;
  }
}

