function myclick() {
	marker.openInfoWindowHtml('<div style="white-space:nowrap;">'+marker.my_html+'</div>');
}

function tohere() {
	marker.openInfoWindowHtml('<div>'+marker.to_html+'</div>');
}
function fromhere() {
	marker.openInfoWindowHtml('<div>'+marker.from_html+'</div>');
}

var marker;

function initialize(){
	// create the map
	var map = new GMap2(document.getElementById("map_canvas"));
	
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	
	map.setCenter(new GLatLng(40.230541, -76.870277), 13);	
		
	var point = map.getCenter();
	
	var streetAddress = "710 Bridge Street, New Cumberland, PA 17070";
	
	var html = "<strong>Boreman &amp; Babb</strong><br />"+
					"Certified Public Accountants<br />"+
					"<br />"+
					"710 Bridge Street<br />"+
					"New Cumberland, PA 17070<br />";
					
	var label = "Boreman &amp; Babb";
	
	//create the marker
	marker = new GMarker(point);
	
	//Build the extra html that handles the directions links and forms
	//The inactive version of the direction info
	marker.my_html = html + '<br />Directions: <a href="javascript:tohere()">To here</a> - <a href="javascript:fromhere()">From here</a>';
	
	//The version with the "to here" form open
	marker.to_html = html + '<br />Directions: <b>To here</b> - <a href="javascript:fromhere()">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="' + streetAddress + "(" + label + ")" + '"/>';
		  
	// The version with the "to here" form open
	marker.from_html = html + '<br />Directions: <a href="javascript:tohere()">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="' + streetAddress + "(" + label + ")" + '"/>';
		  
	marker.my_name = label;
	map.addOverlay(marker);
	
	// this variable will collect the html which will eventually be placed in the sidebar
	var sidebar_html = '<a href="javascript:myclick()">' + marker.my_name + '</a><br />';
	
	showMarkerInfo();
	
	GEvent.addListener(marker, "click", function() {
		showMarkerInfo();
	});	
}

function showMarkerInfo(){			
	marker.openInfoWindowHtml(marker.my_html,{noCloseOnClick:true});
}
