if (GBrowserIsCompatible()) {
      
      // this variable will collect the html which will eventually be placed in the side_bar
      var side_bar_html = "";
    
      // arrays to hold copies of the markers and html used by the side_bar
      // because the function closure trick doesnt work there
      var gmarkers = [];
      var i = 0;


      // A function to create the marker and set up the event window
      function createMarker(point,name,html) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
		GEvent.addListener(marker, "dblclick", function() {
map.setCenter(point);
map.zoomIn();
});
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        // add a line to the side_bar html
        side_bar_html += '<br><a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
        i++;
        return marker;
      }


      // This function picks up the click and opens the corresponding info window
      function myclick(i) {
        GEvent.trigger(gmarkers[i], "click");
      }
	  


	// crear el mapa
	//obtener coordenadas google maps función: javascript:void(prompt('',gApplication.getMap().getCenter()));

var map = new GMap2(document.getElementById("map"));

map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());

switch (sucursal){
	
case 1: map.setCenter(new GLatLng(20.660414, -103.345299), 12); break;//index

case 2: map.setCenter(new GLatLng(20.65476168423888, -103.37939500808716), 15); break;//abastos

case 3: map.setCenter(new GLatLng(20.593409702057624, -103.32395911216736), 15); break;//aeropuerto

case 4: map.setCenter(new GLatLng(20.62746260345542, -103.41816365718842), 15); break;//aguilas

case 6: map.setCenter(new GLatLng(20.64051034802345, -103.39076489210129), 15); break;//cruz del sur

case 7: map.setCenter(new GLatLng(20.65900821362569, -103.33510100841522), 15); break;//ejercito

case 8: map.setCenter(new GLatLng(20.6515189826177, -103.33727359771729), 15); break;//gonzález gallo

case 9: map.setCenter(new GLatLng(20.65934451761969, -103.43666553497314), 14); break;//guadalupe

case 11: map.setCenter(new GLatLng(20.69888390686402, -103.2946814596653), 15); break;//obrero

case 12: map.setCenter(new GLatLng(20.633487, -103.329538), 15); break;//guadalajara

case 13: map.setCenter(new GLatLng(20.514429,-103.410745), 13); break;//tlajomulco

case 14: map.setCenter(new GLatLng(20.634694475430116, -103.28353688120842),15); break;//tonala

case 15: map.setCenter(new GLatLng(20.715090409729356, -103.37844014167786), 15); break;//zapopan

case 16: map.setCenter(new GLatLng(20.633487, -103.329538), 15); break;//r. michel


	
}

	



map.enableScrollWheelZoom();

// añade los marcadores
//abastos 0
var point = new GLatLng(20.65476168423888, -103.37939500808716);
var marker = createMarker(point,"Abastos","Sucursal Abastos<br>Av. L&aacute;zaro C&aacute;rdenas # 2305 <br>Tel. (33) 3671-3698")
map.addOverlay(marker);
//aereopuerto 1
var point = new GLatLng(20.593409702057624, -103.32395911216736);
var marker = createMarker(point,"Aereopuerto","Sucursal Aeropuerto<br>Av. de la Solidaridad Iberoamericana #1800<br>Tel. (33) 3606-1356")
map.addOverlay(marker);
//aguilas http://maps.google.com/?ie=UTF8&ll=,&spn=0.007009,0.009484&z=17    2
var point = new GLatLng(20.62746260345542, -103.41816365718842);
var marker = createMarker(point,"&Aacute;guilas","Sucursal Las &Aacute;guilas<br>Av. L&oacute;pez Mateos Sur # 5465 <br>Tel. (33) 3631-9602")
map.addOverlay(marker);
//cruz del sur http://maps.google.com/?ie=UTF8&ll=20.640576,-103.390864&spn=0.007008,0.009484&z=17    3
var point = new GLatLng(20.64051034802345, -103.39076489210129);
var marker = createMarker(point,"Cruz del sur","Sucursal Cruz del Sur<br>Estrecho # 3040 <br>Tel. (33) 3632-0839")
map.addOverlay(marker);
//Guadalajara    4
var point = new GLatLng(20.633487, -103.329538);
var marker = createMarker(point,"R. Michel","Sucursal R. Michel<br>Av. Dr. R. Michel # 2540<br>Tels. (33) 3837-5610 <br>De otra Ciudad sin costo:<br>Tel. (01 800) 627-2044")
map.addOverlay(marker);
//ejercito  5
var point = new GLatLng(20.65900821362569, -103.33510100841522);
var marker = createMarker(point,"Eje&eacute;rcito","Sucursal Ej&eacute;rcito<br>Calz. del Ej&eacute;rcito # 762 S.R.<br>Tels. (33) 3619-3030")
map.addOverlay(marker);
//glez gallo http://maps.google.com/?ie=UTF8&ll=20.6518,-103.337574&spn=0.014015,0.018969&z=16    6
var point = new GLatLng(20.6515189826177, -103.33727359771729);
var marker = createMarker(point,"Glez Gallo","Sucursal Glez. Gallo<br>Calzada del Ej&eacute;rcito #1612 <br>Tel. (33) 3619-7672")
map.addOverlay(marker);
//Guadalupe    7
var point = new GLatLng(20.65934451761969, -103.43666553497314);
var marker = createMarker(point,"Guadalupe","Sucursal Guadalupe<br>Av. Guadalupe # 6000 <br>Tel. (01-33) 3628-7500")
map.addOverlay(marker);
//Obrerohttp://maps.google.com/maps?f=q&hl=es&geocode=&q=&ie=UTF8&ll=20.698988,-103.29423&spn=0.006714,0.009484&z=17    8
var point = new GLatLng(20.69888390686402, -103.2946814596653);
var marker = createMarker(point,"Obrero","Sucursal Obrero<br>Calzada Juan Pablo II # 2603 <br>En la Glorieta del Obrero <br>Tel. y Fax: (33) 3651-7720")
map.addOverlay(marker);
//tlajomulco     9
var point = new GLatLng(20.514429,-103.410745);
var marker = createMarker(point,"Tlajomulco","Sucursal Tlajomulco<br>Carretera San Sebastian <br>El Grande-Tlajomulco #1575<br>Tel. (33) 3188-2913")
map.addOverlay(marker);
//tonala      10
var point = new GLatLng(20.634694475430116, -103.28353688120842);
var marker = createMarker(point,"Tonala","Sucursal Tonal&aacute;<br>Jorge &Aacute;lvarez del Castillo 379<br>Tel. (33) 3601-5501")
map.addOverlay(marker);
//zapopan    11
var point = new GLatLng(20.715090409729356, -103.37844014167786);
var marker = createMarker(point,"Zapopan","Sucursal Zapopan<br>Av. &Aacute;vila Camacho # 2970<br>Tel. (33) 3656-7390")
map.addOverlay(marker);

//Dr michel    14
var point = new GLatLng(20.633488, -103.329539);
var marker = createMarker(point,"Dr. Michel","Sucursal Dr. Michel<br>Av. Dr. R. Michel # 2540<br>Tels. (33) 3837-5610 <br>De otra Ciudad sin costo:<br>Tel. (01 800) 627-2044")
map.addOverlay(marker);





//Libertad
//var point = new GLatLng(20.670221,-103.346071);
//var marker = createMarker(point,"Orma Libertad","Libertad")
//map.addOverlay(marker);
	
	
      // put the assembled side_bar_html contents into the side_bar div
     //document.getElementById("side_bar").innerHTML = side_bar_html;
      
    }
    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser.\nDisculpa, pero este navegador no es compatible con la API de Google Maps.");
    }


