var markersArray = [
					{lat : 43.648498, lng : 5.254624, title : "Ingénieur développeur Moteurs de Recherche - Antidot", cat : "xp", item : "antidot"},
					{lat : 45.569243, lng : -73.691268, title : "Ingénieur Web - Webmatique", cat : "xp", item : "webmatique"},
					{lat : 43.309496, lng : 5.389663, title : "Ingénieur Systèmes d'Information - Incubateur multimédia Belle de Mai", cat : "xp", item : "antidot"},
					{lat : 43.49304, lng : 5.375313, title : "Analyste programmeur Systèmes d'Information - CETE Méditerranée (stage) ", cat : "xp", item : "cete"},
					{lat : 43.233995, lng : 5.442653, title : "Diplome d'ingénieur Informatique Réseaux et Multimédia", cat : "formation", item : "esil"},
					{lat : 43.233924, lng : 5.442642, title : "T.O.E.I.C.", cat : "formation", item : "toeic"},
					{lat : 43.63849, lng : 5.098279, title : "Baccalauréat série S", cat : "formation", item : "emperi"},
					{lat : 43.51467, lng : 5.451182, title : "D.U.T. Informatique", cat : "formation", item : "iut"},
					{lat : 43.553177, lng : 5.207938, title : "Basket-Ball", cat : "hobbie", item : "basket"},
					{lat : 43.284336, lng : 5.397731, title : "Réserviste - Gendarmerie Nationale", cat : "annexe", item : "gendarmerie"},
					{lat : 43.43531, lng : 5.224476, title : "Agent de piste - Sécurité Civile", cat : "annexe", item : "smti"},
					{lat : 43.528895, lng : 5.44998, title : "Vendeur en rayons - GAP", cat : "annexe", item : "gap"},
					{lat : 43.606934, lng : 4.996076, title : "Préparateur de commandes - ID Logistics", cat : "annexe", item : "idl"},
					{lat : 43.232584, lng : 5.443093, title : "T.O.E.I.C.", cat : "formation", item : "toeic"},
					{lat : 43.649387, lng : 5.261341, title : "Mulebit.com", cat : "projet", item : "mulebit"},
					{lat : 43.653668, lng : 5.263669, title : "BC.com", cat : "projet", item : "bc"},
					{lat : 40.729047, lng : -73.996525, title : "Voyages", cat : "hobbie", item : "voyages"},
					{lat : 43.526586, lng : 5.448933, title : "Cinéma", cat : "hobbie", item : "cinema"}
				   ];

function addEventToMarker(marker, cat, item)
{
	google.maps.event.addListener(marker, 'click', function() { 
										if (cat == currentCategory)
										{
											if((currentCategory == "xp" || currentCategory == "projet") && item != currentItem)
												selectItem(item);
										}
										else
											displayCategory(cat, item);
																});
} 
  
				   
function onGoogleMapLoad() 
{
	mapContainer = document.getElementById("googlemap");
	if(mapContainer == undefined)
		return
    var latlng = new google.maps.LatLng(43.484812, 5.331116);
    var myOptions = {
      zoom: 9,
      center: latlng,
	  disableDefaultUI: true,
	  streetViewControl: false,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(mapContainer, myOptions);
		
	var icons = {xp : "fleche_bleue.png", annexe : "fleche_jaune.png", projet : "fleche_verte.png", formation : "fleche_rouge.png", hobbie : "fleche_grise.png"};
				  
	for (i = 0; i < markersArray.length; ++i)
	{
		var marker = new google.maps.Marker({
									      position : new google.maps.LatLng(markersArray[i]["lat"], markersArray[i]["lng"]),
										  title : markersArray[i]["title"],
										  icon : "/img/" + icons[markersArray[i]["cat"]]
										  });
		var cat = markersArray[i]["cat"];
		var item = markersArray[i]["item"];
		addEventToMarker(marker, cat, item);
		marker.setMap(map);
	}
}


