My first attempt at javascript programming