function UrlEncode(text)
{
	return escape(text).replace(/\+/g, "%2B").replace(/\"/g,"%22").replace(/\'/g, "%27");
}

function ClickSurCase(obj) {
 var taille = obj.all.length;
 var i;
 for(i=0;i<taille;i++) {
  if (obj.all[i].tagName.toUpperCase()=="A") top.location.href = obj.all[i].href;
 } 
}
 
 
 function VoirImage(Img,txt){
	window.open("voirimage.asp?I="+escape(Img)+"&T="+txt,'Image','height=200,width=300,resizable=yes')
}

var CouleurCellule;			// nécessaire
var CouleurFondMenu='#F3F3F3';
var CouleurFondSousMenu="#E5C0A5"	//#FFD6CC#F78B72
var ColorFondSousMenu="#81DAEF";
var CouleurFondMenuOver="#ECEBD9";
var ImageOnglet="images/ongletselect.gif";

function ChangeColorOut(TT) {
	TT.style.backgroundColor=CouleurCellule;
}

function ChangeColorOver(TT) {
	CouleurCellule=TT.style.backgroundColor;
	TT.style.backgroundColor=CouleurFondMenuOver;
	TT.style.cursor='pointer';
	
}

function ChangeColorCellule(IdCell,Couleur) {
	var cc=Couleur||CouleurFondMenu;
	if((IdCell!='')&&(IdCell!='T0')){
		document.getElementById(IdCell).style.backgroundColor=cc;	
	}
}

function goback() {
    history.go(-1);
}

var CouleurLienOngletSelect="#000000";
var CouleurFondMenuSelect="#CCCC99";

//function SelectionOnglet(IdCell) {
//var aa="";

//if(IdCell=="TMenuBillet") IdCell = "TMenuBonsplans";
//if(IdCell=="TMenuBillet-Champrintemps") IdCell = "TMenuBonsplans";
//if(IdCell=="TMenuBillet-Semainesblanches") IdCell = "TMenuBonsplans";
/*if(IdCell=="TMenuHotels-Promo") IdCell = "TMenuBonsplans";*/



	//if(IdCell!='' && document.getElementById(IdCell)){
//		document.getElementById(IdCell).style.backgroundColor=CouleurFondMenuSelect;
		//document.getElementById(IdCell).style.color=CouleurLienOngletSelect;
		//document.getElementById(IdCell).style.fontWeight='bold';
		//document.getElementById(IdCell).firstChild.style.color=CouleurLienOngletSelect;
	
	
	//}
//}

function SelectionOnglet(IdCell) {
	if((IdCell=='MenuMoteurIntroForfait')){
		document.getElementById('MenuMoteurForfait').className="MenuSelect";


	}
	if((IdCell!='')&&(document.getElementById(IdCell)!=null)){
		document.getElementById(IdCell).className="MenuSelect";


	}
}

function SelectionEtape(IdCell) {
	if((IdCell!='')&&(document.getElementById(IdCell)!=null)){
		document.getElementById(IdCell).className="SelectEtape";


	}
}
/*********************************
	Gestion des Popups avec des divs
****************************/
var minrestore=0
var initialwidth,initialheight
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all

function iecompattest(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function loadwindow(url,width,height){
	if (!ie5&&!ns6)
		window.open(url,"","width="+width+",height="+height+",scrollbars=1")
	else{
		document.getElementById("dwindow").style.display=''
		document.getElementById("dwindow").style.width=initialwidth=width+"px"
		document.getElementById("dwindow").style.height=initialheight=height+"px"
		document.getElementById("dwindow").style.left="30px"
		document.getElementById("dwindow").style.top=ns6? window.pageYOffset*1+30+"px" : iecompattest().scrollTop*1+30+"px"
		document.getElementById("cframe").src=url
	}
}

var HandlePopup;
function loadwindow2(Champ,width,height){
  if(HandlePopup!=null) HandlePopup.close();
  HandlePopup=window.open("","popup","width="+width+",height="+height+",scrollbars=1");
  HandlePopup.document.clear();
  HandlePopup.document.open('text/html');
  HandlePopup.document.write('<HTML><BODY>'+document.getElementById(Champ).value+'</BODY></HTML>');
  HandlePopup.document.close();  
}

function maximize(){
if (minrestore==0){
minrestore=1 //maximize window
document.getElementById("maxname").setAttribute("src","restore.gif")
document.getElementById("dwindow").style.width=ns6? window.innerWidth-20+"px" : iecompattest().clientWidth+"px"
document.getElementById("dwindow").style.height=ns6? window.innerHeight-20+"px" : iecompattest().clientHeight+"px"
}
else{
minrestore=0 //restore window
document.getElementById("maxname").setAttribute("src","max.gif")
document.getElementById("dwindow").style.width=initialwidth
document.getElementById("dwindow").style.height=initialheight
}
document.getElementById("dwindow").style.left=ns6? window.pageXOffset+"px" : iecompattest().scrollLeft+"px"
document.getElementById("dwindow").style.top=ns6? window.pageYOffset+"px" : iecompattest().scrollTop+"px"
}

function closeit(){
document.getElementById("dwindow").style.display="none"
}

function EstSimplyValide(){			
		var lform 		= document.RechercheHebergement;
		var ijjdtearriv = lform.elements["Globales/JourDebut"].selectedIndex;
		var immdtearriv = lform.elements["Globales/MoisDebut"].selectedIndex;
		var iaadtearriv = lform.elements["Globales/AnDebut"].selectedIndex;		
		var dte = DateDepuisChaines(lform.elements["Globales/AnDebut"].options[iaadtearriv].value,lform.elements["Globales/MoisDebut"].options[immdtearriv].value,lform.elements["Globales/JourDebut"].options[ijjdtearriv].value);
		var nbnuits 	= lform.elements["Globales/DureeNuit"].value;
		var i			= 0;			
		var SimplyValide = true;
		
		for(i=0;i<nbnuits;i++){
			var jjsem = dte.getDay();			
			if(jjsem==5 || jjsem==6){SimplyValide=false;}
			dte = IncrDate(dte,1);			
		}				
		return SimplyValide;	
}

function EstDansPeriodeSimply(datedeblimite,datefinlimite)
{		
	var lform 		= document.RechercheHebergement;
	var ijjdtearriv = lform.elements["Globales/JourDebut"].selectedIndex;
	var immdtearriv = lform.elements["Globales/MoisDebut"].selectedIndex;
	var iaadtearriv = lform.elements["Globales/AnDebut"].selectedIndex;		
	var dte = DateDepuisChaines(lform.elements["Globales/AnDebut"].options[iaadtearriv].value,lform.elements["Globales/MoisDebut"].options[immdtearriv].value,lform.elements["Globales/JourDebut"].options[ijjdtearriv].value);
	
	if((dte.getTime() > datefinlimite.getTime()) || (dte.getTime()<datedeblimite.getTime())){
		return false;
	}	
	return true;	
}

/*********************************
	Gestion de :hover
****************************/

/*sfHover = function() {
	var sfEls = document.getElementById("BlocMenuInter").document.getElementsByTagName("LI");
	if(sfEls == null) return;
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);*/

sfHover = function() {
	var sfEls = document.getElementById("BlocMenuInter").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
/*********************************
	Selection combo adultes
****************************/
function SelectComboPersonnes(obja,noma,nomglobale,index){
	var nombre = 5;
	
	for(var i=0;i<=nombre;i++){
		
		if(document.getElementById(noma+'#'+i) != null){
			document.getElementById(noma+'#'+i).className='';
		}
		
	}

	document.getElementById(nomglobale).value=index;

	if(obja!=null){
		obja.className='Select';
	}

	if(nomglobale=="NbEnfants"){
		CreeCombosAges();
	}
}


/******************************************
	Affichage sur Googlemaps
******************************************/
function OuvreGoogleMaps(Id,Lat,Lon){
	window.open("voirgooglemaps.asp?Id="+Id+"&Lat="+Lat+"&Lon="+Lon,'Popup','height=400,width=500,scrollbars=no')
}


/***********************************
			Macromedia
*************************************/

	<!--
			function MM_swapImgRestore() { //v3.0
			var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
			}

			function MM_preloadImages() { //v3.0
			var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
				var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
				if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
			}

			function MM_findObj(n, d) { //v4.01
			var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
			}

			function MM_swapImage() { //v3.0
			var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
			if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
			
/*********************
 TRACKING
on déclare cete variable afin de récupérer le nom de la prestataion sur l'étape 3 
*********************/
var NomPrestation="";

function xtTraiter(nompage)
{
    var ret = nompage.toLowerCase();
    ret = ret.replace(/[àáâãäåæ]/gi,"a");
  ret = ret.replace(/[òóôõö]/gi,"o");
  ret = ret.replace(/[ùúûü]/gi,"u");
  ret = ret.replace(/[ìíîï]/gi,"i");
  ret = ret.replace(/[éèêë]/gi,"e");
  ret = ret.replace(/[ç]/gi,"c");
  ret = ret.replace(/[ñ]/gi,"n");
  ret = ret.replace(/\s+/gi," ");
     ret = ret.replace(/[^a-z^0-9^\-_:~\\\/]/gi,"_");
    return ret;
}			