// JavaScript Document
<!--
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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/////////////////////////////////////////////////
// traitement de la navigation des photos //
///////////////////////////////////////////////

//1 Variables de configuration à ajuster en fonction du site
var dir_boutons = "../images/navigation/b_photo";  	//> chemin + nom images bouton (sans le numéro ni l'exttention)
var ext_boutons = ".jpg";										//> extention des images bouton (.jpg ou .gif)
var b_name = "bphoto"; 										//> nom donné aux boutons
var ph_name = "photo"; 										//> nom donnée à la photo dans dreamweaver
var big_photo_width = 431;									//> Largeur de la grande photo
var big_photo_height = 323;									//> Hauteur de la grande photo
var photos_filename = "";										//> Nom des fichiers photos (avant le numéro et sans l'extention)
var pre_dir_photos = "../images/";							//> debut du chemin des photos a afficher
																			//   (qui sera complété par dir_photo, specifique à la page

//2 Variables d'initialisation
var indice_photo = 1;  											//> indice de la photo en cours (par defaut : 1)

//3 fonctions
	//3.1 Fonction qui met en "on" le bouton de la photo affichée et les autres en OFF
function affiche_boutonON()
	{
	for(a=1;a<=nb_photo;a++)
		{
		if(a==indice_photo)
			document.images[b_name+a].src=dir_boutons+a+"_on"+ext_boutons;
		else
			document.images[b_name+a].src=dir_boutons+a+"_off"+ext_boutons;
		}
	}
	
	//3.2 Fonction qui affiche la bonne photo;
function  affiche_photo()
	{
	//affiche la [i_pho]ième photo de la [i_cha]ième chambre
	document.images[ph_name].src=pre_dir_photos+dir_photo+photos_filename+indice_photo+".jpg";
	}
	
	//3.3 Fonction qui specifie la photo à ouvrir en grand;
function  open_popup()
	{
	MM_openBrWindow('photo.php?photo='+pre_dir_photos+dir_photo+photos_filename+indice_photo+'g.jpg&width='+big_photo_width+'&height='+big_photo_height,'photo','menubar=no,scrollbars=no,resizable=no,top=20,left=20,width='+(big_photo_width+10)+',height='+(big_photo_height+10));
	document.links[0].blur();
	}
	
	//3.4 Fonction déclanchée par un clic sur un boutons de la nav photo;
function photo(i)
	{
	indice_photo = i;
	affiche_boutonON();
	affiche_photo();
	document.links[0].blur();
	}
	
	//3.3 Fonction qui ouvre la photo des plans;
function  open_popup2(num,sens)
	{
	if(sens==0)
	MM_openBrWindow('photo.php?photo='+pre_dir_photos+dir_photo+photos_filename+num+'g.jpg&width='+big_photo_width+'&height='+big_photo_height,'photo','menubar=no,scrollbars=no,resizable=no,top=20,left=20,width='+(big_photo_width+10)+',height='+(big_photo_height+10));
	else
	MM_openBrWindow('photo.php?photo='+pre_dir_photos+dir_photo+photos_filename+num+'g.jpg&width='+big_photo_height+'&height='+big_photo_width,'photo','menubar=no,scrollbars=no,resizable=no,top=20,left=20,width='+(big_photo_height+10)+',height='+(big_photo_width+10));
	document.links[0].blur();
	}
	
/////////////////////////////////////////////////
// codage courriels //
///////////////////////////////////////////////

function envoi_courriel(str1,str2,str3)	{
	return "mailto:"+str1+"@"+str2+"."+str3;
	}
//-->

