We don't usually present complete solutions, given a description or an example of how to do the hard part, you should be able to take your JavaScript knowledge and add the missing pieces. If you are not that familiar with JavaScript, do yourself a favor and look at some introductory material (I like this for JavaScript in Acrobat: Beginning JavaScript for Adobe Acrobat ).
Looking at your script, you already have most of the functionality in place. You should be able to change the output (assuming that your field can take a string and is not just a numeric field), by changing just the last line:
Change "event.value = totalY / total;" to the following:
event.value = totalY + " of " + total;
For easier readability, you may want to reformat the last two lines to this:
if (total==0)
event.value = "";
else
event.value = totalY + " of " + total;