
function getFlashMovieObject(movieName){
  if (window.document[movieName])  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1){
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  } else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

function PlayFlashMovie(){
	var flashMovie=getFlashMovieObject("bdo");
	flashMovie.Play();
}

function itemHover(item){
item.style.backgroundColor='#A8A8A8';
item.style.color='#FFFFFF';
item.style.cursor='pointer'
}

function itemOut(item){
item.style.backgroundColor='transparent';
item.style.color='#000000';
}

function itemClick(item){
affiche(item);
PlayFlashMovie();
document.getElementById('page').value=item;
}

function authentification(){
//Ouvre une fenêtre modale avec un iframe dedans et assigne le résultat à une variable nommée  "Authentification"
getlogin=dhtmlmodal.open('Authentification', 'iframe', 'admin/protect.asp', 'Accès réservé', 'width=400px,height=300px,center=1,resize=0,scrolling=1')
getlogin.onclose=function(){
window.location.reload();
return true //allow closing of window
}
}

function showVideo(film){
//Ouvre une fenêtre modale pour afficher un video
getvideo=dhtmlmodal.open('Vidéo', 'iframe', 'video.asp?f='+film, 'Christian Richard', 'width=365px,height=325px,center=1,resize=0,scrolling=1')
return true //allow closing of window
}

function editer(){
var page=document.getElementById('page').value
window.open("fckeditor/edit.asp?page="+page,"Editer","toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,width=805,height=465,top=100,left=200,resizable=no");
}

function editerCmt(){
var page=document.getElementById('page').value
window.open("fckeditor/editCmt.asp?page="+page,"Editer","toolbar=no,status=no,directories=no,menubar=no,location=no,scrollbars=no,width=510,height=330,top=400,left=200,resizable=no");
}

function clearHistory(){
xmlHttpClear=GetXmlHttpObject();
if (xmlHttpClear==null){
  alert ("Votre navigateur ne supporte pas la technologie AJAX!");
  return;}
var urlClear="clearHistory.asp";
urlClear=urlClear+"?sid="+Math.random();
xmlHttpClear.onreadystatechange=stateChangedClear;
xmlHttpClear.open("GET",urlClear,true);
xmlHttpClear.send(null);
}

function stateChangedClear(){ 
if (xmlHttpClear.readyState==4){
	document.getElementById("texte_historique").innerHTML = "";
	}
}

function affiche(pageID){
xmlHttpAff=GetXmlHttpObject();
if (xmlHttpAff==null){
  alert ("Votre navigateur ne supporte pas la technologie AJAX!");
  return;}
var urlAff="Affiche.asp";
urlAff=urlAff+"?id="+pageID;
urlAff=urlAff+"&sid="+Math.random();
xmlHttpAff.onreadystatechange=stateChangedAff;
xmlHttpAff.open("GET",urlAff,true);
xmlHttpAff.send(null);
}

function stateChangedAff(){ 
if (xmlHttpAff.readyState==4){
	var resultat=xmlHttpAff.responseText.split("|");
	document.getElementById("contenu").innerHTML = resultat[0];
	document.getElementById("txt_blanc").innerHTML = resultat[1];
	document.getElementById("texte_historique").innerHTML = resultat[2];
	if (document.getElementById("carteFlash") && document.getElementById("FlashEnd").value == "1"){hideSWF();}}
}

function toggleDiv(nomDiv){
	var theDiv = document.getElementById(nomDiv);
	if (theDiv.style.display=="none"){
		theDiv.style.display="block";
	}else{
		theDiv.style.display="none";
	}
}

function toggleImg(nomImg,src1,src2){
	var theImg = document.getElementById(nomImg);
	if (theImg.src.indexOf(src1,0)>0){
		theImg.src=src2;
	}else{
		theImg.src=src1;
	}
}

function hideSWF(){
document.getElementById("carteFlash").style.display = "none";
document.getElementById("maps").style.display = "block";
document.getElementById("FlashEnd").value = "1";
}

function GetXmlHttpObject(){
var xmlHttp=null;
try {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e){
  // Internet Explorer
  try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
  catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
  }
return xmlHttp;
}
