function number_sum(num){ var total = 0; str_num = num.toString(); for(i=0;i<str_num.length;i++){ total += parseInt(str_num[i]); } return total; }