	function removeChildrenFromNode(node)
	{
	   if(node == undefined ||
	        node == null)
	   {
	      return;
	   }

	   var len = node.childNodes.length;

		while (node.hasChildNodes())
		{
		  node.removeChild(node.firstChild);
		}
	}
  /* Permet d'afficher les messages d'erreur */
  var ShowError = function(id,conteneur,page)
  {
  	var DateDeb     = new Date();
    var beginDay    = DateDeb.getDate(); beginDay = beginDay.toString();
    var beginMonth  = DateDeb.getMonth()+1; beginMonth = beginMonth.toString();
    var beginYear   = DateDeb.getFullYear(); beginYear = beginYear.toString();
	var endValDay   = '';
	var endValMonth = '';
	var endValYear  = '';
	if(endDay !== undefined && endMonth !== undefined && endYear !== undefined)
	{
		endValDay   = endDay;
		endValMonth = endMonth;
		endValYear  = endYear;
	}
    var error = initMessageError(beginDay,beginMonth,beginYear,endValDay,endValMonth,endValYear);

      var reg=document.URL.split('/');
      var siteName = 'limousin';
      if ((page=='viewroute')&&((reg[reg.length-1].toLowerCase()==siteName)||((reg[reg.length-1].toLowerCase()=='')&&(reg[reg.length-2].toLowerCase()==siteName))))
      {
    	    LogoWaitRunning();

      		if(!($('#'+conteneur+'_container').hasClass('hide')))
      			$('#'+conteneur+'_container').addClass('hide');
      		if($('#DepartureLibelle').attr('rel')=="0")
        		$('#DepartureLibelle').val("");
      		else if($('#Departure').val()== '')
      		{
        		$('#Departure').val($('#DepartureLibelle').val());
      		}
      		if($('#DestinationLibelle').attr('rel')=="0")
        		$('#DestinationLibelle').val("");
      		else if($('#Destination').val()== '')
        		$('#Destination').val($('#DestinationLibelle').val());
      		if($('#DepartureCityName').attr('rel')=="0")
        		$('#DepartureCityName').val("");
      		if($('#DestinationCityName').attr('rel')=="0")
        		$('#DestinationCityName').val("");
      		if($('#wayPoint').attr('rel')=='0')
          		$('#wayPoint').val("");
      		if($('#wayPointCityName').attr('rel')=='0')
          		$('#wayPointCityName').val("");
      		if (reg[reg.length-1].toLowerCase()=='')
      			var urltest = document.URL + "route/vuesearch?rappelDeparture=" + $('#DepartureCityName').val() + " -" + $('#DepartureLibelle').val() + "&rappelDestination=" + $('#DestinationCityName').val() + " -" + $('#DestinationLibelle').val() + "&dateDay=" + $('#dateDay').val() + "&selectedDate=" + $('#dateYearMonth').val() + "&hour=" + $('#hour').val() + "&minute=" + $('#minute').val() + "&dateDayRappel="+ $('#dateDay').val() + "&dateYearMonthRappel="+$('#dateYearMonth').val() + "&sens=" + $('#sens').val() + "&Valid=1";
      		else
      			var urltest = document.URL + "/route/vuesearch?rappelDeparture=" + $('#DepartureCityName').val() + " -" + $('#DepartureLibelle').val() + "&rappelDestination=" + $('#DestinationCityName').val() + " -" + $('#DestinationLibelle').val() + "&dateDay=" + $('#dateDay').val() + "&selectedDate=" + $('#dateYearMonth').val() + "&hour=" + $('#hour').val() + "&minute=" + $('#minute').val() +  "&dateDayRappel="+ $('#dateDay').val() + "&dateYearMonthRappel="+$('#dateYearMonth').val() + "&sens=" + $('#sens').val() + "&Valid=1";
      		window.location=urltest;
      }
     else
     {
    	if($('#'+conteneur+'_container').hasClass('hide'))
      		$('#'+conteneur+'_container').removeClass('hide');

    	$('#'+conteneur).empty();

    	$('#DepartureCityName').css("color","#0B69AF").css("border-color","");
    	$('#DestinationCityName').css("color","#0B69AF").css("border-color","");
		$('#wayPointCityName').css("color","#0B69AF").css("border-color","");

    	$('#hour').css("color","#0B69AF").css("border-color","");
    	$('#minute').css("color","#0B69AF").css("border-color","");
    	$('#sens').css("color","#0B69AF").css("border-color","");

    	$('#dateYearMonth').css("color","#0B69AF").css("border-color","");
    	$('#dateDay').css("color","#0B69AF").css("border-color","");

    	$(".Mode:not(:checked)[name='Mode[]']").each(function(){
      		$(this).parent().css("color","").css("border-color","");
    	});

    	$(".Mode:checked[name='Mode[]']").each(function(){
      	$(this).parent().css("color","#0B69AF").css("border-color","");
    	});

    	for(var i=0;i<id.length;i++)
    	{
	  		$('#'+conteneur).append('<li>'+error[id[i]]+'</li>');

      		if(id[i]=='Departure')
      		{
        		if(page=='viewroute')
        		{
          			$('#DepartureLibelle').css("color","red").css("border-color","red");
        		}
        		else if(page=='viewprecision')
        		{
          			$('#edtDeparture').css("color","red").css("border-color","red");
        		}
      		}

	  		if(id[i]=='DepartureCityName')
      		{
        		$('#DepartureCityName').css("color","red").css("border-color","red");
      		}

      		if(id[i]=='Destination')
      		{
        		if(page=='viewroute')
        		{
          		$('#DestinationLibelle').css("color","red").css("border-color","red");
        		}
        		else if(page=='viewprecision')
        		{
          			$('#edtDestination').css("color","red").css("border-color","red");
        		}
      		}

      		if(id[i]=='DestinationCityName')
      		{
        		$('#DestinationCityName').css("color","red").css("border-color","red");
      		}

			if(id[i]=='wayPointCityName')
      		{
        		$('#wayPointCityName').css("color","red").css("border-color","red");
      		}

      		if(id[i]=='Heure1' || id[i]=='Heure2')
      		{
        		$('#hour').css("color","red").css("border-color","red");
        		$('#minute').css("color","red").css("border-color","red");
        		$('#sens').css("color","red").css("border-color","red");
      		}

      		if(id[i]=='Date' || id[i]=='ValidDate')
      		{
        		$('#dateYearMonth').css("color","red").css("border-color","red");
        		$('#dateDay').css("color","red").css("border-color","red");
      		}

      		if(id[i]=='Mode')
      		{
        		$(".Mode:checkbox[name='Mode[]']").each(function(){
          			$(this).parent().css("color","red").css("border-color","red");
        		});
      		}
    	}
    	var ls_overlayDiv = document.getElementById("overlay");
    	if (ls_overlayDiv != null)
    	{
    		var visibleState = true;
    		if ($('#overlay').css("visibility")== 'hidden') visibleState = true ;
    		else visibleState = false;

    		$('#overlay').css("visibility",(visibleState ? "visible" : "hidden"));
    		$('#lightbox').css("visibility",(visibleState ? "visible" : "hidden"));
    	}
    }
  };

  /* viewRoute : Verifie si le formulaire est bien valide */
  var Validate = function()
  {
	var ls_overlayDiv = document.getElementById("overlay");
	var ls_hpSearch = document.getElementById("hp-search");
	var ls_lang = document.getElementById("lang");
	var ls_map = document.getElementById("hp-map");
	var ls_intermediate_step = document.getElementById("intermediate-step");
	var ls_wayPointCityName = document.getElementById("wayPointCityName");


	/*if(ls_hpSearch != null )
		$('#hp-search').attr('disabled', 'disabled');

	if(ls_lang != null )
	{
		$('#lang').attr('disabled', 'disabled');
		$('#lang').css("visibility","hidden");
	}

	if(ls_map != null )
	{
		$('#hp-map').attr('disabled', 'disabled');
		$('#hp-map').css("visibility","hidden");
	}

	if (ls_overlayDiv != null)
	{
		var visibleState = true;
		if ($('#overlay').css("visibility")== 'hidden')
		{
			visibleState = true ;
		}
		else
		{
			visibleState = false;
		}
		$('#overlay').css("visibility",(visibleState ? "visible" : "hidden"));
		$('#lightbox').css("visibility",(visibleState ? "visible" : "hidden"));
	}*/
	var testD = false;
    var testA = false;
    var testW = false;
    var testH = false;
    var testDate = false;
    var testValidDate = false;
    var testMode = false;
	var ls_searchForm = document.getElementById("search-form");

	if (ls_searchForm!= null ) ls_searchForm.style.visibility="hidden";

    if($('#DepartureCityName').attr('rel')=="0" || $('#DepartureCityName').val().trim()=="")
    {
      testD = true;
    }
    else
    {
      testD = false;
    }
    if($('#DestinationCityName').attr('rel')=="0" || $('#DestinationCityName').val().trim()=="")
    {
      testA = true;
    }
    else
    {
      testA = false;
    }
    if (ls_intermediate_step != null || ls_wayPointCityName != null  )
    {
		if($('#intermediate-step').css('display')!='none' && ( $('#wayPointCityName').attr('rel')=="0" || $('#wayPointCityName').val().trim()==""))
		{
			testW = true;
		}
		else
		{
			testW = false;
		}
    }
    if(isToday())
    {
	    if(checkHour())
	    {
	      //ticket Mantis client 2919
	      testH = true;
	    }
	}

    if(checkDate(endDay,endMonth,endYear))
    {
      testDate = true;
    }
    if(checkValidDate())
    {
      testValidDate = true;
    }
    if(checkMode())
    {
      testMode = true;
    }
    if(testD || testA || testW || testH || testDate || testValidDate || testMode)
    {
      var arrayError = new Array();

      if(testD)
        arrayError.push('DepartureCityName');
      if(testA)
        arrayError.push('DestinationCityName');
      if(testW)
        arrayError.push('wayPointCityName');
      if(testH)
      {
    	  if($('#sens') != null && $('#sens').val() == '1')
    		  arrayError.push('Heure1');
    	  else
    		  arrayError.push('Heure2');
      }
      if(testDate)
        arrayError.push('Date');
      if(testValidDate)
        arrayError.push('ValidDate');
      if(testMode)
        arrayError.push('Mode');

      ShowError(arrayError,'msg_error','viewroute');

	  if ( ls_searchForm != null ) ls_searchForm.style.visibility = "";
      
	  return false;
    }
    else
    {
      if($('#DepartureLibelle').attr('rel')=="0")
        $('#DepartureLibelle').val("");
      else if($('#Departure').val()== '')
        $('#Departure').val($('#DepartureLibelle').val());

      if($('#DestinationLibelle').attr('rel')=="0")
        $('#DestinationLibelle').val("");
      else if($('#Destination').val()== '')
        $('#Destination').val($('#DestinationLibelle').val());

      if($('#DepartureCityName').attr('rel')=="0")
        $('#DepartureCityName').val("");

      if($('#DestinationCityName').attr('rel')=="0")
        $('#DestinationCityName').val("");

      if($('#wayPoint').attr('rel')=='0')
          $('#wayPoint').val("");

      if($('#wayPointCityName').attr('rel')=='0')
          $('#wayPointCityName').val("");

      LogoWaitRunning();

      return true;
    }
  };

  /* viewPrecision : Verifie si le formulaire est bien valide */
  var ValidatePrecision = function()
  {
    var testD  = false;
    var testA  = false;
    var testDS = false;
    var testAS = false;
    var testW  = false;
    var testWS = false;

    if($('#DepartureCityName').attr('rel')=="0")
    {
      testD = true;
    }
    else
    {
      testD = false;
    }

    if($('#DestinationCityName').attr('rel')=="0")
    {
      testA = true;
    }
    else
    {
      testA = false;
    }

	if($('#wayPointCityName').attr('rel')=="0")
    {
      testW = true;
    }
    else
    {
      testW = false;
    }

	if(checkEntryPoint('edtDeparture') == true)
    {
      testDS = true;
    }
    else
    {
      testDS = false;
    }

	if(checkEntryPoint('edtDestination') == true)
    {
      testAS = true;
    }
    else
    {
      testAS = false;
    }

    if(checkEntryPoint('edtWayPoint') == true)
    {
      testWS = true;
    }
    else
    {
      testWS = false;
    }

    var arrayError = new Array();

    if(testD || testA || testDS || testAS || testW || testWS)
    {
   	  if(testD)
        arrayError.push('DepartureCityName');
      if(testDS)
        arrayError.push('DeparturePrecis');
      if(testA)
        arrayError.push('DestinationCityName');
      if(testAS)
        arrayError.push('DestinationPrecis');
	  if(testW)
        arrayError.push('wayPointCityName');
      if(testWS)
        arrayError.push('wayPointPrecis');

      ShowError(arrayError,'msg_error','viewprecision');

      return false;
    }
    else
    {
      if($('#Departure').attr('rel')=="0")
        $('#Departure').val("");

      if($('#Destination').attr('rel')=="0")
        $('#Destination').val("");

      if($('#DepartureCityName').attr('rel')=="0")
        $('#DepartureCityName').val("");

      if($('#DestinationCityName').attr('rel')=="0")
        $('#DestinationCityName').val("");

	  if($('#wayPoint').attr('rel')=="0")
        $('#wayPoint').val("");

	  if($('#wayPointCityName').attr('rel')=="0")
        $('#wayPointCityName').val("");

	  LogoWaitRunning();

      return true;
    }
  };

  /* viewResultChoice : Verifie si le formulaire est bien valide */
  var ValidateResultChoice = function()
  {
    var testMode = false;

    if(checkMode())
      testMode = true;

    var arrayError = new Array();

    if(testMode)
    {
      arrayError.push('Mode');
      ShowError(arrayError,'msg_error','viewresultchoice');
      return false;
    }
    else
    {
      LogoWaitRunning();
      return true;
    }
  };

  /* Verifie la saisie d'un point d'arret */
  var checkEntryPoint = function(radioName)
  {
  	var radioList = $('input[name='+radioName+']');

  	if ($('#'+radioName).attr('type') == "hidden" && $('#'+radioName).val() != "")
  	{
  		return false;
  	}

  	if (radioList.length > 0)
  	{
		for (var i=0;i<radioList.length;i++)
		{
			if ( radioList[i].checked ) return false;
		}
		return true
	}
	else return false;
  };

  var isToday =  function()
  {
    var zero = '0';
    //on recupere la date de l'utilisateur
    var myDateDay = $('#dateDay').val();
    var myDateMonth = $('#dateYearMonth').val().slice(0,$('#dateYearMonth').val().length-5);
    var myDateYear = $('#dateYearMonth').val().slice(myDateMonth.length+1,$('#dateYearMonth').val().length);

	if(myDateMonth.toString().length == 1)
		myDateMonth = zero.concat(myDateMonth);

	if(myDateDay.toString().length == 1)
		myDateDay = zero.concat(myDateDay);

	if(endMonth.toString().length == 1)
		endMonth = zero.concat(endMonth);

	if(endDay.toString().length == 1)
		endDay = zero.concat(endDay);

    if(myDateDay != '' && myDateMonth !='' && myDateYear!='')
    {

      //verifie la validite de la date
      var m = myDateMonth - 1;
      var d = new Date(myDateYear,m,myDateDay);
 	  if (d.getFullYear() != myDateYear || d.getMonth() != m)
 	  	return true;

      //on recupere la date de actuelle
      var DateDeb = new Date();
      var beginDay = DateDeb.getDate(); beginDay = beginDay.toString();
      var beginMonth = DateDeb.getMonth()+1; beginMonth = beginMonth.toString();
      var beginYear = DateDeb.getFullYear(); beginYear = beginYear.toString();

	  if(beginMonth.toString().length == 1)
		beginMonth = zero.concat(beginMonth);

	  if(beginDay.toString().length == 1)
		beginDay = zero.concat(beginDay);

      //on concatene les chaines sous la forme annee,mois,jour
      var concatMyDate = myDateYear.concat(myDateMonth); concatMyDate = concatMyDate.concat(myDateDay.toString());
      var concatBeginDate = beginYear.concat(beginMonth); concatBeginDate = concatBeginDate.concat(beginDay.toString());

      //on cast en int
      var concatMyDate = parseInt(concatMyDate,10);
      var concatBeginDate = parseInt(concatBeginDate,10);

      //et on verifie que la date est comprise dans la date de production.
      if(concatMyDate == concatBeginDate)
      {
        return true;
      }
      else
      {
        return false;
      }
    }
    else
    {
      return false;
    }
  };
  
  /* Verifie la validite de la date en fonction de la date de production */
  var checkDate = function(endDay,endMonth,endYear)
  {
  	var zero = '0';
    //on recupere en parametre la date de fin de production

    //on recupere la date de l'utilisateur
    var myDateDay = $('#dateDay').val();
    var myDateMonth = $('#dateYearMonth').val().slice(0,$('#dateYearMonth').val().length-5);
    var myDateYear = $('#dateYearMonth').val().slice(myDateMonth.length+1,$('#dateYearMonth').val().length);

	if(myDateMonth.toString().length == 1)
		myDateMonth = zero.concat(myDateMonth);

	if(myDateDay.toString().length == 1)
		myDateDay = zero.concat(myDateDay);

	if(endMonth.toString().length == 1)
		endMonth = zero.concat(endMonth);

	if(endDay.toString().length == 1)
		endDay = zero.concat(endDay);

    if(myDateDay != '' && myDateMonth !='' && myDateYear!='')
    {
      //on concatene les chaines sous la forme annee,mois,jour
      var concatMyDate = myDateYear.concat(myDateMonth); concatMyDate = concatMyDate.concat(myDateDay.toString());
      var concatEndDate = endYear.toString().concat(endMonth.toString());	concatEndDate = concatEndDate.concat(endDay.toString());

      //on cast en int
      var concatMyDate = parseInt(concatMyDate,10);
      var concatEndDate = parseInt(concatEndDate,10);

      //et on verifie que la date est inferieure a la date de fin de production
      if(concatMyDate <= concatEndDate)
      {
        return false;
      }
      else
      {
        return true;
      }
    }
    else
    {
      return true;
    }
  };

  /* Verifie la validite de la date */
  var checkValidDate = function()
  {
	var zero = '0';

    //on recupere la date de l'utilisateur
    var myDateDay = $('#dateDay').val();
    var myDateMonth = $('#dateYearMonth').val().slice(0,$('#dateYearMonth').val().length-5);
    var myDateYear = $('#dateYearMonth').val().slice(myDateMonth.length+1,$('#dateYearMonth').val().length);

	if(myDateMonth.toString().length == 1)
		myDateMonth = zero.concat(myDateMonth);

	if(myDateDay.toString().length == 1)
		myDateDay = zero.concat(myDateDay);

    if(myDateDay != '' && myDateMonth !='' && myDateYear!='')
    {

      //verifie la validite de la date
      var m = myDateMonth - 1;
      var d = new Date(myDateYear,m,myDateDay);
 	  if (d.getFullYear() != myDateYear || d.getMonth() != m)
 	  	return true;

      //on recupere la date actuelle
      var DateDeb = new Date();
      var beginDay = DateDeb.getDate(); beginDay = beginDay.toString();
      var beginMonth = DateDeb.getMonth()+1; beginMonth = beginMonth.toString();
      var beginYear = DateDeb.getFullYear(); beginYear = beginYear.toString();

	  if(beginMonth.toString().length == 1)
		beginMonth = zero.concat(beginMonth);

	  if(beginDay.toString().length == 1)
		beginDay = zero.concat(beginDay);

      //on concatene les chaines sous la forme annee,mois,jour
      var concatMyDate = myDateYear.concat(myDateMonth); concatMyDate = concatMyDate.concat(myDateDay.toString());
      var concatBeginDate = beginYear.concat(beginMonth); concatBeginDate = concatBeginDate.concat(beginDay.toString());

      //on cast en int
      var concatMyDate = parseInt(concatMyDate,10);
      var concatBeginDate = parseInt(concatBeginDate,10);

      //et on verifie que la date n'est pas une date passée
      if(concatMyDate >= concatBeginDate)
      {
        return false;
      }
      else
      {
        return true;
      }
    }
    else
    {
      return true;
    }
  };

  /* Verifie la validite de l'heure */
  var checkHour = function()
  {
    var Hours = $('#hour').val();
    var Minutes = $('#minute').val();
    var sens = $('#sens').val();

    if(Hours!='' && Minutes!='')
    {

   	  var obj = $("#sens option:selected");
      var sensText = obj.text();

      if ((sens == 1) && (sensText.indexOf("Partir apr") != -1 ))
      {
          Minutes = parseInt(Minutes,10)+10;
          if (Minutes >= 60)
          {
	  	     Hours = parseInt(Hours) + 1 ;
             Minutes = parseInt(Minutes,10) - 60 ;
          }
      }

      var date = new Date();
      var myHours = date.getHours().toString();
      var myMinutes = date.getMinutes().toString();

      if(myHours.length == 1)
        myHours="0"+myHours;
      if(myMinutes.length == 1)
        myMinutes="0"+myMinutes;

	  Hours = Hours.toString();
	  Minutes = Minutes.toString();

	  if(Hours.length == 1)
        Hours="0"+Hours;
      if(Minutes.length == 1)
        Minutes="0"+Minutes;

      var concatMyHours = myHours.concat(myMinutes); concatMyHours = parseInt(concatMyHours,10);
      var concatHours = Hours.concat(Minutes); concatHours = parseInt(concatHours,10);

      if(concatMyHours <= concatHours)
      {
        return false;
      }
      else
      {
        return true;
      }
    }
    else
    {
      return true;
    }
  };

  var checkMode = function()
  {
    if ($(".Mode:checked[name='Mode[]']").length == 0)
      return true;
    else
      return false;
  }

  /* Vide un input ou selectionne son contenu selon l'attribut rel */
  var ViderInput = function()
  {
    if($(this).attr('rel')=="0")
    {
      $(this).attr('rel',$(this).val());
      $(this).val("");
    }
    else
    {
      $(this).select();
    }
  };

  /* Verifie le contenu d'un input et stocke ou non son contenu dans l'attribut rel */
  var VerifInput = function()
  {
    if($(this).val()=="")
    {
      $(this).val($(this).attr('rel'));
      $(this).attr('rel','0');
    }
  };

  var VerifInputBlur = function(e)
  {
    if($(this).val()=="")
    {
      $(this).val($(this).attr('rel'));
      $(this).attr('rel','0');
    }
    if(e.explicitOriginalTarget.nodeName=="#text")
    {
    	$(this).value=e.explicitOriginalTarget.nodeValue;
    }else if(e.explicitOriginalTarget.localName=="TD")
    {
    	$(this).value=e.explicitOriginalTarget.innerHTML;
    }else
    {
    	$('.mswfl').css('display','none');
    }
  };

  /* Affiche/Masque le champ etape */
  /*var ShowWayPoint = function()
  {
    $('#etape-area').slideToggle('slow');
    if($('#addwaypoint').hasClass('hide'))
    {
      $('#addwaypoint').removeClass('hide');
      $('#removewaypoint').addClass('hide');
    }
    else if($('#removewaypoint').hasClass('hide'))
    {
      $('#addwaypoint').addClass('hide');
      $('#removewaypoint').removeClass('hide');
    }
  };*/
 /* Affiche le champ etape */
	var ShowWayPoint = function()
	{
		$("#intermediate-step").show('normal');
		$("#intermediate-step-close").hide();
	};

	/* Masque le champ etape */
	var HideWayPoint = function()
	{
		$("#intermediate-step").hide();
		$("#intermediate-step-close").show('normal');
	};

	var toggleWaypoint = function() {
		if($("#intermediate-step").css("display")=="none")
			ShowWayPoint();
		else
			HideWayPoint();
		return false;
	};

  var ShowHideModifyStopArea = function()
	{
		$('#formHidden').toggleClass('show');
		return false;
	};

  var ShowHideModifyArrival = function()
	{
		$('#formArrivalHidden').toggleClass('show');
		return false;
	};

  function ShowHideById(anchorId)
  {
    if(document.getElementById(anchorId).style.visibility == "visible")
    {
      document.getElementById(anchorId).style.visibility = "hidden";
    }else
    {
      document.getElementById(anchorId).style.visibility = "visible";
    }
  };

  /* Affiche/masque la carte de recherche d'itineraire (viewroute) */
  function selectForm()
  {
     if($('#map_form').css('display')=='none')
     {
       $('#map_form').show("normal");
       $('#map_form').css("width","800px").css("height","500px");
       map.ResizeMap();
       map.MapCenter(mapCenterX,mapCenterY,mapCenterZ);
     }
  };

  /* (de)selectionne tous les checkbox a partir de leur nom */
  function selectAll(name,bool)
  {
    $(".Mode:checkbox[name='"+name+"']").each(function(){
      if(bool)
        $(this).attr("checked","checked");
      else
        $(this).removeAttr("checked");
    });
  };

  /* ######### vueHoraire ########### */

	var ValidateHoraire = function(libId,libCityId,alertMsg)
	{
		var lib = $("#" + libId).val();
	  	var libCity = $("#" + libCityId).val();

	  	if (lib == '' && libCity == '')
	  	{
	  		if (alertMsg != '') alert(alertMsg);
	  		return false;
		}
		else
		{
			LogoWaitRunning();
			return true;
		}
	};

	//fonction trim
	String.prototype.trim = function()
  	{
    	return this.replace(/(?:^\s+|\s+$)/g, "");
  	};

/* ######## mtkPlan && viewResult : L�gende POI Carto ######## */

  var hideShowRadioBtPoiCaption = function(zoom, current, filter, minZoom)
  {
    if(typeof(minZoom) == 'undefined') {
      minZoom = 16;
    }
    var radioCount = $('.radio-cat-poi').length;
    if(radioCount>0)
    { 
	    if(zoom < minZoom) {
	      for(var i=0;i<radioCount;i=i+2) {
	        var name = $('.radio-cat-poi')[i].name.toString();
	        $('#afficher_' + name ).attr('disabled','disabled');
	        var tmp = 'afficher_' + name;
	        var cmp = 'afficher_' + filter;
	        if(filter != null && tmp == cmp)
	        	continue;
	        $('#masquer_' + name ).attr('checked','checked');
	      }
	    } else {
	      for(var i=0;i<radioCount;i=i+2) {
	        var name = $('.radio-cat-poi')[i].name.toString();
	        var radio = $('.radio-cat-poi')[i];
	        $('#afficher_' + name ).removeAttr('disabled');
	        if(current == name) {
	          $('#masquer_' + name ).removeAttr('checked');
	          $('#afficher_' + name ).attr('checked','checked');
	        }
	      }
	    }
    }else {
			
    	radioCount = $('.radio-poi').length;
        if(zoom < minZoom) {
          for(var i=0;i<radioCount;i=i+2) {
            var name = $('.radio-poi')[i].name.toString();
            $('#afficher_' + name ).attr('disabled','disabled');
            var tmp = 'afficher_' + name;
            var cmp = 'afficher_' + filter;
            if(filter != null && tmp == cmp)
            	continue;
            $('#masquer_' + name ).attr('checked','checked');
          }
        } else {
          for(var i=0;i<radioCount;i=i+2) {
            var name = $('.radio-poi')[i].name.toString();
            var radio = $('.radio-poi')[i];
            $('#afficher_' + name ).removeAttr('disabled');
            if(current == name) {
              $('#masquer_' + name ).removeAttr('checked');
              $('#afficher_' + name ).attr('checked','checked');
            }
          }
        }
    }
  };
    
   
  	function LogoWaitRunning()
  	{
  	   //gestion ie6
  	   if ($.browser.msie && $.browser.version.substr(0,1)<7)
  	   {
			//
  	   }
  	   else
  	   {
  		 var scrollX = 0;
  		 var scrollY = 0;
  		 // on r�cup�re la position du scroll bar
         if (document.all)
         {
			if (!document.documentElement)
			      scrollX = document.body.scrollLeft;
			else
			      scrollX = document.documentElement.scrollLeft;

			if (!document.documentElement)
			      scrollY = document.body.scrollTop;
			else
			      scrollY = document.documentElement.scrollTop;
		 }
	     else
	     {
	                scrollX = window.pageXOffset;
	                scrollY = window.pageYOffset;
	      }
           scrollY=scrollY/2;
           // on r�cup�re la taille de l'�cran
  		   var w;
		   var h;
		   var middleh = 0;
  		   if ($.browser.msie)
  		   {
  			   w = screen.width;
	  		   h = screen.height;
	  		 middleh = h/2;
  		   }
  		   else
  		   {
	  		   w = screen.availWidth;
	  		   h = screen.availHeight;
	  		   middleh = h/2;
  		   }
  		   if(middleh != 0)
  			   $('#PnlRunning').css('top',middleh+scrollY);

	  	   $('#lightbox-overlay').css('left','0px');
		   $('#lightbox-overlay').css('height','100%');
		   $('#lightbox-overlay').css('width','100%');
		   $('#lightbox-overlay').css('position','fixed');
		   $('#lightbox-overlay').css('z-index','90');
		   $('#lightbox-overlay').css('opacity','0');
		   $('#lightbox-overlay').css('background-color','#C0C0C0');/*lightgray*/
		   $('#lightbox-overlay').animate({opacity: "0.7"}, 1500);
		   $("#PnlRunning").css('display','inline');
		   window.setTimeout('LogoWaitRunningImage()', 250);
	   }
	   return false;
	};

	function LogoWaitRunningImage()
	{

	   	var image = document.getElementById("PnlImage");
	   	image.src=image.src;
	};

