function show_desc(id){
  document.getElementById('desc_'+id).style.display = 'block';
}
function hide_desc(id){
  document.getElementById('desc_'+id).style.display = 'none';
}

function toggles(value){
  var cursus = document.getElementById('cursus_'+value).innerHTML;
  if(cursus == -1){
    toggleVisId('aantal',false); 
    toggleVisId('verzendkosten',false);
    toggleVisId('voorwaarden',true);
  }
  else{
    toggleVisId('aantal',true); 
    toggleVisId('verzendkosten',true);
    toggleVisId('voorwaarden',false);
  }
  calc();
}


function admini(){

}

function calc(){
  var aantal = document.getElementById('number').value;
  var product_id = document.getElementById('product')[document.getElementById('product').selectedIndex].value;
  var price = document.getElementById('price_'+product_id).innerHTML;
  var administration = document.getElementById('administration_'+product_id).innerHTML;
  document.getElementById('rek_adm').innerHTML = '(Administratiekosten € '+number_format((administration/100), 2, ',','.')+')';
  var cursus = document.getElementById('cursus_'+product_id).innerHTML;
  var total = 0;
  if(cursus != -1){
    if(aantal == "" || aantal == "undefined" || aantal == "null")
      aantal = 0;
    total = aantal*price;
    if(aantal*1 == 0)
      total += 0;
    else if(aantal*1 == 1)
      total += 180;
    else if(aantal*1 == 2)
      total += 220;
    else
      total += 280;
  }
  else{
    total = price*1;
  }
  
  if(document.getElementById('oprekening').checked)
    total += administration*1;

  document.getElementById('totaal').value = '€ '+number_format((total/100), 2, ',','.');
}

function number_format( number, decimals, dec_point, thousands_sep ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://crestidg.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // *     example 1: number_format(1234.5678, 2, '.', '');
    // *     returns 1: 1234.57     
 
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}