function addCommas(nStr) {
	
  nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ' ' + '$2');
	}
	return x1 + x2;
}

function calcsfee(nettototal, tax, mode) {
  
  var sfee;
  
  if (mode != 3) {   

    if (nettototal < 5000) {
      sfee = 1200;
    } else if (nettototal < 10000) {
      sfee = 1000;
    } else if (nettototal < 20000) {
      sfee = 800;
    } else {
      sfee = 0;
    }   
    sfee = Math.ceil(sfee * ((tax+100)/100));  /* bruttósítunk */
  } else {
    sfee = 0;
  }     
  
  $('#sfee').html(addCommas(sfee)+'&nbsp;Ft');
  
}