Event.observe(window, 'load', function() {    
	start_replace();
	update_top_menu();
	camp_profile();
	every_four_camp();
	
	//move_footer();
});
//Event.observe(window, 'resize', function() {
//	move_footer();
//});                           
Event.observe(window, 'unload', Event.unloadCache, false);
function tohere(i) {
  gmarkers[i].openInfoWindowHtml(to_htmls);
}
function fromhere(i) {
  gmarkers[i].openInfoWindowHtml(from_htmls);
}
function showAddress(title,address,html) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          alert(address + " not found");
        } else {
          map.setCenter(point, 13);
          var marker = new GMarker(point);
          map.addOverlay(marker);
		//map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		var i=0;
       // The info window version with the "to here" form open
        to_htmls = title+"<br/>"+html + '<br>Directions: <b>To here</b> - <a href="javascript:fromhere(' + i + ')">From here</a>' +
           '<br>Start address:<form action="http://maps.google.com/maps" method="get" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="saddr" id="saddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="daddr" value="' + point.lat() + ',' + point.lng() + 
                  // "(" + name + ")" + 
           '"/>';
        // The info window version with the "to here" form open
        from_htmls = title+"<br/>"+html + '<br>Directions: <a href="javascript:tohere(' + i + ')">To here</a> - <b>From here</b>' +
           '<br>End address:<form action="http://maps.google.com/maps" method="get"" target="_blank">' +
           '<input type="text" SIZE=40 MAXLENGTH=40 name="daddr" id="daddr" value="" /><br>' +
           '<INPUT value="Get Directions" TYPE="SUBMIT">' +
           '<input type="hidden" name="saddr" value="' + point.lat() + ',' + point.lng() +
                  // "(" + name + ")" + 
           '"/>';
        // The inactive version of the direction info
        html = html + '<br>Directions: <a href="javascript:tohere('+i+')">To here</a> - <a href="javascript:fromhere('+i+')">From here</a>';

	 GEvent.addListener(marker, "click", function() {
	          marker.openInfoWindowHtml(title+'<br/>'+address+'<br/>'+html);
	        });

        marker.openInfoWindowHtml(title+'<br/>'+address+'<br/>'+html);
		gmarkers[i] = marker;
        }
      }
    );
  }
}
