move a util function used in donorViz template to script.js