edited javascript page handling