function showTrailOnMap(reg)
{
tlFirst.destroyFeatures();
tlSecond.destroyFeatures();
tlThird.destroyFeatures();
tlFourth.destroyFeatures();
var firstURL = '/beacon.php?type=geoJson&action=findTrail®istration='+reg+'&hours=0&offset=6';
var secondURL = '/beacon.php?type=geoJson&action=findTrail®istration='+reg+'&hours=6&offset=12';
var thirdURL = '/beacon.php?type=geoJson&action=findTrail®istration='+reg+'&hours=12&offset=18';
var fourthURL = '/beacon.php?type=geoJson&action=findTrail®istration='+reg+'&hours=18&offset=24';
var format = new OpenLayers.Format.GeoJSON({
'internalProjection': new OpenLayers.Projection("EPSG:900913"),
'externalProjection': new OpenLayers.Projection("EPSG:4326")
});
// Get the first most recent 6 hour trail
OpenLayers.loadURL(firstURL, {}, null, function (response){
var geoJSON = response.responseText;
var features = format.read(geoJSON);
tlFirst.addFeatures(features);
});
// Get the second most recent 6 hour trail
OpenLayers.loadURL(secondURL, {}, null, function (response){
var geoJSON = response.responseText;
var features = format.read(geoJSON);
tlSecond.addFeatures(features);
});
// Get the third most recent 6 hour trail
OpenLayers.loadURL(thirdURL, {}, null, function (response){
var geoJSON = response.responseText;
var features = format.read(geoJSON);
tlThird.addFeatures(features);
});
// Get the fourth most recent 6 hour trail
OpenLayers.loadURL(fourthURL, {}, null, function (response){
var geoJSON = response.responseText;
var features = format.read(geoJSON);
tlFourth.addFeatures(features);
});
}