// JavaScript Document
/**
	 * Permet d'envoyer des données en GET ou POST en utilisant les XmlHttpRequest
	 * data =données
	 * page= page de traitement
	 * method = POST ou GET
	 * contenu = id du div d'affichage
	 */
	function sendData(data, page, method,contenu)
	{
		if(document.all)
		{
			//Internet Explorer
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}//fin if
		else
		{
		    //Mozilla
			var XhrObj = new XMLHttpRequest();
		}//fin else
		
		//définition de l'endroit d'affichage:
		var affich = document.getElementById(contenu);
		
		//si on envoie par la méthode GET:
		if(method == "GET")
		{
			if(data == 'null')
			{
				//ouvertur du fichier sélectionné:
				XhrObj.open("GET", page);
			}//fin if
			else
			{
				//Ouverture du fichier testGet.php en methode GET
				XhrObj.open("GET", page+"?"+data);
			}//fin else
		}//fin if
		else if(method == "POST")
		{
			//Ouverture du fichier testPost.php en methode POST
			XhrObj.open("POST", page);
		}//fin elseif
	
		//Ok pour la page cible
		XhrObj.onreadystatechange = function() 
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
				affich.innerHTML = XhrObj.responseText ;
		}	
	
		if(method == "GET")
		{
			XhrObj.send(null);
		}//fin if
		else if(method == "POST")
		{
			XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			XhrObj.send(data);
		}//fin elseif
	}//fin fonction SendData
	
	/**
	 * Permet de récupérer les données d'un fichier via les XmlHttpRequest:
	 */
	function getFile(page, contenu)
	{
		sendData('null', page, 'GET', contenu)
	}//fin fonction getFile 
	
//Fait patienter pendant l'envoi du formulaire	
function Localize(pStr){return pStr;}

var ProcessingText = Localize("Patientez pendant l'envoi...");
var cnt=0;
function doValidate(f){
f.envoi.value=ProcessingText;
f.envoi.disabled=true;
if (cnt==0)f.submit();
cnt++;
}	
//Met en majuscule les champs d'un formulaire	
// Original:  William Humphreys (billy@technical-solutions.co.uk)
// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com

function changeCase(frmObj) {
var index;
var tmpStr;
var tmpChar;
var preString;
var postString;
var strlen;
tmpStr = frmObj.value.toLowerCase();
strLen = tmpStr.length;
if (strLen > 0)  {
for (index = 0; index < strLen; index++)  {
if (index == 0)  {
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,strLen);
tmpStr = tmpChar + postString;
}
else {
tmpChar = tmpStr.substring(index, index+1);
if (tmpChar == " " && index < (strLen-1))  {
tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
preString = tmpStr.substring(0, index+1);
postString = tmpStr.substring(index+2,strLen);
tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
frmObj.value = tmpStr;
}
//  End -->



///galerie
function displayPics()
{
	var photos = document.getElementById('galerie_mini') ;
	// On r?cup?re l'?l?ment ayant pour id galerie_mini
	var liens = photos.getElementsByTagName('a') ;
	// On r?cup?re dans une variable tous les liens contenu dans galerie_mini
	var big_photo = document.getElementById('big_pict') ;
	// Ici c'est l'?l?ment ayant pour id big_pict qui est r?cup?r?, c'est notre photo en taille normale
	var titre_photo = document.getElementById('photo').getElementsByTagName('dt')[0] ;
	// Et enfin le titre de la photo de taille normale
	
	for(var i = 0 ; i < liens.length ; i++)
	// Une boucle parcourant l'ensemble des liens contenu dans galerie_mini
	{
		liens[i].onclick = function()
		// Au clique sur ces liens
		{
			big_photo.src = this.href ; // On change l'attribut src de l'image en le rempla?ant par la valeur du lien
			big_photo.alt = this.title ; // On change son titre
			titre_photo.firstChild.nodeValue = this.title ; // On change le texte de titre de la photo
			return false ; // Et pour finir on inhibe l'action r?elle du lien
		}
	}
}

window.onload = displayPics ;

function show() {
 if(document.getElementById)
   document.getElementById("map").style.display = "block";
   document.getElementById("hidemap").style.display = "block";
   document.getElementById("showmap").style.display = "none";
}
function hide() {
 if(document.getElementById)
   document.getElementById("map").style.display = "none";
      document.getElementById("hidemap").style.display = "none";
   document.getElementById("showmap").style.display = "block";

}

