//  Goggle Stuff  //

var maplink;
var map;        // Google Maps
var gdir;        // Google Directions
var geocoder;// Google Geocode

/**
 * hoverControls method to hide/show GControls by 'mouseout'/'mouseover'
 * @author Esa 2006, 2008
 */
// Google Maps code
function initGMaps() {
	if( GBrowserIsCompatible() ) {
		_mPreferMetric = true;
		map = new GMap2( document.getElementById("map") );
		map.setCenter( new GLatLng(entreprise.lat, entreprise.lng), 15 );
		
		geocoder = new GClientGeocoder();
		map.addControl( new GSmallMapControl() );
		map.addControl( new GMapTypeControl() );
		map.addControl( new GScaleControl() );
		map.hoverControls();
		map.enableDoubleClickZoom();
		map.enableScrollWheelZoom();
	}
}

function positionPoint( point ) {
	if( !point ) { // Gestion d'erreurs
		$("#map").css('display','none');
	}
	else {
		$("#map").css('display','block');
		map.setCenter( point );	
		var newDefaultIcon = new GIcon( G_DEFAULT_ICON );
		markerOptions = { icon:newDefaultIcon };
	
		var marker = new GMarker(point, markerOptions);
		GEvent.addListener( marker, "click", function() { window.open( maplink ); } );
		
		map.addOverlay( marker );
	}
}

GMap2.prototype.hoverControls = function( opt_noCloseIw ) {
	var theMap = this;
	theMap.hideControls();
	GEvent.addListener( theMap, "mouseover", function() { theMap.showControls(); } );
	GEvent.addListener( theMap, "mouseout",  function() { theMap.hideControls(); } );
}
GMap.prototype.hoverControls = GMap2.prototype.hoverControls;

