added javascript handling from lynda tutorial