got javascript working on triangles