	var ViaM_ns = false;
	var ViaM_moz = false;
	var ViaM_ie = false;
	var ViaM_saf = false;

	if (navigator.userAgent.indexOf("Firefox") != -1) {
		ViaM_moz = true;
	} else if (navigator.userAgent.indexOf("MSIE") != -1) {
		ViaM_ie = true;
	} else if (navigator.userAgent.indexOf("Netscape") != -1) {
		ViaM_ns = true;
	} else if (navigator.userAgent.indexOf("Safari") != -1) {
		ViaM_saf = true;
	}
	
	// *****************************************************
	// *****************************************************
	function IsNumeric(sText) {
	   var ValidChars = "-0123456789.";
	   var IsNumber=true;
	   var Char;
	
	   for (i = 0; i < sText.length && IsNumber == true; i++) { 
	      Char = sText.charAt(i); 
	      if (ValidChars.indexOf(Char) == -1) {
	         IsNumber = false;
	      }
	   }
	   return IsNumber;
	};

	// *****************************************************
	// *****************************************************
	function setElementOpacity(id,opacity) {
		if ((opacity == 100) && (ViaM_ie)) 
			document.getElementById(id).style.filter = "none";
		else if (ViaM_ie) 
			document.getElementById(id).style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ")";
		else if (ViaM_moz) 
			document.getElementById(id).style.MozOpacity = opacity/100;
		else 
			document.getElementById(id).style.opacity = opacity/100;
	};

	// *****************************************************
	// *****************************************************
	function disableFormElements(f) {
		for (cpt=0; cpt< f.elements.length; cpt++) {
			f.elements[cpt].disabled = true;
		}
	};
	
	// *****************************************************
	// *****************************************************
	function enableFormElements(f) {
		for (cpt=0; cpt< f.elements.length; cpt++) {
			f.elements[cpt].disabled = false;
		}
	};
	
	// *****************************************************
	// *****************************************************
	function showDocElement(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.visibility='visible';
		} else {
			//alert(id);
		}
	};
	
	// *****************************************************
	// *****************************************************
	function hideDocElement(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.visibility='hidden';
		} else {
			//alert(id);
		}
	};

	// *****************************************************
	// *****************************************************
	function displayDocElement(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.display='';
		} else {
			//alert(id);
		}
	};
	
	// *****************************************************
	// *****************************************************
	function unDisplayDocElement(id) {
		if (document.getElementById(id)) {
			document.getElementById(id).style.display='none';
		} else {
			//alert(id);
		}
	};

	// ****************************************************************************************************
	// Display a generatedMap
	// ****************************************************************************************************
	/* REPLACED BY SEBASTIEN
	function showGeneratedMap(oGeneratedMap) {
		if (document.getElementById('mapDiv')) {
			var mapDiv = document.getElementById('mapDiv');
			mapDiv.style.height = oGeneratedMap.mapDefinitions.byId.MapHeight+"px";
			mapDiv.style.width = oGeneratedMap.mapDefinitions.byId.MapWidth+"px";						
		
			var img = document.getElementById('carteDyn');
			img.style.height = oGeneratedMap.mapDefinitions.byId.MapHeight+"px";
			img.style.width = oGeneratedMap.mapDefinitions.byId.MapWidth+"px";	
			img.src = oGeneratedMap.mapURL;
		
			//document.getElementById('copyright2').innerHTML = oGeneratedMap.copyright;
			//document.getElementById('copyright1').innerHTML = oGeneratedMap.copyright;		
		
			displayDocElement('mapDiv');
			showDocElement('mapDiv');
			showDocElement('carteDyn');
			if (document.getElementById('mapScaleBar')) {
				showDocElement('mapScaleBar');
			}
			ViaM_init();
			computeScale(oGeneratedMap);
		}
		
		if (document.getElementById('MapDefListLayer')) {
			displayMapDefListInfos(oGeneratedMap.mapDefinitions);
		}
	}
	*/
	
	function showGeneratedMap(oGeneratedMap) {
		if (document.getElementById('mapDiv')) {
			//alert("mapDiv found");
			//var mapDiv = document.getElementById('mapDiv');
			//mapDiv.style.height = oGeneratedMap.mapDefinitions.byId.MapHeight+"px";
			//mapDiv.style.width = oGeneratedMap.mapDefinitions.byId.MapWidth+"px";						
		
			var img = document.getElementById('carteDyn');
			img.style.height = oGeneratedMap.mapDefinitions.byId.MapHeight+"px";
			img.style.width = oGeneratedMap.mapDefinitions.byId.MapWidth+"px";	
			img.src = oGeneratedMap.mapURL;
			//document.getElementById('copyright2').innerHTML = oGeneratedMap.copyright;
			//document.getElementById('copyright1').innerHTML = oGeneratedMap.copyright;		
		

			//ViaM_init();
			//computeScale(oGeneratedMap);
		}
	};
	
	// *********************************************************************************
	// *********************************************************************************
	function showItineraryMap(mapId, mapWidth, mapHeight, oititraceList) {
		ititraceList = oititraceList;
		mapManagement_getMapByID(mapId, mapWidth, mapHeight, null, 0, true, null, null, oititraceList);
	};
	
	// *********************************************************************************
	// *********************************************************************************
	function showItineraryDetailMap(mapId, mapWidth, mapHeight, oititraceList, mapdiv, carteDyn) {
		ititraceList = oititraceList;
		var mainMap = generatedMap;
		var genMap = mapManagement_getMapByID_sync(mapId, mapWidth, mapHeight, null, currImgFormat, true, null, null, oititraceList);
		if (document.getElementById(mapdiv)) {
			var mapDiv = document.getElementById(mapdiv);
			mapDiv.style.height = genMap.mapDefinitions.byId.MapHeight+"px";
			mapDiv.style.width = genMap.mapDefinitions.byId.MapWidth+"px";						
			var img = document.getElementById(carteDyn);
			img.style.height = genMap.mapDefinitions.byId.MapHeight+"px";
			img.style.width = genMap.mapDefinitions.byId.MapWidth+"px";	
			img.src = genMap.mapURL;
			displayDocElement(mapdiv);
			showDocElement(mapdiv);
			showDocElement(carteDyn);
		} 
		generatedMap = mainMap;
	};

	// *********************************************************************************
	// *********************************************************************************
	function showItineraryRoadmap(htmlCode) {
		if (document.getElementById('ItineraryRoadMap')) {
			showDocElement('ItineraryRoadMap');
			document.getElementById('ItineraryRoadMap').innerHTML = htmlCode;
		}
	};

	// *********************************************************************************
	// Hide the map and the related elements (scalebar, ml, ...) on the result html page
	// *********************************************************************************
	function hideMap() {
		unDisplayDocElement('mapDiv');
		hideDocElement('mapDiv');
		hideDocElement('carteDyn');
		hideDocElement('mapScaleBar');
		
		if (get("mlNorth")) {
			get("mlNorth").style.visibility = "hidden";
		}
		if (get("mlWest")) {
			get("mlWest").style.visibility = "hidden";
		}
		if (get("mlSouth")) {
			get("mlSouth").style.visibility = "hidden";
		}
		if (get("mlEast")) {
			get("mlEast").style.visibility = "hidden";
		}
		if (get("mlNWVert")) {
			get("mlNWVert").style.visibility = "hidden";
			get("mlNWHor").style.visibility = "hidden";
		}
		if (get("mlSWVert")) {
			get("mlSWVert").style.visibility = "hidden";
			get("mlSWHor").style.visibility = "hidden";
		}
		if (get("mlSEVert")) {
			get("mlSEVert").style.visibility = "hidden";
			get("mlSEHor").style.visibility = "hidden";
		}
		if (get("mlNEVert")) {
			get("mlNEVert").style.visibility = "hidden";
			get("mlNEHor").style.visibility = "hidden";
		}						
	};

	// *********************************************************************************
	// *********************************************************************************
	function displayError(errorMsg, errorMsgDetail) {
		var date = new Date();
		var msg = '<b>[' + date.toUTCString() + ']</b><br/> ';
		if ((errorMsg != null) && (typeof(errorMsg) != "undefined")) {
			msg += errorMsg + '<br/><br/>';
		}

		//if ((errorMsgDetail != null) && (typeof(errorMsgDetail) != "undefined")) {
		//	msg += errorMsgDetail + '<br/><br/>';
		//}
		alert("error : one of step was not found");
		//document.getElementById("DivErrorBlockMessage").innerHTML = msg + document.getElementById("DivErrorBlockMessage").innerHTML;
	};
	
	
	function clearErrorBlockMessage() {
		document.getElementById("DivErrorBlockMessage").innerHTML = "";
	};
	
	// *********************************************************
	// Function which generates map from map identifier 
	// *********************************************************	
	function genMapByID(mapId, width, height, mapActionList, imgFormat, withCopyright, pinLogoList, polylinesList, ititrace) {
		mapManagement_getMapByID(mapId, width, height, mapActionList, imgFormat, withCopyright, pinLogoList, polylinesList, ititrace);
	};
	
	// *********************************************************
	// Function which generates map from a scale and a centre
	// *********************************************************	
	function genMapByScale(psize, coord, width, height, mapActionList, imgFormat, withCopyright, pinLogoList, polylinesList, ititrace) {
		mapManagement_getMapByScale(psize, coord, width, height, mapActionList, imgFormat, withCopyright, pinLogoList, polylinesList, ititrace);
	};			
	