//----------------------------------------------------------------------------------------------
//--    Auteur : Michel Gautier  (Software Domain)
//--    Date   : XX/XX/2000
//--    Description : Scripts utilisés par un site généré par OO
//----------------------------------------------------------------------------------------------
//--  Historique des modifications :
//--  
//--   Alan Ferronnière 02/06/2005 Gestion de l'impression fonction imprimer()                           
//--   Michel Gautier   19/06/2006     #235
//----------------------------------------------------------------------------------------------


	var MenuFerme = true;
	var myImg = new Image()
	//détection des navigateurs
	var dom = (document.getElementById) ? true : false;
	var ns4 = (document.layers) ? true : false;
    var ie = (document.all) ? true : false;
	var ie4 = ie && !dom;
	var mac = (navigator.appVersion.indexOf("Mac") != -1);
	var ie4m = ie4 && mac;
	var ie5m = ie && mac;
	var ie5w = ie && !mac;
	var ns6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));

	function Connecter(varFtp, login)
	{
	   password = window.prompt("Mot de Passe :", "")
	   window.open("ftp://" + login + ":" + password + "@" + varFtp)
	}  
	
	function mailTo(url, width, height, scroll)
	{
		//window.navigate("mailto:"+url)
		window.open("mailto:"+url,"_self")
	}
	
	function navActif(url, width, height, scroll)
	{	
		//window.navigate(url)
		var re=/^#.+$/gi
		var re2=/#.+$/gi
			
	    if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
		    if (ie5w && !url.match(re))
				url = "../"+url;
		}
		
		if (url.match(re))
	        url=location.href.replace(re2,"")+url;
		
		window.open(url,"_self")		
	}
	
	function ouvrir(url, width, height, scroll)
	{
			  
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}
			  
			  window.open(url,"","resizable=yes,scrollbars="+scroll+", width="+width+", height="+height)
	}
	
	function ouvrirNewNav(url, width, height, scroll)
	{
			  
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}
			  
			  window.open(url,"", "resizable=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars="+scroll+",width="+width+", height="+height)
	}
	
	function fParent(url, width, height, scroll)
	{
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}
			  
			  window.open(url,"_parent", "resizable=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars="+scroll+",width="+width+", height="+height)
	}
	
	function fTop(url, width, height, scroll)
	{
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}
			  
			  window.open(url,"_top", "resizable=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars="+scroll+",width="+width+", height="+height)
	}
	
	function fIframe(url, width, height, scroll)
	{
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}

				try {
					window.document.all.IFrameOO.src = url
				} catch(e) {}
			  
			  //window.open(url,"IFrameOO", "resizable=yes,toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars="+scroll+",width="+width+", height="+height)
	}
	
	function ouvrirModal(url, width, height)
	{
		if (new String(location.href).match(/.+\/\d+(-\d+)*\/.+\.htm($|#.+$)/gi) && !new String(url).match(/http:\/\//gi) && !new String(url).match(/javascript:/gi))
		{
			if (ie5w)
				url = "../"+url;
		}
		
			  if(new String(width) == '0' | new String(width) == 'undefined' | new String(width) == '' | new String(width) == 'null')
			  {width = new String("572")}
			  if(new String(height) == '0' | new String(height) == 'undefined' | new String(height) == '' | new String(height) == 'null')
			  {height = new String("317")}
			  if(new String(scroll) == 'undefined')
			  {scroll = new String("yes")}
			  if(document.all)
			  {
				window.showModalDialog(url, "", "resizable=yes,status:no;unadorned:no;dialogWidth:"+width+ "px; dialogHeight:"+height+"px")
			  }
			  else
			  {
				window.open(url,"contact", "toolbar=no,scrollbars=yes, width="+width+", height="+height)
			  }
	
	}
	function openCloseMenu(val)
	{
	   if(MenuFerme)
	   {
	   	if(parseInt(document.all[val].style.top) < 0)
	   	{
	   		document.all[val].style.top = parseInt(document.all[val].style.top) + 5
	   		setTimeout("openCloseMenu('"+val+"')", 1)
	   	}
	   	else
	   	{
	   		MenuFerme = false
	   	}
	   	
	   }
	   else
	   {
	   	if(parseInt(document.all[val].style.top) > -130)
	   	{
	   		document.all[val].style.top = parseInt(document.all[val].style.top) - 5
	   		setTimeout("openCloseMenu('"+val+"')", 5)
	   	}
	   	else
	   	{
	   		MenuFerme = true
	   	}

	   }
	   //window.event.cancelBubble = true
	}
	
	function fctRollImage(id, val)
	{
		if(document.all)
		{
			document.all[id].src = val
		}
		else
		{
			eval("document."+ id + ".src = " + val)
		}
	}
	
	function ouvrirPopup(idPoppup)
	{
		try
		{
			ptrPopup = document.getElementById(idPoppup)
			if(ptrPopup.style.visibility == "visible")
			{
				ptrPopup.style.visibility = "hidden"
			}
			else
			{
				ptrPopup.style.visibility = "visible"
			}
		}
		catch(e)
		{
		}
	}
	
	function afficherEnPied()
	/*  
	 *
	 *
	 */
	{	
	   
    
	    var listeDiv = document.getElementsByTagName("div");	    
	    var ilisteDiv = 0;	
	    try
	    {    
		  divPrinc =  document.getElementById("divFrame")
		
		
		 var posPiedPage = divPrinc.scrollHeight;
		  var tailleEcran = divPrinc.clientHeight;
		   if  (posPiedPage < document.documentElement.scrollHeight)
			posPiedPage = document.documentElement.scrollHeight;
		  if (posPiedPage < document.body.scrollHeight)
			posPiedPage = document.body.scrollHeight;
		  divPrinc.style.height = posPiedPage;	
//		  alert( posPiedPage + " - " + tailleEcran +" " + document.body.scrollHeight );


		  
		  
	    }
	    catch(e)
	    {
		    var posPiedPage = document.body.scrollHeight;
		    var tailleEcran = document.body.clientHeight;	   
	    }
	  
 	    if (posPiedPage  == 0) posPiedPage = document.body.scrollHeight;
	    if (tailleEcran == 0)  tailleEcran = document.body.clientHeight;
	
	    while(ilisteDiv < listeDiv.length)
	    {	       
		try{ 
	        if (listeDiv[ilisteDiv].getAttribute('name') == "AfficherEnPiedPage" || listeDiv[ilisteDiv].getAttribute('title') == "AfficherEnPiedPage")
	        {	  
	            if ( posPiedPage >=  tailleEcran)
	            {      
	                listeDiv[ilisteDiv].style.top = posPiedPage + parseInt(new String(listeDiv[ilisteDiv].style.top).replace(/px/gi, ""));
	            }
	            else
	            {
	                    listeDiv[ilisteDiv].style.top = posPiedPage + parseInt(new String(listeDiv[ilisteDiv].style.top).replace(/px/gi, "")) - + parseInt(new String(listeDiv[ilisteDiv].style.height).replace(/px/gi, ""));	                
	            }
	            listeDiv[ilisteDiv].style.display = "block";
	        }
		}catch(e){}
	        ilisteDiv++;
	    }
	}
	
   /**********************************************
    *
    * Correction Bug Firefox
    *
    ***********************************************/

var ie = /MSIE/.test(navigator.userAgent);
var moz = !ie && navigator.product == "Gecko";

if (moz) {
     HTMLElement.prototype.__defineGetter__("children", function() {
           var arr = new Array(), i = 0, l = this.childNodes.length;
           for ( i = 0; i < l; i++ ) {
               if ( this.childNodes[ i ].nodeType == 1 ) {
                    arr.push( this.childNodes[ i ] );
               }
           }
      return arr;
      });

      HTMLElement.prototype.__defineGetter__("firstChild", function() {
            var node = this.childNodes[ 0 ];
            while (node.nodeType != 1) node = node.nextSibling;
                 return node;
            });

     HTMLElement.prototype.__defineGetter__("lastChild", function() {
     var node = this.childNodes[ this.childNodes.length - 1 ];
     while (node.nodeType != 1) node = node.previousSibling;
           return node;
      });

    HTMLElement.prototype.__defineGetter__("parentElement", function() {     
           return this.parentNode;
      });
} 



	
   /**********************************************
    *
    * Gestion de l'affiche du toolType
    *
    ***********************************************/
	
	
	function showToolTip(texte, event)
	/*  Affiche le toolTip avec le text passé en paramètre
	 *
	 */
	{
		
		var divToolTip=document.getElementById("divToolTip")
		var textToolTip=document.getElementById("textToolTip")
		
		var x= (document.all)?event.x:event.pageX;
		var y= (document.all)?event.y:event.pageY;
		
		
		textToolTip.innerHTML=texte

		divToolTip.style.visibility="visible"
		divToolTip.style.left = x + 20;
		divToolTip.style.top  = y;
		

	}
	
	function moveToolTip(event)
	{
	    
		var x= (document.all)?event.x:event.pageX;
		var y= (document.all)?event.y:event.pageY;		
		divToolTip.style.left = x + 20;
		divToolTip.style.top  = y;
	}		
	function hideToolTip()
	{
		var divToolTip=document.getElementById("divToolTip")
		divToolTip.style.visibility="hidden"
	}
	

/*****************************************
 *   Initialisation de la page
 *
 *
 ****************************************/

    function OO_Load(NroNode)
    {
	try{startOnload_Model();}catch(e){}
	afficherEnPied();
	getIn(NroNode);
	try{endOnload_Model();}catch(e){}
    }

    function OO_unLoad(NroNode)
    {
	try{startOnunload_Model();}catch(e){}
	afficherEnPied();
	getIn(NroNode);
	try{endOnunload_Model();}catch(e){}
    }