function fround(n,d){
 	var xx = n.indexOf('.');
	var l = n.length;	
	var zstr = '0000000000000000000000';
	var theInt = '';
	var theFrac = '';
	var theNo = '';
	var xt = parseInt(d) + 1;
	var rstr = '' + zstr.substr(1,xt);
	var rfac = '.' + rstr + '5';
	var rfacx = parseFloat(rfac);
	rfac = '';
	rfacx = 0;
	nx = 0;
	if (xx == -1 ) 	{    // No fraction
		theFrac = zstr;
		theInt = "" + n;
	}
	else if (xx == 0) {
		theInt = '0';
		nx = 0 + parseFloat(n) + parseFloat(rfacx);
		n = nx + zstr;
		theFrac = '' + n.substring(1, n.length);
	}
	else {
		theInt = n.substring(0,xx);
		nx = parseFloat(n) + rfacx;
		n = '' + nx + zstr;
		theFrac = '' + n.substring(xx+1,xx + 1 + parseInt(d));
		var astr = 'd = ' + d;
	}
	theFrac = theFrac.substring(0,parseInt(d));
	var ii = 0;
	theNo = theInt + '.' + theFrac;
	return theNo;
  }
  function calctotal(){
    var total = 0;
    var num;
    for(var x=1;x <=7;x++){
      num = document.getElementById('art'+x+'_tot').value;
      if(num == '' || isNaN(num)){num = 0;}
      total += parseFloat(num);
    }
    var subtot = document.getElementById('subtotal');
    subtot.value = fround(total.toString(),2);
    total += parseFloat(document.getElementById('verzendkosten').value);

    if(document.getElementById('betalingswijze[rembours]')){
      if(document.getElementById('betalingswijze[rembours]').checked==true){
        var remb = document.getElementById('rembourskosten');
        var rembval = (total +  6 )*0.01+6;
        remb.value = fround(rembval.toString(),2);
        total += rembval;
      }
      else{
        var remb = document.getElementById('rembourskosten');
        remb.value = "0.00";
      }
    }
    var tot = document.getElementById('total');
    tot.value = fround(total.toString(),2);
  }
   
  function artvolchange(el,n){
     //alert(el.id);
     var elm;
     var total = '';
     tot = document.getElementById(el.id+'_tot');
     tot.value=fround((Math.round((el.value * prices[el.id])*100)/100).toString(),2);
     calctotal();
  }


function count(){
rf = document.referrer
if((rf=='undefined')||(rf=='')){rf='Unknown';};
lok = ('http://www.digitcount.nl/count.php?cid=140&referer=' + rf);
document.write('<img border=0 src="' + lok + '" width="1" height="1">');
}

