// Fonction pour afficher et
// effacer une "layer"
function Aff_layer (id) {
  if (document.layers)
	document[id].visibility = 'show';
  else if (document.getElementById)
	document.getElementById(id).style.visibility = 'visible';
	else if (document.all)
	document.all[id].style.visibility = 'visible';
}
function Cache_layer (id) {
  if (document.layers)
	document[id].visibility = 'hide';
	else if (document.getElementById)
	document.getElementById(id).style.visibility = 'hidden';
  else if (document.all)
	document.all[id].style.visibility = 'hidden';
}

// GENERER UN MOT DE PASSE
function password(nom_formulaire, nom_champ, taille)
{
	var chaine;
	var longueur;
	var wpas = "";
	
	chaine = "aAzBPerCtyDQ2uiRE3p4SqFs5TdGf6ghUH7jkVJ8Wm9XwKxYcvZLbnM";
	longueur = chaine.length;
	
	for(i=0;i<taille;i++)
	{
		wpos=Math.round(Math.random()*longueur);
	  wpas+=chaine.substring(wpos,wpos+1);
	}
	document.forms[nom_formulaire].elements[nom_champ].value=wpas;
}

// Liens externes --------------------------------------------------------------


function openWin(URL){
	window.open(URL,'detail', "height=500, width=500, scrollbars=yes, resizable=yes");
}

function openSite(strLocationURL) {
  var siteWindow = null;
  siteWindow = window.open(strLocationURL);
}

/*
function checkExternalLinks() {
  var objLinks = document.getElementsByTagName("a");
  for (i=0; i < objLinks.length; i++) {
    if (objLinks[i].href.length > 0) {
      if (objLinks[i].href.indexOf(document.domain) == -1 && objLinks[i].href.indexOf("javascript:") == -1 && objLinks[i].href.indexOf("mailto:") == -1) {
      objLinks[i].href = "javascript: openSite('" + objLinks[i].href + "');";
      }
    }
  }
}

try {
  window.addEventListener("load", checkExternalLinks, true);
}
catch(ex) {
  window.attachEvent("onload", checkExternalLinks);
}
*/

// Afficher/Masquer ------------------------------------------------------------

function Afficher() {
	var Obj;
  Obj = document.getElementById('transparence');
  if( Obj){
  
  	var yScroll;
		if (window.innerHeight && window.scrollMaxY) {	
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ 
			yScroll = document.body.scrollHeight;
		} else { 
			yScroll = document.body.offsetHeight;
		}

		var windowHeight;
		if (self.innerHeight) {	
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { 
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { 
			windowHeight = document.body.clientHeight;
		}
    
    Obj.style.height = ((yScroll < windowHeight) ? windowHeight : yScroll)  + 'px';  
    
    with( Obj.style){
      display="block";
			var selects = document.getElementsByTagName('select');
  		for(var i = 0; i < selects.length; i++) {
  			selects[i].style.visibility = 'hidden';
  		}
    }
  }
}

function Masquer() {
	var Obj;
	var Obj2;
  Obj = document.getElementById('transparence');
  Obj2 = document.getElementById('masque');
  if( Obj){
    with(Obj.style){
      display="none";
			var selects = document.getElementsByTagName('select');
  		for(var i = 0; i < selects.length; i++) {
  			selects[i].style.visibility = 'visible';
  		}
  		Obj2.style.display = "block";
    }
  }
}

function Oubli() {
	var Obj;
  Obj = document.getElementById('masque');
  if( Obj){
    with( Obj.style){
      display="none";
    }
  }
}

// CSS Browser Selector --------------------------------------------------------

var css_browser_selector = function() {
  var ua=navigator.userAgent.toLowerCase(),is=function(t){
    return ua.indexOf(t) != -1;
  },
  h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;
}();
