var map = null;
var geocoder = null;

var strOplTitle = "<a href=\"http://www.openlog.fr\" target=\"_blank\">Open Log</a><br />SSII - e-BUSINESS<br />Zac de la Teillais - rue Jean-Marie David - 35740 PACÉ<br />Tél. : +33 02 99 23 10 10 - Fax : +33 02 99 23 74 19";
var strOplAddress = "rue Jean-Marie David - 35740 PACÉ -France";

function showAddress(address,title)
{
	if( title == null )
	{
		title = address;
	}
    geocoder = new GClientGeocoder();
    geocoder.getLatLng(
		address,
		function(point) {
			if (!point) {
			alert("L'adresse '" + address + "' n'a pas été trouvée.");
			} else {
				map.setCenter(point, 13);
				var marker = new GMarker(point);
				map.addOverlay(marker);
				marker.openInfoWindowHtml(title);
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowHtml(title);
				});
			}
		}
	);
}

window.attachEvent
(
	"onload",
	function ()
	{
		var d = document;
		var strClass = d.body.getAttributeNode("class");
		if( strClass && (strClass.value).indexOf("PLAN_D_ACCES") != -1 )
		{
			var oDiv = d.createElement("DIV");
			oDiv.setAttribute("id","GOOGLEMAP");
			var oContent = d.getElementById("googleForm");
		 	oContent.appendChild(oDiv);
			oDiv.style.height = "400px";
			oDiv.style.width = "500px";
			if ( GBrowserIsCompatible() )
			{
				map = new GMap2( oDiv );
				map.addControl(new GSmallMapControl());
				map.addControl(new GMapTypeControl());
				map.setCenter(new GLatLng(48.15, -1.7666667), 11);
				showAddress(strOplAddress,strOplTitle);
			}
		}
	}
)

