// ==UserScript==
// @name           Geocaching Google Maps Travel Bug
// @namespace      http://carey.geek.nz/code/userscripts/
// @description    Add a link to geocaching.com to display travel bug tracks in Google Maps
// @include        http://www.geocaching.com/track/details.*
// ==/UserScript==

// Copyright © 2007 Carey Evans.
//
// Permission to use, copy, modify, and distribute this software and its
// documentation for any purpose and without fee is hereby granted,
// provided that the above copyright notice appear in all copies and
// that both that copyright notice and this permission notice appear in
// supporting documentation.

(function(){
 var ge = document.getElementById('trGoogleKML');
 var gm = ge.cloneNode(true);
 gm.id = 'trGoogleMaps';
 gm.getElementsByTagName('img')[0].alt = '';
 var link = gm.getElementsByTagName('a')[0];
 link.href = 'http://maps.google.com/?q=' + encodeURIComponent(link.href);
 link.target = '_blank';
 link.textContent = 'View in Google Maps';
 ge.parentNode.insertBefore(gm, ge.nextSibling);
})();
