function reco(lien) {
	window.open('http://www.dinosauriens.info/reco.php?lien='+lien,'reco','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=530,height=500,left=100,top=100');
}
function mail(sujet,corps) {
	window.open("http://www.dinosauriens.info/savoir/contact.php?sujetm="+sujet+"&corpsm="+corps+"",'popmail','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=445,height=510,left=100,top=100');
}
if (parent.frames.length > 2)	window.top.location.href = location.href;

function montre(id) {
	for (var i = 1; i<5; i++) {
		document.getElementById('smenu'+i).style.display = 'none';
		if (document.getElementById('tmenu'+i).style.zIndex != '50') {
			document.getElementById('tmenu'+i).style.backgroundColor='transparent';
			document.getElementById('tmenu'+i).style.zIndex = '40';
		}
	}
	if (id != '') {
		var d = document.getElementById('smenu'+id);
		var t = document.getElementById('tmenu'+id);
		d.style.display = 'block';
		t.style.backgroundColor = '#0070c0';
	}
}

function switch_com(bouton) {
	if (bouton.value == "afficher") {
		document.getElementById('comment').style.display = "block";
		bouton.value = "masquer";
	}
	else {
		document.getElementById('comment').style.display = "none";
		bouton.value="afficher";
	}
}

// JavaScript Document
 function creationXHR() {
   var resultat=null;
   try {//test pour les navigateurs : Mozilla, Opéra, ...
	    resultat= new XMLHttpRequest();
     } 
     catch (Error) {
     try {//test pour les navigateurs Internet Explorer > 5.0
     resultat= new ActiveXObject("Msxml2.XMLHTTP");
     }
     catch (Error) {
         try {//test pour le navigateur Internet Explorer 5.0
         resultat= new ActiveXObject("Microsoft.XMLHTTP");
         }
         catch (Error) {
            resultat= null;
         }
     }
  }
return resultat;
}
//------------Fonctions de gestion du DOM (solution alternative à innerHTML)
function remplacerContenu(id, texte) {
  var element = document.getElementById(id);
  if (element != null) {
    supprimerContenu(element);
    var nouveauContenu = document.createTextNode(texte);
    element.appendChild(nouveauContenu);
  }
}

function supprimerContenu(element) {
if (element != null) {
    while(element.firstChild)
        element.removeChild(element.firstChild);
   }
}
//--------------Fonctions encodage
//code en UTF8, la valeur d'un élément dont id passé en parametre
function codeContenu(id) { 
	var valeur=document.getElementById(id).value;
	return encodeURIComponent(valeur);
}

function compte(lien) {
	objetXHR = creationXHR();
  objetXHR.open("get","http://www.dinosauriens.info/scripts/compteur.php?lien="+lien, false);
	objetXHR.onreadystatechange = null;
	objetXHR.send(null);
}
