clean up, reorg a bit phpdate.js