Did it the correct way. Reverted to the original code of jquery.vmap.js and wrote helper methods outside.
cleaned up