$(document).ready(function(){
	var firstName = "First";
	var lastName = "Last";
	var firstBox = $("#fm_first");
	var lastBox = $("#fm_last");
	
	firstBox.attr("value", firstName);
	lastBox.attr("value", lastName);
	firstBox.focus(function () {
        boxFocus($(this), firstName);
    });
	firstBox.blur(function () {
        boxBlur($(this), firstName);
    });
	lastBox.focus(function () {
        boxFocus($(this), lastName);
    });
	lastBox.blur(function () {
        boxBlur($(this), lastName);
    });
	
	function boxFocus(object, defaultText){
		object.addClass("active");
		if(object.attr("value") == defaultText) object.attr("value", "");
	};
	function boxBlur(object, defaultText){
		object.removeClass("active");
		if(object.attr("value") == "") object.attr("value", defaultText);
	};
});

function add_location_map( locLat, locLon, markerText, zoom ){
	if( GBrowserIsCompatible() ){
		// arrays to hold copies of the markers and html used by the side_bar
		// because the function closure trick doesnt work there
		var gmarkers = [];
		var htmls = [];
		var i = 0;
		
		if( !zoom )	{ var zoom = 16; }
		
		// A function to create the marker and set up the event window
		function createMarker( point,html ){
			var marker = new GMarker(point);
			GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
			i++;
			return marker;
		}
	
	
		// This function picks up the click and opens the corresponding info window
		function myclick( i ){
			gmarkers[i].openInfoWindowHtml(htmls[i]);
		}
	
		// create the map
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GSmallMapControl());
		//map.addControl(new GMapTypeControl());
		
		var point = new GLatLng(locLat,locLon);
		map.setCenter(point,zoom);
		
		var marker = createMarker(point,markerText)
		map.addOverlay(marker);
		
	} else { alert("Sorry, the Google Maps API is not compatible with this browser"); }
};
