reordering javascript