// -------------------------------
// FONCTIONS MAP
// -------------------------------
<!--
	var map = null;
	
	// Ajoute le marker de NETIM &agrave; la carte
	function createMarkerNetim()
	{

		var affichage = "";
		var imgInfoBulle = "<img src=\"../images/map/map_euratechnologie.png\"/>";
		var imgMarker = "<img src=\"../images/map/map_netim.png\"/>";
		
		// Creation de l'affichage de l'info-bulle
		affichage = "<table width=\"400\"><tr><td width=\"180\" rowspan=\"2\">" +imgInfoBulle+ "</td><td width=\"220\" valign=\"middle\">" +tabNetim["TITRE"]+ "</td></tr>";
		affichage += "<tr><td>&nbsp;</td></tr>";
		affichage += "<tr><td colspan=\"2\">" +tabNetim["TEXTE"]+ "</td></tr>";
		affichage += "<tr><td colspan=\"2\"><a href=\"../netim/\">" +moreInformation+ "</a></td></tr></table>";
		
		// Cr&eacute;ation du marqueur
		var icone = new GIcon(G_DEFAULT_ICON);
		icone.iconSize = new GSize(20, 20);
		icone.shadow = "";
		icone.image = "../images/map/map_netim.png";
		icone.iconAnchor = new GPoint(15, 15);
		
		var coordonnee = new GLatLng(50.6347506, 3.0223560);
		var marker = new GMarker(coordonnee, {icon: icone, title: "NETIM", draggable: false});
		GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(affichage);} );
		
		return marker;
	}
	
	// Cr&eacute;e un marqueur sur la map &agrave; partir des informations du domaine
	function createMarker(infoDomain) 
	{
		// Declaration des variables
		var width = 25;
		var affichageRestrict = "";
		var ext = infoDomain["EXT"];
		var icone = null;
		var coordonnee = null;
		var marker = null;
		var affichage = "";
		
		// Initialisations des variables
		if(infoDomain["EXT"].length > 3)
		{
			width = 50;
			ext = infoDomain["EXT"].substring(infoDomain["EXT"].length-2, infoDomain["EXT"].length);
		}
		
		flag = "<img src=\"../images/flags/flag_" +ext+ "_max.gif\" />";
		
		switch(infoDomain["RESTRICT"])
		{
			case 0: affichageRestrict = noRestrict; break;
			case 1: affichageRestrict = lowRestrict; break;
			case 2: affichageRestrict = restrict; break;
		}
	
		// Creation de l'affichage de l'info-bulle
		affichage = "<table width=\"400\"><tr><td width=\"50\" rowspan=\"2\">" +flag+ "</td><td width=\"350\">" +infoDomain["PAYS"]+ "</td></tr>";
		affichage += "<tr><td>." +infoDomain["EXT"]+ "</td></tr>";
		affichage += "<tr><td colspan=\"2\">" +infoDomain["TEXTE"]+ "</td></tr>";
		affichage += "<tr><td colspan=\"2\">" +affichageRestrict+ "</td></tr>";
		affichage += "<tr><td colspan=\"2\"><a href=\""+link_info.replace("EXT",ext)+".php\">" +moreInformation+ "</a></td></tr></table>";
	
		// Cr&eacute;ation du marqueur
		icone = new GIcon(G_DEFAULT_ICON);
		icone.iconSize = new GSize(width, 25);
		icone.shadow = "";
		icone.image = "../images/map/map_" +infoDomain["EXT"]+ ".png";
		icone.iconAnchor = new GPoint(width/2, 15);
		
		coordonnee = new GLatLng(infoDomain["LAT"], infoDomain["LNG"]);
		marker = new GMarker(coordonnee, {icon: icone, title: infoDomain["PAYS"], draggable: false});
		GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(affichage);} );
		
		return marker;
	}
	
	// Charge la map dans la div qui a pour id "map"
	function loadMap()
	{
		var divMap = document.getElementById("map");
		
    	if (GBrowserIsCompatible())
		{
        	map = new GMap2(divMap);
        	map.setCenter(new GLatLng(52, 15), 4);
			map.setMapType(G_PHYSICAL_MAP);
			map.addControl(new GLargeMapControl3D());
			
			for (key in tabInfoDomain)
			{
				if (tabInfoDomain[key]["MARKER"])
					map.addOverlay(createMarker(tabInfoDomain[key]));
			}
			
			map.addOverlay(createMarkerNetim());
    	}
		else
			alert("Your browser is not compatible with the map");
    }
	
	// Centre la map sur l'Europe
	function centrer() 
	{
		map.setCenter(new GLatLng(52, 15), 4);
	}
	
	// Centre sur NETIM
	function goToNetim()
	{
		var coordonnee = new GLatLng(50.6347506, 3.0223560);
		if (map.getZoom() < 5)
			map.setCenter(coordonnee, 5);
		else
			map.panTo(coordonnee);
	}
	 
	// Charge les boutons de selection
	function loadSelect()
	{
		var selectPays = document.getElementById("PAYS");
		var selectExt = document.getElementById("EXT");
		
		for (key in tabInfoDomain)
		{
			if (tabInfoDomain[key]["MARKER"])
				selectPays.options[selectPays.options.length] = new Option(tabInfoDomain[key]["PAYS"], tabInfoDomain[key]["EXT"]);
			
			if(tabInfoDomain[key]["EXT"])
			selectExt.options[selectExt.options.length] = new Option("."+tabInfoDomain[key]["EXT"], tabInfoDomain[key]["EXT"]);	
		}
	}
	
	function clickSelect(selectButton)
	{
		if (selectButton.value != "rechercher")
		{			
			var ext = selectButton.value;
			if(ext.length > 3)
				ext = ext.substring(ext.length-2, ext.length);
			locateMap(ext, false);
		}
	}
	
	function locateMap(locate, sleep)
	{
		for (key in tabInfoDomain)
		{
			var ext = tabInfoDomain[key]["EXT"];
			if(tabInfoDomain[key]["EXT"])
			{
				if(ext.length > 3)
					ext = ext.substring(ext.length-2, ext.length);
				if (ext == locate)
				{	
					if (sleep)
					{
						map.setCenter(new GLatLng(52, 15), 5);
						window.setTimeout(function() {
						  map.panTo(new GLatLng(tabInfoDomain[key]["LAT"], tabInfoDomain[key]["LNG"]));
						}, 4000);
					}
					else
						map.panTo(new GLatLng(tabInfoDomain[key]["LAT"], tabInfoDomain[key]["LNG"]));
					
					break;
				}
			}
		}
	}

	
//-->
