function setContainerSize(truc) {
	var navroot = document.getElementById(truc);
	if ( navroot ) {
		var lis = navroot.getElementsByTagName("div");
		/* XXX : y a-t-il un moyen plus simple de ne détecter que les divs de rang 1 ?
		 *       ou, détecter selon une classe ? */
		var ok = 0; var nok = 0;
		for ( i = 0; i < lis.length; i++ ) {
			if ( lis[i].parentNode != navroot )
				nok++;
			else 
				ok++;
		}
		navroot.style.width = ok * 140 + 10 + 'px';
	}
}


function popup(page,width,height)
{
	var page=window.open(page,"new","toolbar=no,left=0,top=0,width="+width+",height="+height+",directories=no,status=no,menubar=no,scrollbars=yes");
	page.focus();
}
function popup2(page,width,height)
{
	var page=window.open(page,"new2","toolbar=no,left=0,top=0,width="+width+",height="+height+",directories=no,status=no,menubar=no,scrollbars=yes");
	page.focus();
}
function showInfo(dl){
                if (navigator.appName=="Microsoft Internet Explorer"){
                    if (document.getElementById("infoIE"))
                        document.getElementById("infoIE").style.display = "block";
                        document.getElementById("btnMin").style.display = "none";
                        document.getElementById("infoTxt").style.display = "none";
                        if(dl) window.location.href = 'http://www.guide-du-travail.com/exe/orange/ie/guide-du-travail.exe';
                }
                else{
                   if (document.getElementById("infoFF"))
                        document.getElementById("infoFF").style.display = "block";
                        document.getElementById("btnMin").style.display = "none";
                        document.getElementById("infoTxt").style.display = "none";
                        if(dl) window.location.href = 'http://www.guide-du-travail.com/exe/orange/ff/guide-du-travail.exe';
                }
                        
                var http_obj = null; 
                
                function setMin(){
                    if(window.XMLHttpRequest) http_obj = new XMLHttpRequest();
                    else if(window.ActiveXObject) http_obj = new ActiveXObject("Microsoft.XMLHTTP");
                    else return;
                }
                if(dl) setMin();
            }

function ScanCookie(variable)
    {
    cook = document.cookie;
    variable += "=";
    place = cook.indexOf(variable,0);
    if (place <= -1)
        return("0");
    else
        {
        end = cook.indexOf(";",place)
        if (end <= -1)
            return(unescape(cook.substring(place+variable.length,cook.length)));
        else
            return(unescape(cook.substring(place+variable.length,end)));
        }
    }

function CreationCookie(nom,valeur,permanent)
    {
    if(permanent)
        {
        dateExp = new Date(2020,11,11);
        dateExp = dateExp.toGMTString();
        ifpermanent = '; expires=' + dateExp + ';';
        }
    else
        ifpermanent = '';
    document.cookie = nom + '=' + escape(valeur) + ifpermanent;
    }

function OuvrirPopup() {
    if(ScanCookie("dejapopupGuide")==0)
    {
        
       CreationCookie("dejapopupGuide","oui",false);
   
         Nom_Browser = navigator.appName;
        if ( Nom_Browser == "Microsoft Internet Explorer" )
        {
            option = 'resizable=no, location=no, width=700, height=300, menubar=no, status=no, scrollbars=no, menubar=no';
            window.open("","guideAudio",option);
            pop = document.createElement("form");
            pop.target="guideAudio"; 
            pop.method="POST"; 
            pop.id="pop";
            pop.action = "http://www.guide-du-travail.com/popupaudio.php";
            document.appendChild(pop);
            document.getElementById("pop").submit();
            window.focus();
            return void(0);
        }
        else
        {
        page = 'http://www.guide-du-travail.com/popupaudio.php';
        nom = 'guide-audio';
        option = 'resizable=no, location=no, width=700, height=300, menubar=no, status=no, scrollbars=no, menubar=no';
       window.open(page,nom,option);
        window.focus();
        }
     }
}
//==========================================    
//==========================================
// Favoris
//==========================================
function addFav() 
{ 
  if (document.all) 
  { 
  window.external.AddFavorite(location.href, document.title); 
  } 
  else 
  { 
  alert('Vous pouvez faire CTRL + D pour ajouter cette page dans vos signets, ou favoris.') 
  } 
} 

//==========================================
// Show/hide toggle
//==========================================

function toggleview(id)
{
	if ( ! id ) return;
	
	if ( itm = my_getbyid(id) )
	{
		if (itm.style.display == "none")
		{
			my_show_div(itm);
		}
		else
		{
			my_hide_div(itm);
		}
	}
}

//==========================================
// Set DIV ID to hide
//==========================================

function my_hide_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "none";
}

//==========================================
// Set DIV ID to show
//==========================================

function my_show_div(itm)
{
	if ( ! itm ) return;
	
	itm.style.display = "";
}

function ShowHide(id1, id2)
{
	if (id1 != '') toggleview(id1);
	if (id2 != '') toggleview(id2);
}
//==========================================
// Get element by id
//==========================================

function my_getbyid(id)
{
	itm = null;
	
	if (document.getElementById)
	{
		itm = document.getElementById(id);
	}
	else if (document.all)
	{
		itm = document.all[id];
	}
	else if (document.layers)
	{
		itm = document.layers[id];
	}
	
	return itm;
}
//===========================================
// Affichage description
//===========================================
  
    var defaultStatus = "Guide du Travail";

   var xMousePos = 0; // Horizontal position of the mouse on the screen
    var yMousePos = 0; // Vertical position of the mouse on the screen
    var xMousePosMax = 0; // Width of the page
    var yMousePosMax = 0; // Height of the page

    var toolTip = null;
    var toolTipTimeout = null;

    function captureMousePosition(e) {
      if (document.all) {
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
      } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth + window.pageXOffset;
        yMousePosMax = window.innerHeight + window.pageYOffset;
      }

      toolTip.style.top = "" + (yMousePos + 10) + "px";
      toolTip.style.left = "" + (xMousePos + 10) + "px";
      window.status = " x:" + xMousePos + " y:" + yMousePos;
    }

    function clearTip() {
      if(toolTipTimeout != null) {
        clearTimeout(toolTipTimeout);
        toolTipTimeout = null;
      }
      toolTip.style.display = "none";
      while (toolTip.firstChild != null) toolTip.removeChild(toolTip.firstChild);
    }

    function setTip(texte) {
      toolTip.style.display = "block";
      while (toolTip.firstChild != null) toolTip.removeChild(toolTip.firstChild);
      toolTip.appendChild(document.createTextNode(texte));
    }

    function setHtmlTip(texte) {
      toolTip.style.display = "block";
      toolTip.innerHTML = texte;
    }

    function setDelayedTip(texte) {
      toolTipTimeout = setTimeout("toolTip.style.display = 'block';", 500);
      while (toolTip.firstChild != null) toolTip.removeChild(toolTip.firstChild);
      toolTip.appendChild(document.createTextNode(texte));
    }

    function init() {
      toolTip = document.getElementById("Tooltip");
      document.onmousemove = captureMousePosition;
    }
//============================
//verifcation mode de paiement
//============================
function verif_paiement_synthese(){
    if ((document.forms[0].elements[0].checked==false) && (document.forms[0].elements[1].checked==false)&& (document.forms[0].elements[2].checked==false))
    {
      alert("Veuillez choisir un mode de paiement!");
      return false;
    }
return true;
}
function verif_paiement_dossier(){
    if ((document.forms[1].elements[0].checked==false) && (document.forms[1].elements[1].checked==false)&& (document.forms[1].elements[2].checked==false))
    {
      alert("Veuillez choisir un mode de paiement!");
      return false;
    }
return true;
}
 
//========================== 
//Verification inscription
//==========================
function verif_inscription_cb(){
if(document.inscription.mail.value == "")  {
   alert("Veuillez entrer votre mail");
   document.inscription.mail.focus();
   return false;
  }
if(document.inscription.prenom.value == "")  {
   alert("Veuillez entrer votre pr�nom");
   document.inscription.prenom.focus();
   return false;
  }  
if(document.inscription.cp.value == "")  {
   alert("Veuillez entrer votre code postal");
   document.inscription.cp.focus();
   return false;
  }    
if(document.inscription.ville.value == "")  {
   alert("Veuillez entrer votre ville");
   document.inscription.ville.focus();
   return false;
  }      
}
//========================== 
//Verification facture
//==========================
function verif_inscription_facture(){
if(document.facture.mail.value == "")  {
   alert("Veuillez entrer votre mail");
   document.facture.mail.focus();
   return false;
  }
if(document.facture.prenom.value == "")  {
   alert("Veuillez entrer votre pr�nom");
   document.facture.prenom.focus();
   return false;
  }  
if(document.facture.cp.value == "")  {
   alert("Veuillez entrer votre code postal");
   document.facture.cp.focus();
   return false;
  }    
if(document.facture.ville.value == "")  {
   alert("Veuillez entrer votre ville");
   document.facture.ville.focus();
   return false;
  }   
if(document.facture.intitule_facture.value == "")  {
   alert("Veuillez entrer votre intitule facture");
   document.facture.intitule_facture.focus();
   return false;
  }  
if(document.facture.nom.value == "")  {
   alert("Veuillez entrer votre nom");
   document.facture.nom.focus();
   return false;
  }  
if(document.facture.adresse.value == "")  {
   alert("Veuillez entrer votre adresse");
   document.facture.adresse.focus();
   return false;
  }        
        
}

/*
function OuvrirPopup() {
    if(ScanCookie("dejapopupInfo")==0)
    {
       	
       CreationCookie("dejapopupInfo","oui",false);
   
	     Nom_Browser = navigator.appName;
	    if ( Nom_Browser == "Microsoft Internet Explorer" )
		{
			option = 'resizable=no, location=no, width=700, height=300, menubar=no, status=no, scrollbars=no, menubar=no';
			window.open("","guide-du-travailAudio",option);
		    pop = document.createElement("form");
		    pop.target="guide-du-travailAudio"; 
		    pop.method="POST"; 
		    pop.id="pop";
		    pop.action = "http://www.guide-du-travail.com/popupaudio.php";
		    document.appendChild(pop);
		    document.getElementById("pop").submit();
		    window.focus();
		    return void(0);
	    }
	    else
	    {
	    page = 'http://www.guide-du-travail.com/popupaudio.php';
    	nom = 'popupguide-du-travail';
    	option = 'resizable=no, location=no, width=700, height=300, menubar=no, status=no, scrollbars=no, menubar=no';
       window.open(page,nom,option);
	    window.focus();
	    }
     }
}
*/


function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=22; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}

