javascript util for css sprite animation