var Nom = navigator.appName;
	
	if (Nom != 'Microsoft Internet Explorer') { 
	alert("Désolé ce site web ne peut être visualisé sur ce type de Navigateur \n Veuillez utiliser Internet Explorer version 6 ou 7 de Microsoft !");
	window.location.href="navigateur_erreur.htm";
	}	
	
sfHover = function() { 

	var sfEls = document.getElementById("containerMenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

// Flip Book

var bookImages = new Array();
var preImages = new Array();
var copt = 0;
var contBook;


function initbook()	{

	contBook = document.getElementById("book").childNodes.length;
	
	for(i = 0; i < contBook; i++) {
	var src = document.getElementById("book").childNodes[i].fill.src;

	bookImages[i] = src+'';
	preImages[i] = new Image();
	preImages[i].src = bookImages[i];
	}
	pageL = document.getElementById("gbook").firstChild;
	pageM = document.getElementById("gbook").firstChild.nextSibling;
	pageR = document.getElementById("gbook").lastChild;

	pageL.fill.src = bookImages[copt];
	pageM.fill.src = bookImages[copt+1];
	pageR.fill.src = bookImages[copt+1];
	
}

function initposition(srcphoto)	{

	contBook = document.getElementById("book").childNodes.length;
	
	for(i = 0; i < contBook; i++) {
	var src = document.getElementById("book").childNodes[i].fill.src;
	
	if ( bookImages[i] == srcphoto ) { 
		
		if( i%2 == 1 ) {
			copt = i-3;
			page_book("right");
		} else {
		copt = i+2;
		page_book("left");
		}

	}
	
	}
		
	pageR.fill.opacity="1";
	pageL.fill.opacity="1";
	txtL.innerHTML="";
	txtR.innerHTML="";
	
}




function page_book(dir) {

		pageL.fill.opacity="1";
		pageR.fill.opacity="1";
		txtL.innerHTML="";
		txtR.innerHTML="";

		if( dir=="right") {
		
			if ( copt < contBook-2 ) {
		
		ani_0.values = pageL.fill.src;
		ani_1.values = pageR.fill.src;
		ani_2.values = pageR.fill.src ;

		pageM.style.zIndex = 1;
		
		ani_8.values = bookImages[copt+2];
		ani_9.values = bookImages[copt+2];
		
		ani_12.values = bookImages[copt+3];
		ani_13.values = bookImages[copt+3];
				
		book_02.endElement();
     	book_01.beginElement();
		
		ani_0.onbegin="book_02.resetElement()";
		
		copt+= 2; 
		
			} else {
		pageR.fill.opacity="0.2";	
		txtR.innerHTML="<br><br><br>Fin du book";

			}

		} else { 

		if( dir == "left" ) { 
		
		pageR.fill.opacity="1";
		pageL.fill.opacity="1";
		txtL.innerHTML="";
		txtR.innerHTML="";
		
			if ( copt > 0 ) {
		
		ani_14.values = pageL.fill.src;
		ani_15.values = pageR.fill.src;
		ani_16.values = pageL.fill.src;

		ani_24.values = bookImages[copt-1];
		ani_25.values = bookImages[copt-1];
		
		ani_28.values = bookImages[copt-2];
		ani_29.values = bookImages[copt-2];
		
		book_01.endElement();
		book_02.beginElement();
		
		ani_14.onbegin="book_01.resetElement()";
		
		copt-= 2; 
		
			} else {
			pageL.fill.opacity="0.2";
			txtL.innerHTML="<br><br><br>Début du book";
			}
		
		}
		
		}
		 	   
}

// fin Flip Book


var ong_01="true";
var objong ="";
function onglet_01(obj) { 

		if (obj == undefined ) {
	 	ongSource = event.srcElement ;
		oIdent = ongSource.id;
		} else {
		oIdent = obj;
		}
				
		if( ong_01=="true") {
		
		var accord = document.getElementById(oIdent).parentNode;
		var cont1 = document.getElementById(oIdent).parentNode.firstChild;
		var ongdeg1 = parseInt(accord.childNodes[1].style.height); // onglet dégradé

		aniong_01.targetElement=oIdent;
		aniong_02.targetElement=accord.id;
		aniong_03.targetElement=accord.id;
		aniong_04.targetElement=oIdent;
		aniong_05.targetElement=accord.id;
		aniong_06.targetElement=accord.id;
		
		var oAccord_H = accord.style.height;
		var oAccord_T = accord.style.top;
		var oText_H = cont1.style.height;

		ong_01="false";
		objong = oIdent;
		parong_02.endElement();
     	parong_01.beginElement();
		aniong_02.from=parseInt(oAccord_H);
		aniong_02.to= parseInt(oText_H)+(ongdeg1+5);
		aniong_03.from=parseInt(oAccord_T);
		aniong_03.to= parseInt(oAccord_T)- (parseInt(oText_H)+5);
		aniong_02.onbegin="parong_02.resetElement()";
		
		} else {

		if( objong == oIdent ) { 
		ong_01="true";
		parong_01.endElement();
		parong_02.beginElement();
		aniong_05.from=aniong_02.to;
		aniong_05.to=aniong_02.from;
		aniong_06.from=aniong_03.to;
		aniong_06.to=aniong_03.from;
		aniong_05.onbegin="parong_01.resetElement()";
		
		} else {
		parong_01.endElement();
		parong_02.beginElement();
		aniong_05.from=aniong_02.to;
		aniong_05.to=aniong_02.from;
		aniong_06.from=aniong_03.to;
		aniong_06.to=aniong_03.from;
		aniong_05.onbegin="parong_01.resetElement()";
		ong_01="true";
		setTimeout("onglet_01(oIdent)",500);
		}
		
		} 
	
		        
}	
	


var gli="true";
var objgli ="";
function glissiere(objt) { 

		if (objt == undefined ) {
	 	oSource = event.srcElement ;
		oIdenti = oSource.id;
		} else {
		oIdenti = objt;
		}
				
		if( gli=="true") {
		
		var accorde = document.getElementById(oIdenti).parentNode;
		var cont_1 = document.getElementById(oIdenti).parentNode.firstChild;

		ani_01.targetElement=oIdenti;
		ani_02.targetElement=accorde.id;
		ani_04.targetElement=oIdenti;
		ani_05.targetElement=accorde.id;
		
		var oAccordH = accorde.style.height;
		var oTextH = cont_1.style.height;

		gli="false";
		objgli = oIdenti;
		par_07.endElement();
     		par_06.beginElement();
		ani_02.from=parseInt(oAccordH);
		ani_02.to= parseInt(oTextH)+27;
		ani_02.onbegin="par_07.resetElement()";
		
		} else {

		if( objgli == oIdenti ) { 
		gli="true";
		par_06.endElement();
		par_07.beginElement();
		ani_05.from=ani_02.to;
		ani_05.to=ani_02.from;
		ani_05.onbegin="par_06.resetElement()";
		
		} else {
		par_06.endElement();
		par_07.beginElement();
		ani_05.from=ani_02.to;
		ani_05.to=ani_02.from;
		ani_05.onbegin="par_06.resetElement()";
		gli="true";
		setTimeout("glissiere(oIdenti)",500);
		}
		
		} 
			        
}

var acc="true";
var objacc ="";
function accordeon() {

		if( acc=="true") {
		oSource = event.srcElement ;
		oIdentAc = oSource.id;
		var accord = document.getElementById(oIdentAc).parentNode;
		var cont1 = document.getElementById(oIdentAc).parentNode.firstChild;
		var cont2 = document.getElementById(oIdentAc).parentNode.lastChild;
		ani_01.targetElement=oIdentAc;
		ani_02.targetElement=cont1.id;
		ani_03.targetElement=cont2.id;
		ani_04.targetElement=oIdentAc;
		ani_05.targetElement=cont1.id;
		ani_06.targetElement=cont2.id;
		var oAccordH = accord.style.height;
		var oHeight1 = cont1.style.height;
		var oHeight2 = cont2.style.height;
		cont2.style.overflowY="hidden";

		acc="false";
		objacc = oIdentAc;
		par_02.endElement();
     		par_01.beginElement();
		ani_02.from=oHeight1;
		ani_02.to= parseInt(oAccordH)-30;
		ani_03.from=oHeight2;
		ani_03.to= parseInt(oAccordH)-55;
		ani_02.onbegin="par_02.resetElement()";
		
		} else { 
		if( objacc == oIdentAc ) { 
		acc="true";
		objacc = "";
		par_01.endElement();
		par_02.beginElement();
		ani_05.from=ani_02.to;
		ani_06.from=ani_02.to;
		ani_05.to=1;
		ani_06.to=1;
		ani_05.onbegin="par_01.resetElement()";
		
		}
		
		}
		        
}

var nbPlan ="2";
var etat="true";
var objZ ="";
function selectZoom() {
		
		var oSrc = event.srcElement ;
		var posi = parseInt(oSrc.parentElement.parentNode.style.left);
		//alert(posi);
		oId = oSrc.id;
		var oLeft =oSrc.style.left;
		var oTop = oSrc.style.top;
		oSrc.fill.opacity=1;
		if( etat=="true") {
		etat="false";
		objZ = oId;
     		oSrc.style.zIndex=nbPlan++;
		parZoom_04.endElement();
		parZoom_03.beginElement();
		accZoom_01.targetElement=oId;
		accZoom_01.onbegin="parZoom_04.resetElement()";
		accZoom_03.targetElement=oId;
		accZoom_03.from= oLeft;
		if( posi > 0 && posi < 320 ) { accZoom_03.to= 300 };
		if( posi > 321 && posi < 640 ) { accZoom_03.to= -60 };
		if( posi > 640 && posi < 970 ) { accZoom_03.to= -400 };
		accZoom_04.targetElement=oId;
		accZoom_04.from=oTop;
		} else { 
		if( objZ == oId) { 
		etat="true";
		objZ = "";
        	oSrc.style.zIndex=nbPlan++;
		parZoom_03.endElement();
		parZoom_04.beginElement();
		accZoom_02.targetElement=oId;
		accZoom_02.onbegin="parZoom_03.resetElement()";
		accZoom_05.targetElement=oId;
		accZoom_05.to=accZoom_03.from;
		accZoom_05.from=accZoom_03.to;
		accZoom_06.targetElement=oId;
		accZoom_06.to=accZoom_04.from;
		accZoom_07.targetElement=oId;
		accZoom_08.targetElement=oId;
		
		}
		
		}
        
}

function img_fx(img){
	if(img && img.filters && img.filters[0]){
		img.filters[0].apply();
		img.filters[0].play();


	}
}


 var prvTr;
 var prvTr2;
 
function localisationGPS(coor) {


	sourceBase.recordset.AbsolutePosition = coor;
	if ( sourceBase.recordset.fields(12).value == "" ) {
	var arg2 = sourceBase.recordset.fields(2).value;
	var arg4 = sourceBase.recordset.fields(4).value;
	var arg5 = sourceBase.recordset.fields(5).value;
	var adresseGPS = arg2+'<br>'+arg4+'<br>'+arg5;
	var latlngGPS =""
	} else {
	var arg2 = sourceBase.recordset.fields(2).value;
	var arg4 = sourceBase.recordset.fields(4).value;
	var arg5 = sourceBase.recordset.fields(5).value;
	var adresseGPS = arg2+'<br>'+arg4+'<br>'+arg5;
	var latlngGPS = sourceBase.recordset.fields(12).value;
	var url ="http://"+window.location.hostname+"/gabarits/geocoder.php3";
	}
	if ( adresseGPS != "" && latlngGPS != "" ) { 
	strLoc = adresseGPS+"|"+latlngGPS;
	window.open(url+"?loca="+strLoc,"Google_Maps","width=640,height=440,left=200,top=200");
	} else { 
	strLoc ="";
	alert(" Aucune localisation sur Google Maps !");
	}

}
 
function Localisation(Loca) {

 var tabLoca = Loca.split("|");
 var filt_01 = tabLoca[0];
 var filt_02   = tabLoca[1] ;

 tblBase.dataSrc =" ";
 sourceBase.Filter = "Localisation="+filt_01 +" & Pays="+filt_02;
 tblBase.dataSrc ="#sourceBase";
 sourceBase.Reset();
 rs=sourceBase.recordset;
 cpt = rs.recordCount;
 nbre.innerHTML=cpt;
 
}

function init() {
 tblBase.dataSrc ="#sourceBase";
 rs=sourceBase.recordset;
 rs.MoveFirst();
 cpt = rs.recordCount;
 nbre.innerHTML=cpt;
}

function zonage(tr) {
  prvTr2 = tr
  tr.className = 'button';
  if ((prvTr != null) && (prvTr != tr))
   prvTr.className = '';
  prvTr = prvTr2
}


function imprimePage(impDocId)	{ 

	var printDoc = document.all[impDocId.id];
 	w = window.open('',impDocId.id,'width=300px,height=100px,resizable=yes scrollbars=yes toolbar=yes');
	w.document.write( "<html><head><title>Impression</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "function format() {\n");
	w.document.write("document.all['"+impDocId.id+"'].style.overflow='visible';\n");
	w.document.write("document.all['"+impDocId.id+"'].style.position='relative';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.top='5px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.left='0px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.width='700px';\n");
  	w.document.write("document.all['"+impDocId.id+"'].style.height='100%';\n");
  	w.document.write( "self.resizeTo(775,700);\n");
  	w.document.write( "self.focus();\n");
  	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=20 topmargin=20 marginwidth=0 marginheight=0 onLoad='javascript:format();'> " );
	w.document.write("<font face='Verdana' size='1'>[ F5 pour ouvrir ]</font>&nbsp;&nbsp;&nbsp;<button onclick='JavaScript:window.print();'>Imprimer</button> <br><hr>");
	w.document.write(printDoc.outerHTML);
	w.document.write( "</body></html>" );
	}



function resizePopUp(monImage, monTitre)
    {
	w = window.open('','chargement','width=10px,height=10px');
	w.moveTo(20,20);
	w.document.write( "<html><head><title>"+monTitre+"</title>\n" );
	w.document.write( "<script language='JavaScript'>\n");
	w.document.write( "IE5=NN4=NN6=false;\n");
	w.document.write( "if(document.all)IE5=true;\n");
	w.document.write( "else if(document.getElementById)NN6=true;\n");
	w.document.write( "else if(document.layers)NN4=true;\n");
	w.document.write( "function autoSize() {\n");
	w.document.write( "if(IE5) self.resizeTo(document.images[0].width+9,document.images[0].height+59);\n");
	w.document.write( "else if(NN6) self.sizeToContent();\n");
	w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+20);\n");
	w.document.write( "self.focus();\n");
	w.document.write( "}\n</scri");
	w.document.write( "pt>\n");
	w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
	w.document.write( "<center><a href='javascript:window.close();'><img src='"+monImage+"' border=0 alt='"+monTitre+"'></a></center>" );
	w.document.write( "</body></html>" );
	w.document.close();
		}


	var volumeSetting = new Array();
	var currentVolume = 1;
	var mediaPlayer ;


function init_media() {

	var mediaCollection = document.getElementsByTagName('MEDIA'); 	//  MEDIA VIDEO

	for(i=0; i<mediaCollection.length; i++) {
	
	var oAttrObj = mediaCollection[i];
	var oAttr = oAttrObj.attributes;
	var oMediaId = oAttr.getNamedItem("id");
	var MediaId = oMediaId.value;

	if (	document.all[MediaId].currTimeState.isActive) {
	oMedia = MediaId ;
	} else {
	return false;
 	}
	}
}

function volumeArray(vol,visible,id,color) {
	
		this.vol = vol;
		this.visible = visible;
		this.id = id;
		this.color = color;

	}
		

	volumeSetting[0] = new volumeArray('0','visible','led_00','yellow');
	volumeSetting[1] = new volumeArray('10','visible','led_01','yellow');
	volumeSetting[2] = new volumeArray('20','visible','led_02','yellow');
	volumeSetting[3] = new volumeArray('30','visible','led_03','yellow');
	volumeSetting[4] = new volumeArray('40','visible','led_04','lime');
	volumeSetting[5] = new volumeArray('50','visible','led_05','lime');
	volumeSetting[6] = new volumeArray('60','visible','led_06','lime');
	volumeSetting[7] = new volumeArray('70','visible','led_07','red');
	volumeSetting[8] = new volumeArray('80','visible','led_08','red');
	volumeSetting[9] = new volumeArray('100','visible','led_09','red');
	
	
function volumeControl(change,idm) {

	
	if ((change == "decrease") && (currentVolume > 0)) {
				
	document.all[idm].volume = volumeSetting[currentVolume].vol;
	document.all[volumeSetting[currentVolume].id].fillcolor= "#F5F5F5";
	currentVolume = currentVolume-1;
	}

	if ((change == "increase") && (currentVolume < 9)) {
	currentVolume = currentVolume+1;

	document.all[idm].volume = volumeSetting[currentVolume].vol;
	document.all[volumeSetting[currentVolume].id].fillcolor= volumeSetting[currentVolume].color;
	}
	
}

	var bPlayListMade = false;
	

function fnCreatePlayList(oMedia)	{ 

    if(bPlayListMade == false)
    {
        var playCollection = document.all[oMedia].playList;
        for(i=0;i<playCollection.length;i++)
        {
		
            var sElement = "<SPAN onclick='"+"fnGoToTrack(\""+oMedia+"\")'" +	
		" CLASS = 'trackDisplay'>" + playCollection(i).title + "</SPAN>";
		var oDisplaySpan = document.createElement(sElement);
            oDisplaySpan.innerText = playCollection(i).title;
            oShowPlayList.insertBefore(oDisplaySpan);
            var oBr = document.createElement("BR");
            oShowPlayList.insertBefore(oBr);
		
        }
        bPlayListMade = true;
		}
	}

function fnGoToTrack(oMedia) { 

    var playCollection = document.all[oMedia].playList;
    for(i=0;i<playCollection.length;i++)
    {
        if(event.srcElement.innerText == playCollection(i).title)
        {
            playCollection(i).setActive();
        }
    }	
}

function updateFields(oMedia) {

    var aSpans = oShowPlayList.childNodes;
    
    for (i=0; i<aSpans.length; i++)
    {
        aSpans(i).style.color = "black";
		aSpans(i).style.fontWeight = "normal";
        if(aSpans(i).innerText == document.all[oMedia].playList.activeTrack.title)
        {
            aSpans(i).style.color = "red";
			aSpans(i).style.fontWeight = "bold";
        }
    }
   
    oTitle.innerText = document.all[oMedia].playList.activeTrack.title;
    oAuthor.innerText = document.all[oMedia].playList.activeTrack.author;
    oAbstract.innerText = document.all[oMedia].playList.activeTrack.abstract;
    oCopyright.innerText = document.all[oMedia].playList.activeTrack.copyright;
    // oFilename.innerText =  document.all[oMedia].playList.activeTrack.src;
	
}

function clearFields(){
    oTitle.innerText = " ";
    oAuthor.innerText = " ";
    oAbstract.innerText = " ";
    oCopyright.innerText = " ";
    // oFilename.innerText = "";
}


// Automatically attach a listener to the window onload, to convert the trees
addEvent(window,"load",convertTrees);

// Utility function to add an event listener
function addEvent(o,e,f){
	if (o.addEventListener){ o.addEventListener(e,f,true); return true; }
	else if (o.attachEvent){ return o.attachEvent("on"+e,f); }
	else { return false; }
}

// utility function to set a global variable if it is not already set
function setDefault(name,val) {
	if (typeof(window[name])=="undefined" || window[name]==null) {
		window[name]=val;
	}
}

// Full expands a tree with a given ID
function expandTree(treeId) {
	var ul = document.getElementById(treeId);
	if (ul == null) { return false; }
	expandCollapseList(ul,nodeOpenClass);
}

// Fully collapses a tree with a given ID
function collapseTree(treeId) {
	var ul = document.getElementById(treeId);
	if (ul == null) { return false; }
	expandCollapseList(ul,nodeClosedClass);
}

// Expands enough nodes to expose an LI with a given ID
function expandToItem(treeId,itemId) {
	var ul = document.getElementById(treeId);
	if (ul == null) { return false; }
	var ret = expandCollapseList(ul,nodeOpenClass,itemId);
	if (ret) {
		var o = document.getElementById(itemId);
		if (o.scrollIntoView) {
			o.scrollIntoView(false);
		}
	}
}

// Performs 3 functions:
// a) Expand all nodes
// b) Collapse all nodes
// c) Expand all nodes to reach a certain ID
function expandCollapseList(ul,cName,itemId) {
	if (!ul.childNodes || ul.childNodes.length==0) { return false; }
	// Iterate LIs
	for (var itemi=0;itemi<ul.childNodes.length;itemi++) {
		var item = ul.childNodes[itemi];
		if (itemId!=null && item.id==itemId) { return true; }
		if (item.nodeName == "LI") {
			// Iterate things in this LI
			var subLists = false;
			for (var sitemi=0;sitemi<item.childNodes.length;sitemi++) {
				var sitem = item.childNodes[sitemi];
				if (sitem.nodeName=="UL") {
					subLists = true;
					var ret = expandCollapseList(sitem,cName,itemId);
					if (itemId!=null && ret) {
						item.className=cName;
						return true;
					}
				}
			}
			if (subLists && itemId==null) {
				item.className = cName;
			}
		}
	}
}

// Search the document for UL elements with the correct CLASS name, then process them
function convertTrees() {
	setDefault("treeClass","mktree");
	setDefault("nodeClosedClass","liClosed");
	setDefault("nodeOpenClass","liOpen");
	setDefault("nodeBulletClass","liBullet");
	setDefault("nodeLinkClass","bullet");
	setDefault("preProcessTrees",true);
	if (preProcessTrees) {
		if (!document.createElement) { return; } // Without createElement, we can't do anything
		uls = document.getElementsByTagName("ul");
		for (var uli=0;uli<uls.length;uli++) {
			var ul=uls[uli];
			if (ul.nodeName=="UL" && ul.className==treeClass) {
				processList(ul);
			}
		}
	}
}

// Process a UL tag and all its children, to convert to a tree
function processList(ul) {
	if (!ul.childNodes || ul.childNodes.length==0) { return; }
	// Iterate LIs
	for (var itemi=0;itemi<ul.childNodes.length;itemi++) {
		var item = ul.childNodes[itemi];
		if (item.nodeName == "LI") {
			// Iterate things in this LI
			var subLists = false;
			for (var sitemi=0;sitemi<item.childNodes.length;sitemi++) {
				var sitem = item.childNodes[sitemi];
				if (sitem.nodeName=="UL") {
					subLists = true;
					processList(sitem);
				}
			}
			var s= document.createElement("SPAN");
			var t= '\u00A0'; // &nbsp;
			s.className = nodeLinkClass;
			if (subLists) {
				// This LI has UL's in it, so it's a +/- node
				if (item.className==null || item.className=="") {
					item.className = nodeClosedClass;
				}
				// If it's just text, make the text work as the link also
				if (item.firstChild.nodeName=="#text") {
					t = t+item.firstChild.nodeValue;
					item.removeChild(item.firstChild);
				}
				s.onclick = function () {
					this.parentNode.className = (this.parentNode.className==nodeOpenClass) ? nodeClosedClass : nodeOpenClass;
					return false;
				}
			}
			else {
				// No sublists, so it's just a bullet node
				item.className = nodeBulletClass;
				s.onclick = function () { return false; }
			}
			s.appendChild(document.createTextNode(t));
			item.insertBefore(s,item.firstChild);
		}
	}
}




