javascript function for turning fixed elements into static elements