	var map = null;
	var center = new GLatLng(46.040048,4.071807);
	var initZoom = 9;
	var id = '';
	
	//Création de marker pour les fiches
	function createMarker(point, mess, ico) {
		var infoTabs = [
						new GInfoWindowTab("Nom", mess)
						];
		var marker = new GMarker(point, ico);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowTabsHtml(infoTabs);
		});
		return marker;
	}
	
	//Création de marker pour l'OT avec les coordonnées
	function createMarkerOT(point, mess, mess2, ico) {
		var infoTabs = [
						new GInfoWindowTab("Nom", mess),
						new GInfoWindowTab("Coordonnées", mess2)
						];
		var marker = new GMarker(point, ico);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowTabsHtml(infoTabs);
		});
		return marker;
	}
	
    function load() {
      if (GBrowserIsCompatible()) {
		if(idoi != "")
		{
        	map = new GMap2(document.getElementById("map"),{mapTypes:[G_HYBRID_MAP,G_PHYSICAL_MAP,G_NORMAL_MAP,G_SATELLITE_MAP]});
		}else{
			map = new GMap2(document.getElementById("map"),{mapTypes:[G_PHYSICAL_MAP,G_NORMAL_MAP,G_HYBRID_MAP,G_SATELLITE_MAP]});
		}
		map.addControl(new GLargeMapControl());
        map.addControl(new GOverviewMapControl());
        map.addControl(new GMapTypeControl());
		
		GEvent.addListener(map, "moveend", 
			function() {
				var tmpcenter = map.getCenter();
			});
		
		map.setCenter(center, initZoom);
		
		if(idoi != "")
		{
			affichTrace();
		}else{
			// positionne le CDT/OT etc.
			/*
			var point = new GLatLng(46.040048,4.071807);
			map.addOverlay(createMarkerOT(point,"<table><tr><td><img src=\"/img-le-roannais/carte-interactive/Logo.gif\" width=\"70\"></td><td class=\"Arial11pxGris\"><b>Pôle de promotion touristique du Roannais</b></td></tr></table>","<span class=\"ArialTxt10pxGris\">Maison du tourisme<br>8 place du Maréchal de Lattre de Tassigny <br> 42300 - ROANNE<br>Tél : 04.77.44.96.01 - Fax : 04.77.72.74.83</span>",iconStyle('info')));
			*/
		}
      }
    }
	
	function iconStyle(cat){
		var tmpCat = cat;
		if(tmpCat == '') tmpCat = 'default';
		if(!isNaN(cat)) tmpCat = 'default';
		if(id == cat) tmpCat = 'default';
		if(cat.lastIndexOf(",")>1) tmpCat = 'default';
		var icon = new GIcon();
		icon.image = "/img-le-roannais-rando/picto/gm"+tmpCat+".png";
		icon.shadow = "/img-le-roannais-rando/picto/gm-shadow.png";
		icon.iconSize = new GSize(40, 45);
		icon.shadowSize = new GSize(40, 40);
		icon.iconAnchor = new GPoint(20, 45);
		icon.infoWindowAnchor = new GPoint(40, 1);
		icon.infoShadowAnchor = new GPoint(20, 1);
		return icon;
	}
	
	function decode(a) {
		var b = "";
		if (a.length > 0) {
			if (a[0]) {
				if (a[0].firstChild) {
				b = a[0].firstChild.nodeValue;
			}
		}
	}
	return b;
	}
	
	function convCatTUrl(cat){
		var tmp="";
		//alert(cat)
		if(cat.indexOf("idoi") >= 0)
		{
			tmp = cat;
		}else{
			tmp = "type="+cat;
		}
		return tmp;
	}
	
	window.onload = function() {
		load();
	};
