How do I use the infromation from gpx file to add information to track

Hello, could anyone help me with the following question (first day with OSM, and not experienced with Javascript)?

I used the examples in the OSM pages to build a map that show a track with the following code

var lgpx = new OpenLayers.Layer.GML("GPS route", gpxfile, {
    format: OpenLayers.Format.GPX,
    style: {strokeColor: "red", strokeWidth: 5, strokeOpacity: 0.5},
    projection: new OpenLayers.Projection("EPSG:4326")

NOw I am trying to use the data in the gpx file to add a marker at each km but to do that I would need to be able to see the coordinates of the individual points so that I can calculate distances between points and add the marker at the desired location and I am really stuck.

I appreciate any help