
var map;
var markerOptions;


function initialize()
{
      if (GBrowserIsCompatible())
      {
		

        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(4.570868, -74.297333), 5);
        var customUI = map.getDefaultUI();
        map.setUI(customUI);

		cargaDatos();
		
		
      }
}

/*
 *
 * @access public
 * @return void
 **/
/*function centrar(id)
{


	switch(id)
	{

	case 1:
	map.setCenter(new GLatLng(6.2589909942876325, -75.57117462158203));
	map.setZoom(12);
	break;

	case 2:
	map.setCenter(new GLatLng(7.890588474156229, -76.563720703125));
	map.setZoom(11);


	break;

	case 3:
	map.setCenter(new GLatLng(5.038278895550081, -75.49324035644531));
	map.setZoom(11);
	break;

	case 4:
	map.setCenter(new GLatLng(4.815003069563151, -75.6917667388916));
	map.setZoom(14);
	break;

	case 5:
	map.setCenter(new GLatLng(3.4222215866469567, -76.52406692504883));
	map.setZoom(11);

	break;

	case 6:
	map.setCenter(new GLatLng(3.743671274749731, -76.2890625));
	map.setZoom(10);
	break;

	case 7:
	map.setCenter(new GLatLng(3.2479805508984985, -76.5333366394043));
	map.setZoom(13);
	break;

	case 8:
	map.setCenter(new GLatLng(4.683876452449536, -74.080810546875));
	map.setZoom(12);
	break;

	case 9:
	map.setCenter(new GLatLng(4.789942967844043, -74.1522216796875));
	map.setZoom(10);
	break;

	case 10:
	map.setCenter(new GLatLng(7.115371743143529, -73.11148166656494));
	map.setZoom(15);
	break;

	case 11:
	map.setCenter(new GLatLng(10.976246247006731, -74.81002807617188));
	map.setZoom(13);
	break;

	case 12:
	map.setCenter(new GLatLng(10.403910151587073, -75.52310943603516));
	map.setZoom(13);
	break;

	case 13:
	map.setCenter(new GLatLng(6.500899137995968, -75.39093017578125));
	map.setZoom(9);
	
	case 14:
	map.setCenter(new GLatLng(4.52874, -75.704292));
	map.setZoom(9);

	}


}*/

/*window.addEvent('domready', function(){
	$('drop_down_menu').getElements('li.menu').each( function( elem ){
		var list = elem.getElement('ul.links');
		var myFx = new Fx.Slide(list).hide();
		elem.addEvents({
			'mouseenter' : function(){
				myFx.cancel();
				myFx.slideIn();
			},
			'mouseleave' : function(){
				myFx.cancel();
				myFx.slideOut();
			}
		});
	})
});*/


/**
 *
 * @Clase Place
 * @return void
 **/
function place(){

	this.latitude;
	this.longitude;

	this.direccion;
	this.telefono;
	this.descripcion;
	this.marker;
	this.muni;
	this.depa;

}

/**
 *
 * @access public
 * @return void
 **/
function cargaDatos()
{ 
var i=0;
		for(i;i<ips.length;i++)
		{
		 var aux=ips[i];
		
		 var marker=createMarker(new GLatLng(aux.latitude,aux.longitude),aux.descripcion,1);
		 aux.marker=marker;

		 map.addOverlay(marker);

		}
		for(i=0;i<farma.length;i++)
		{
		
		 var aux=farma[i];

		 var marker=createMarker(new GLatLng(aux.latitude,aux.longitude),aux.descripcion,2);
		 aux.marker=marker;

		 map.addOverlay(marker);

		}

}

function createMarker(point,desc,tipo) {
          
         var myIcon = new GIcon(G_DEFAULT_ICON);
		 myIcon.shadow = null;
		 
		 
		 if(tipo==1)myIcon.image = "images/icon.png";
		 if(tipo==2) myIcon.image ="images/icon2.png";
			
		  
		 myIcon.iconSize = new GSize(30, 30);
		 markerOptions = { icon:myIcon };

          var marker = new GMarker(point, markerOptions);
			
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(desc);
          });
          return marker;
        }
		
function escojeTipo(a)
{
	
	
	var b;
	if(a.value==1)
	{
	
		b=ips;
	}
	else
	{
		b=farma;
	}
	
	for(var i=0;i<b.length;i++)
	{
		if(a.checked)b[i].marker.show();
		else b[i].marker.hide();
	}
	
}
