function roundPrice(num, rm) { num = Math.floor(num / rm) * rm; return num; } function formatPrice(num) { if (isNaN(num)) { num = 0; } var sgn = ((num < 0) ? '-' : ''); num = Math.abs(num); var decs = Math.round(num * 100 % 100); if (decs < 10) { decs = ('0' + decs).substr(-2); } num = Math.floor(num) + ''; if (num.length > 3) { h = num; num = ''; for (j = 3; j < h.length; j += 3) { i = h.slice(h.length - j, h.length - j + 3); num = ' ' + i + num + ''; } j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3)); num = j + num; } if (num) { return '' + sgn + num + ',' + decs + ' kr'; } else { return '0,00 kr'; } }