function sendData(data, page, method, obj)
{
		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 content = document.getElementById(obj);
		
		//si on envoie par la méthode GET:
		if(method == "GET")
		{
			if(data == 'null')
			{
				XhrObj.open(method, page);
			}//fin if
			else
			{
				XhrObj.open(method, page+"?val="+data);
			}//fin else
		}//fin if
		else if(method == "POST")
		{
			XhrObj.open("POST", page);
		}//fin elseif
	
		//Ok pour la page cible
		XhrObj.onreadystatechange = function() 
		{
			if (XhrObj.readyState == 4 && XhrObj.status == 200)
			{
				content.innerHTML = XhrObj.responseText;
			}
		}	
	
		if(method == "GET")
		{
			XhrObj.send(null);
		}//fin if
		else if(method == "POST")
		{
			XhrObj.setRequestHeader('Cache-Control','no-cache, must-revalidate');
			XhrObj.setRequestHeader('Expires','Mon, 26 Jul 1997 05:00:00 GMT');
			XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			XhrObj.send(data);
		}//fin elseif
		
		// On teste le code erreur et on affiche une page d'erreur
		if (page != "error.php")
		{
//			alert("passage par error.php");
			sendData('', 'error.php', 'GET', 'hnodata');
		}
}//fin fonction SendData
	

function openhelp() 
{
window.open('Librairie/admin/helpadm.php','control','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=yes,width=500,height=360')
}


	/**
	 * Permet de récupérer les données d'un fichier via les XmlHttpRequest:
	 */
function getFile(page)
{
	sendData('null', page, 'GET', 'reponse');
	sendData('numsession=<?php echo $_GET[nse]; ?>', 'part.php', 'GET', 'participants');
	if (slshow == 'slide1')
	{
		slshow = 'slide2';
	}
	else
	{
		slshow = 'slide1';
	}
	sendData('numsession=<?php echo $_GET[nse]; ?>', 'img.php', 'GET', slshow);
	sendData('numsession=<?php echo $_GET[nse]; ?>', 'diapo.php', 'GET', 'diapos');
	slide_changeimage();
}//fin fonction getFile  

//SCROLL PERSO uniquement avec fleches haut bas
var mytime;
var deplacement = false;
var totalheight = -1; 
var boxheight = -1;
var totalwidth = -1; 
var boxwidth = -1;
var totalminiwidth = -1; 
var boxminiwidth = -1;
var totalmenuwidth = -1; 
var boxmenuwidth = -1;

function movedisci(loc_type,loc_total,loc_divtoscroll,loc_boxheight,loc_up,loc_down,loc_pas,loc_temps,boucle){
	var letop = get(loc_divtoscroll).style.top;
	var lalongueur = letop.length - 2;
	var topactuel = parseFloat(letop.substring(0,lalongueur));
	clearTimeout(mytime);
	var decale;
	
	if (loc_type == 'bas'){
		decale = loc_total - loc_boxheight + topactuel;
		if (decale > loc_pas){
			decale = loc_pas;
		}
		if (decale > 0){
			get(loc_divtoscroll).style.top = topactuel - decale + 'px';
			get(loc_up).style.visibility = 'visible';
			if ((topactuel-decale) == (loc_boxheight - loc_total)){
				if (boucle == 1){
					get(loc_divtoscroll).style.top = 300 + 'px';
				} else {
					get(loc_down).style.visibility = 'hidden';
				}
			}
			mytime = setTimeout(function(){movedisci(loc_type,loc_total,loc_divtoscroll,loc_boxheight,loc_up,loc_down,loc_pas,loc_temps,boucle);},loc_temps);
		}
	}
	if (loc_type == 'haut'){
		decale = (-(topactuel));
		if (decale > loc_pas){
			decale = loc_pas;
		}
		if (decale > 0){
			get(loc_divtoscroll).style.top = topactuel + decale + 'px';
			get(loc_down).style.visibility = 'visible';
			if ((topactuel+decale) == 0){
				if (boucle == 1){
					get(loc_divtoscroll).style.top = 300 + 'px';
				} else {
					get(loc_up).style.visibility = 'hidden';
				}
			}
			mytime = setTimeout(function(){movedisci(loc_type,loc_total,loc_divtoscroll,loc_boxheight,loc_up,loc_down,loc_pas,loc_temps,boucle);},loc_temps);
		}
	}
}

function get(e){
	return document.getElementById(e);
}

//Demarrage du scroll, demandé à l'onload
function startminiscroll1(){
	try {
		totalheight = get("scroll").offsetHeight; 
		boxheight = get("contenu").offsetHeight;
		if (totalheight > boxheight){
			get("bottomarrow").style.visibility = 'visible';
		}
	}
	catch(e){}
}

//Arret du scroll au relachement de la souris
function stopminiscroll(){
	deplacement=false;
	clearTimeout(mytime);
}

function startSlide()
{
	setTimeout(function(){movedisci('bas',totalheight+300,'scroll',boxheight,'toparrow','bottomarrow',1,10,1)}, 10);
}
