// mapping

jQuery.noConflict();

jQuery(document).ready(function() {
	
	// append scripts
	if(jQuery('#map').length > 0) {
		initMap();
	}
	// write GoogleMaps map to #map
	
	
	
	
});

function initMap() {

	var map;
	var geoXml; 
	var toggleState = 1;
	
	if (GBrowserIsCompatible()) {
		geoXml = new GGeoXml("http://www.mikepadgett.com/wp-content/themes/mikepadgettv25/walking_data.php?n=" + String((new Date()).getTime()).replace(/\D/gi,'') );
		map = new GMap2(document.getElementById("map"));
		map.enableScrollWheelZoom();
		map.setMapType(G_PHYSICAL_MAP);
		map.setCenter(new GLatLng(48,12),4); 
		map.addControl(new GLargeMapControl());
		map.addOverlay(geoXml);
		GEvent.addListener(map, "infowindowopen", function() {
        // Get a reference to the infoWindow
        var infoWindow = jQuery(this.getInfoWindow().getContentContainers());
        // Find all <a> tags in the infoWindow and reset their target attribute
		jQuery('#iw_kml').prev().css('font-size','90%');
		jQuery('a', infoWindow).attr('target', '_self');
		});
	}
	jQuery(window).unload( function () { GUnload(); } );
	
}
