Javascript virtual router