var map;

  function initialize(){
	  if (GBrowserIsCompatible()) {
	    $('content2').setStyle({display: 'block'});
		map = new google.maps.Map2(document.getElementById("map"));
	    map.setCenter(new google.maps.LatLng(48.8, 2), 5);
		GEvent.addListener(map, "dragend", function() {
			var bound = map.getBounds();
		    locaAl(0,bound.getSouthWest(),bound.getNorthEast() );
		});
		$('content2').setStyle({display: 'none'});
	    //map.addControl(new GMapTypeControl());
	    map.addControl(new GScaleControl());
	    map.addControl(new GLargeMapControl());
/*	    GEvent.addListener(map, "moveend", function() {
        var center = map.getCenter();
        map.openInfoWindow(map.getCenter(), document.createTextNode(center.toString()));
      });
	*/    
	    /*GEvent.addListener(map, "load", make_request("card_list", ""));*/

	  }  
  }
  
  function loadest(){
	  if (GBrowserIsCompatible()) {
		map = new google.maps.Map2(document.getElementById("map"));
	    map.setCenter(new google.maps.LatLng(48.8, 2), 5);
	    map.addControl(new GScaleControl());
	    map.addControl(new GLargeMapControl());

	  }  
  }
  
  function doctorMapInit(){
    if (GBrowserIsCompatible())
		{
      map = new google.maps.Map2(document.getElementById("doctor_map"));
      map.setCenter(new google.maps.LatLng(48.8, 2), 5);
      map.addControl(new GScaleControl());
      map.addControl(new GLargeMapControl());
      GEvent.addListener(map, "load", ItemDocClick($('sub_infolh').down('div').identify()));
    } 
  }
  
  function AddMapMarker(estab,mode){
  //console.log(estab);
    if ((estab.MapX && estab.MapY) != undefined) { 
	    var myIcon = new GIcon(G_DEFAULT_ICON);
	    myIcon.image = "/images/" + estab.Icon; 
	    myIcon.iconSize = new GSize(20, 20);
	    myIcon.shadow = '';
	    myIcon.iconAnchor = new GPoint(0, 20);
	    markerOptions = { icon: myIcon, draggable: false};
	    var point = new GLatLng(estab.MapX, estab.MapY);
	    var marker = new GMarker(point, markerOptions);
		GEvent.addListener(marker, "click", function() {
	      marker.openInfoWindowHtml(estab.MarkerInfo,{maxWidth:350, maxHeight:200,autoScroll:true});
	    });
	    map.addOverlay(marker);		
		if (mode==1)
			marker.openInfoWindowHtml(estab.MarkerInfo);
    }
  }
  
  function AddMapMarkerTab(estab,i,j){
	var myIcon = new GIcon(G_DEFAULT_ICON);
	myIcon.image = "/images/" + estab.Icon; 
	myIcon.iconSize = new GSize(20, 20);
	myIcon.shadow = '';
	myIcon.iconAnchor = new GPoint(0, 20);
	markerOptions = { icon: myIcon, draggable: false};
	var point = new GLatLng(estab.MapX, estab.MapY);
	if(!tabmakIt[i])tabmakIt[i] = {};
	tabmakIt[i][j] = new GMarker(point, markerOptions);
	tabmakIt[i][j].infow = estab.MarkerInfo;
	GEvent.addListener(tabmakIt[i][j], "click", function() {
		this.openInfoWindowHtml(this.infow,{maxWidth:350, maxHeight:200,autoScroll:true});
	});
	map.addOverlay(tabmakIt[i][j]);
 }
  