javascript and references (2 separate issues)