fai un replace
function dp(price) {
var prezzo = price.replace(",",".")
string = "" + prezzo;
number = string.length - string.indexOf('.');
etc....