<!--
// Déclatation des variables globales~
var isDHTML = 1;
var isID = 1;
var openme = 1;
var slideDelay = 0;
var domStyle = null;
var oHTTP = null;
var ongletstate = "";
var loadingmsg1 = "<div class='encours'><br />Chargement de la page...<br /><br /></div>";
// <img src='layout/loading2.gif' alt='' width='21' height='21' align='center' valign='middle' style='display:block;' />";
var f = 0;
var mondiv = "";
var boutonlayout = new Array('Pr&eacute;sentation','Plan d\'acc&egrave;s','Contactez nous','Pr&eacute;sentation','Plan d\'acc&egrave;s');
var contenu = new Array();
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

// Initialisation Cross Browser
if(window.ActiveXObject) {
    try {
        oHTTP = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
    }
} else {
    oHTTP = new XMLHttpRequest();
}
//AddEvent
		function addEvent(obj, evType, fn){
			 if (obj.addEventListener){
				 obj.addEventListener(evType, fn, true);
				 return true;
			 } else if (obj.attachEvent){
				 var r = obj.attachEvent("on"+evType, fn);
				return r;
			 } else {
				return false;
			 }
		}
	
// Restaurer le back/forward et Refresh...
function PageLocator(propertyToUse, dividingCharacter) {
  this.propertyToUse = propertyToUse;
  this.defaultQS = 1;
  this.dividingCharacter = dividingCharacter;
}
PageLocator.prototype.getLocation = function() {
  return eval(this.propertyToUse);
}
PageLocator.prototype.getHash = function() {
  var url = this.getLocation();
  if(url.indexOf(this.dividingCharacter)>-1) {
    var url_elements = url.split(this.dividingCharacter);
    return url_elements[url_elements.length-1];
  } else {
    return this.defaultQS;
  }
}
PageLocator.prototype.getHref = function() {
  var url = this.getLocation();
  var url_elements = url.split(this.dividingCharacter);
  return url_elements[0];
}
PageLocator.prototype.makeNewLocation = function(new_qs) {
  return this.getHref() + this.dividingCharacter + new_qs;
}

/* AjaxIframesFixer */
		function AjaxIframesFixer(iframeid) {
			this.iframeid = iframeid;
			if (document.getElementById('ajaxnav')) {
				//this.fixLinks();
				
				this.locator =  new PageLocator("document.frames['"+this.iframeid+"'].getLocation()", "?hash=");
				this.windowlocator = new PageLocator("window.location.href", "#");
				this.timer = new Timer(this);
				
				this.delayInit(); // required or IE doesn't fire
			}
		}
		AjaxIframesFixer.prototype.fixLinks = function (iframeid) {
			var links = document.getElementsByTagName("A");
			for(var i=0; i<links.length; i++) {
				var href = links[i].getAttribute("href");
				var hash = href.substr(href.indexOf("hash=")+5);
				links[i].setAttribute("href","javascript:document.getElementById('"+this.iframeid+"').setAttribute('src', 'dummy.asp?hash="+hash+"');");
			}
		}
		AjaxIframesFixer.prototype.delayInit = function(){
			this.timer.setTimeout("checkBookmark", 100, "");
		}
		AjaxIframesFixer.prototype.checkBookmark = function(){
			window.location = this.windowlocator.makeNewLocation(this.locator.getHash());
			this.checkWhetherChanged(0);
		}
		AjaxIframesFixer.prototype.checkWhetherChanged = function(location){
			if(this.locator.getHash() != location) {
			   afficheForm(this.locator.getHash());
				window.location = this.windowlocator.makeNewLocation(this.locator.getHash());
			}
			this.timer.setTimeout("checkWhetherChanged", 200, this.locator.getHash());
		}
	/* END AjaxIframesFixer */
	
//Restaurer la fonction bookmark
function AjaxUrlFixer() {
  //this.fixLinks();

  this.locator = new PageLocator("window.location.href", "#");
  this.timer = new Timer(this);
  this.checkWhetherChanged(0);
}
AjaxUrlFixer.prototype.fixLinks = function () {
  var links = document.getElementsByTagName("A");
  for(var i=0; i<links.length; i++) {
    var href = links[i].getAttribute("href");
   var hash = href.substr(href.indexOf("hash=")+5);
   links[i].setAttribute("href","#"+hash);
  }
}
AjaxUrlFixer.prototype.checkWhetherChanged = function(location){
  if(this.locator.getHash() != location) {
    afficheForm(this.locator.getHash());
  }
  this.timer.setTimeout("checkWhetherChanged", 200, this.locator.getHash());
}

	function setContent(new_content) {
		if(!document.getElementById || !document.getElementsByTagName) return;
		var container = document.getElementById("container");
		container.innerHTML = new_content;
	}
	function FixBackAndBookmarking() {
		if(!document.getElementById || !document.getElementsByTagName) return;
		if(document.iframesfix) {
			fix = new AjaxIframesFixer('ajaxnav');
		} else {
		fix = new AjaxUrlFixer();
		}
	}
	var detect = navigator.userAgent.toLowerCase();
	if(detect.indexOf("msie")>-1) document.iframesfix = true;

// -- Menu animE définition du layer qui bouge
function setMenu (objectID) {
	if (isDHTML){
		domStyle = document.getElementById(objectID).style; //findDOM(objectID,1);
		if (openme) { fX = -172; cX = 0; openme = 0; document.getElementById("dummy").style.display = "none";  }
			else { fX = 0; cX = -172; openme = 1; document.getElementById("dummy").style.display = "block"; }
			slideMenu(cX,fX);
			tabUpdate(ongletstate);
		}
}	
// fonction animer le menu Echaque clique sur une rubrique~
function setMenu2 (objectID) {
	if (isDHTML){
		domStyle = document.getElementById(objectID).style; //findDOM(objectID,1);
		fX = 0; cX = -172; openme = 1; document.getElementById("dummy").style.display = "block";
		slideMenu(cX,fX);
		tabUpdate(ongletstate);
		}
}	
// fonction d'animation
function slideMenu (cX,fX) {
	var comparaison = 0;
	if (cX != fX) {
		if (cX > fX) { cX -= 4; }
		else { cX += 4; }
		comparaison = 172 + cX;
		domStyle.left = cX+'px';
		domStyle.clip = 'rect(0px, ' + (196 - cX) + 'px, 680px,' + (173 - comparaison) + 'px)';
		setTimeout('slideMenu(' + cX + ',' + fX + ')', slideDelay);  
	}
	return;
}
// Fonction de chargement, des pages de formations 
function selectLeaf(title, code) {
			numformation = code;
			/*setMenu("menudynamique");*/
			//doHTTPGet("../formations.asp?id="+numformation, "pageformation", "GET", null, "xml-formation");
			window.location.hash = numformation;
			if (document.iframesfix == true)
			document.getElementById("ajaxnav").setAttribute('src', 'dummy.asp?hash='+code);
			
			//return true;
}
//Charge la formation
function afficheForm(code) {
			if (code != 1){
			numformation = code;
			doHTTPGet("formations.asp?id="+numformation, "pageformation", "GET", null, "xml-formation");
			window.location.hash = numformation;
			if (document.iframesfix == true)
			document.getElementById("ajaxnav").setAttribute('src', 'dummy.asp?hash='+code);
			}
			//return true;
}
function selectFolder(folderCode) {
        			//alert("You just clicked on a folder with code :" + folderCode);
}


	
// Fonction pour récupérer les menus dynamique depuis une base de données - Ajax
function doHTTPGet(url, div, methode, data) {
	mondiv = div;
	oHTTP.open(methode,url, true);
	   	if (methode == "POST" && data != "") oHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		else {if (methode == "GET") data = null;}
	oHTTP.onreadystatechange = ProcessLoading;
	oHTTP.send(data);
}
// Que Faire pendant le chargement de la page ?
function ProcessLoading()
{
var r="";
		if (oHTTP.readyState==4) 
			{
			if (oHTTP.status == 200) {
   				var r=oHTTP.responseText;
				
					if (mondiv != null) 
					{
						
							document.getElementById(mondiv).innerHTML = r;
							initLightbox();
							externalLinks();

					}

			}
			}
		
		else 
			{
			document.getElementById(mondiv).innerHTML = loadingmsg1;
			}
		 return false;
			
}
	

function transp(Calc) //Fonction de transparence, Eaméliorer
{
if ((f<11)){
if (document.all&&document.getElementById){
	document.getElementById(Calc).filters.alpha.opacity=f*10;
	}
else {
	document.getElementById(Calc).style.MozOpacity=Math.min(parseFloat(f/10)+0.1, 0.90);
	}
f+=1;
//setTimeout('transp("'+Calc+'")',0);
}
else {f=0;
clearInterval(Transition); }
}

function fade(el, from, to, interval) {
	//so we can pass a string for the id or an element:
    if (el == new String(el)) el = document.getElementById(el);

    var dif = Math.abs(to - from);
    
    var pi = Math.PI;
    var i = 0;
    
    //to gain a slight speed boost - work out all values first.
    var opacs = [];
    
    for (var theta=0; theta < 90; theta+=8) { //play with the increment value for theta to get this smoother
    	if (to > from) 
			var step = Math.sin((theta*pi)/180);
		else 
			var step = Math.cos((theta*pi)/180);
		
		opacs.push(dif*step);
    }
        
	var inter = setInterval(
		function() {
			if (++i < opacs.length) {
				if (document.all&&document.getElementById){
				el.filters.alpha.opacity=Math.max(0.01, opacs[i])*100;
				}
				else el.style.opacity = Math.max(0.01, opacs[i]); //fixing safari glitch
			} else {
				if (document.all&&document.getElementById){
				el.filters.alpha.opacity=to*100;
				}
				else el.style.opacity = to;
				clearInterval(inter);
			}
		}, interval); //play with this interval value to get this smoother
}

// fonction d'initialisation des boutons de navigation.
function Launcher(rubrique)
{
	doHTTPGet(rubrique,"contwin","GET",null);
}
function Launcher2(rubrique2)
{
	doHTTPGet(rubrique2,"legende","GET",null);
}
function LaunchForm(rubrique,objform)
{
	var data = "nom=" + objform.elements["nom"].value;
	data += "&email=" + objform.elements["email"].value;
	data += "&sujet=" + objform.elements["sujet"].value;	
	data += "&message=" + objform.elements["message"].value;
	data += "&lng=" + objform.elements["lng"].value;
	doHTTPGet(rubrique,"contwin","POST",data,"Loading");
}
function LaunchForm2(rubrique,objform)
{
	var data = "nom=" + objform.elements["nom"].value;
	data += "&email=" + objform.elements["email"].value;
	data += "&sujet=" + objform.elements["sujet"].value;	
	data += "&tel=" + objform.elements["tel"].value;	
	data += "&message=" + objform.elements["message"].value;
	doHTTPGet(rubrique,"legende","POST",data,"Loading");
}
/*function LaunchForm2(rubrique,objform)
{
	var data = "user=" + objform.elements["user"].value;
	data += "&pass=" + objform.elements["pass"].value;
	doHTTPGet(rubrique,"contwin","POST",data,"Loading");
}*/
// Fonction qui garde l'état d'un bouton selectionnE
function setButton(idbutton)
{	
	for (b=1; b<boutonlayout.length; b++)
	{
		document.getElementById(b).className = "btnsubnav";
	}
		document.getElementById(idbutton).className = "btnsubnav-on";
}

function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
      anchor.target = "_blank"; 
   else if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "mailto")
 		{
		if ((anchor.text) && anchor.text == "Interall")
			{
			var username = "interall";
			var namedom = "gmail.com";
			}
			else if ((anchor.innerText) && anchor.innerText == "Interall")
			{
			var username = "interall";
			var namedom = "gmail.com";
			}
   		anchor.href = "mailto:" + username + "@" + namedom;
		}
 } 
} 

// 	Fonction d'initialisation de la page formation... histoire que même les boutons soient pas visible en mattant le code source >.>

var scroll_timer;
var delta1 = 1;
	function scrollit1() {
		if (!window.ActiveXObject) {PORT_scroll = document.getElementById("PORT_scroll");}
		PORT_scroll.scrollLeft = PORT_scroll.scrollLeft+delta1;
		if(PORT_scroll.scrollLeft>=PORT_scroll.scrollWidth-PORT_scroll.clientWidth) {
			delta1 = delta1 * -1;
		}
		if(PORT_scroll.scrollLeft<=0)
			delta1 = delta1 * -1;
	}
	function scrollStop() {
		window.clearInterval(scroll_timer);
	}
	function scrollStart() {
		scroll_timer=window.setInterval('scrollit1();', 30);
	}
function affichecontenu(i)
{
document.getElementById("legende").innerHTML = contenu[i];
}

function toggleFAQ (faqid)
{
	
	var faqdiv = "num"+ faqid; // + "_div";
	var obj = document.getElementById(faqdiv);
	if (obj.style.display == "none" || obj.style.display == '')
		obj.style.display = "block";
	else
		obj.style.display = "none";

}

function initapp()
{
//	FixBackAndBookmarking();
//	if(window.location.hash.length > 0)
//    afficheForm(window.location.hash.substring(1,window.location.hash.length));
externalLinks();
initLightbox();
}
/*window.onload = externalLinks;*/
window.onload = initapp;
-->