JavaScript: resolution changer