
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="+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="#EEEEEE";
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";


var ImageOnglet="images/ongletselect.gif";

function SelectionOnglet(IdCell) {
	if((IdCell!='')&&(document.getElementById(IdCell)!=null)){
		document.getElementById(IdCell).className="MenuSelect";
//		document.getElementById(IdCell).style.backgroundImage="url("+ImageOnglet+")";
//		document.getElementById(IdCell).firstChild.style.color=CouleurLienOngletSelect;

	}
}

function SelectionMenu(IdCell) {
	if((IdCell!='')&&(document.getElementById(IdCell)!=null)){
		document.getElementById(IdCell).className="MenuSelect";
	}
}


/**********************************************
		(c) Macromedia
**********************************************/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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_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];}
}



/*********************************
	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.write(document.getElementById(Champ).value);
}

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 IncrStrDateToStr(ladate,n){	
	var dt = new Date(StrDateToDate(ladate).getFullYear(),StrDateToDate(ladate).getMonth(),StrDateToDate(ladate).getDate()+n);
	return DateToStr(dt);
}
function DateToStr(ladate)
{
  if(ladate==null) return "";
  if (typeof(ladate)=="date") ladate= new Date(ladate);
  var jour = ladate.getDate();
  var mois = ladate.getMonth();
  var strjour = new String(jour);
  var strmois = new String(mois+1); 
  var stran = new String(ladate.getFullYear());
  if (jour<10) strjour = "0"+strjour;
  if (mois<9) strmois = "0"+strmois;
  return strjour+"/"+strmois+"/"+stran; 	
}
function StrDateToDate(strDate) {
	if(strDate=="") return new Date();
	var ladate = strDate.split(/\//g);		
	if (ladate==null || ladate.length<3) return new Date();
	var an = new Number(ladate[2]);
	if(an<100) an = 2000+an;
	return new Date(an,new Number(ladate[1])-1,new Number(ladate[0]));
}




/******************************************
	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')
}


/**********************************************************
		AFFICHAGE DU MESSAGE D'ATTENTE
*******************************************************/

function centerPopup(element) {
	var height=document.getElementById(element).offsetHeight;//hauteur de l'élément à positionner
	var width=document.getElementById(element).offsetWidth;//largeur de l'élément à positionner
	myParent=document.getElementById(element).parentNode;
	var pHeight=myParent.offsetHeight;//Hauteur de l'élément parent
	var pWidth=myParent.offsetWidth;//Largeur de l'élément parent
	var sTop=myParent.scrollTop;//Hauteur de défilement de l'élément parent
	var sLeft=myParent.scrollLeft;//Longueur de défilement de l'élément parent
	var posY=(pHeight/2)-(height/2)+sTop;//Calcul de la position en Y
	var posX=(pWidth/2)-(width/2)+sLeft;//Calcul de la position en X
	document.getElementById(element).style.top=posY+"px";
	document.getElementById(element).style.left=posX+"px";
	
}

var formok=false;
function AfficheAttente(){
	if(formok) centerPopup("Attente");
}

function TestFormulaire(NomForm){
	var formulaire=document.forms[NomForm];
	formok=ValiderForm(formulaire);
	if(formok) document.forms[NomForm].submit();
	AfficheAttente();
}




/**********************************************************
		AFFICHAGE DU MOTEUR
*******************************************************/

function CacheMoteur(NomMoteur){
	if(document.getElementById(NomMoteur)){
		document.getElementById(NomMoteur).style.display="none";
	}	
}
function DeselectionMenuMoteur(NomMenu){
	if(document.getElementById(NomMenu)){
		var obj = document.getElementById(NomMenu);
		obj.className="";
		//obj.getElementsByTagName("div")[0].className="sousonglet";
	}	
}

function AfficheMoteur(NomMoteur){
	CacheMoteur("MoteurHotels");
	CacheMoteur("MoteurMeubles");
	CacheMoteur("MoteurCampings");
	CacheMoteur("MoteurChambres");
	CacheMoteur("MoteurActivites");
	CacheMoteur("MoteurBillet1,2,3,4,5,6,7,8,9,11,12,10,13,14,15,17,18,19,20,21,22,16,23,24,28,29,30,31,32,33,34,35,36,37");
	CacheMoteur("MoteurBoutique");
	CacheMoteur("MoteurSejours");
	CacheMoteur("MoteurPassBeaune25");
	CacheMoteur("MoteurPassBeaune26");
	CacheMoteur("MoteurPassBeaune27");
	CacheMoteur("MoteurResidencesHotelieres");
	CacheMoteur("MoteurCoteMenuCote");
	CacheMoteur("MoteurBilletInedit");
	CacheMoteur("MoteurPassBeaune*");
	
	
	
	
	if(document.getElementById(NomMoteur)){
		document.getElementById(NomMoteur).style.display="block";
	}	
}
function AfficheMenu(NomMenu){
	DeselectionMenuMoteur("MenuCoteHotels");
	DeselectionMenuMoteur("MenuCoteMeubles");
	DeselectionMenuMoteur("MenuCoteChambres");
	DeselectionMenuMoteur("MenuCoteCampings");
	DeselectionMenuMoteur("MenuCoteActivites");
	DeselectionMenuMoteur("MenuCoteBillet1,2,3,4,5,6,7,8,9,11,12,10,13,14,15,17,18,19,20,21,22,16,23,24,28,29,30,31,32,33,34,35,36,37");
	DeselectionMenuMoteur("MenuCotePassBeaune25");
	DeselectionMenuMoteur("MenuCotePassBeaune26");
	DeselectionMenuMoteur("MenuCotePassBeaune27");
	DeselectionMenuMoteur("MenuCoteSejours");
	DeselectionMenuMoteur("MenuCoteBoutique");
	DeselectionMenuMoteur("MenuCoteSansMoteur");
	DeselectionMenuMoteur("MenuCoteResidencesHotelieres");
	DeselectionMenuMoteur("MenuCoteMenuCote");
	DeselectionMenuMoteur("MenuCoteBilletInedit");
	DeselectionMenuMoteur("MenuCotePassBeaune");

	
	if(document.getElementById(NomMenu)){
		var obj = document.getElementById(NomMenu);
		obj.className="Select";
		//obj.getElementsByTagName("div")[0].style.display="block";
//		obj.getElementsByTagName("div")[0].className="sousongletsel";
		//obj.getElementsByTagName("div")[0].style.zIndex=300;
		//obj.getElementsByTagName("div")[0].innerHTML += "toto";
	}	
}

function SelectionMoteur(Nom){
	AfficheMoteur("Moteur"+Nom);
	AfficheMenu("MenuCote"+Nom);
}


var NomZoneSelect="";