Qual: Move common javascript function into lib_head.js