//<![CDATA[
// functions to make google map

function getSaddr(caller)
/* 
   name:    getSaddr
   purpose: make google map query using input from search box.
*/
{
	var daddr = 'daddr=23547%20Moulton%20Parkway%20Suite%20210%2C%20Laguna%20Hills%2C%20CA%2092653';

	// get starting address from input
	var input = document.getElementById("saddr");
	var saddr = input.value;

	// append it to url then clear input
	caller.href = caller.href + daddr + '&saddr=' + escape(saddr);
	input.value = '';
}

function drawMap()
/* 
   name:    drawMap
   purpose: build a google map with marker on acupuncture office
            and with search box.
*/
{
	if (GBrowserIsCompatible()) {
		// get map container and set its styles
		// do it here to allow for different styles
		// for gif map
		var div = document.getElementById("googleMap");
		div.style.width       = '500px';
		div.style.height      = '400px';
		div.style.borderStyle = 'solid';
		div.style.borderWidth = '1px'; 
		div.style.borderColor = '#999999';
		// init map and center
		var map    = new GMap2(div)
		var center = new GLatLng(33.6205493, -117.7315827);
		map.setCenter(new GLatLng(33.6205493, -117.7315827), 13);
		// set marker
		var marker = new GMarker(center);
		var windowHtml = '<div style="font-family: Georgia, Times, serif">' +
				 'starting address:<br/>' +
				 '<input id="saddr" type="text" name="saddr" /><br/>' +
				 '[<a href="http://maps.google.com/maps?" ' +
				 'onclick="getSaddr(this);" target="_blank">' + 
				 'get directions</a>]<br/></div>';
		map.addControl(new GLargeMapControl());
		map.addOverlay(marker);
		marker.openInfoWindowHtml(windowHtml);

		// open the info window if marker is clicked
		GEvent.addListener(marker, 'click', function() {
			marker.openInfoWindowHtml(windowHtml);
		});
	}
}

//]]>

