//Permet d'ecrire dans un DIV (localisé par son ID) la valeur de "texte"
function writeDiv(texte, iddiv)  {
	document.getElementById(iddiv).innerHTML = texte;
}

function writeUpfiles(modif, integ, menu_type) {
	document.getElementById('warning').innerHTML = document.getElementById('warning').innerHTML + '<img src="images/p-warning.png">'+modif+', <a href="upfiles.php?menu_type='+menu_type+'">'+integ+'.</a><img src="images/p-warning.png">';
}

function writeDirNotExists(lib) {
	document.getElementById('warning').innerHTML = document.getElementById('warning').innerHTML + '<img src="images/p-warning.png"> '+lib+' <img src="images/p-warning.png">';
}

function writeException(lib) {
	document.getElementById('warning').innerHTML = document.getElementById('warning').innerHTML + lib;
}

function ouvrir(page) {
	document.location = page;
}

function change_page(i){
	document.formulaire.numpage.value=i;
	document.formulaire.submit();
}

function imprimer(){
	window.print();
}

function getXhr(){
    var xhr = null; 
	if(window.XMLHttpRequest) {// Firefox et autres
		xhr = new XMLHttpRequest();
	} 
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else { // XMLHttpRequest non supporté par le navigateur 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
    return xhr;
}

//Node cleaner
function go(c){
	if(!c.data.replace(/\s/g,''))
		c.parentNode.removeChild(c);
}

function clean(d){
	var bal=d.getElementsByTagName('*');

	for(i=0;i<bal.length;i++){
		a=bal[i].previousSibling;
		if(a && a.nodeType==3)
			go(a);
		b=bal[i].nextSibling;
		if(b && b.nodeType==3)
			go(b);
	}
	return d;
} 

function get_hover(id){
	document.getElementById(id).style.backgroundColor = "#598fbc";
	document.getElementById(id).style.cursor = "pointer";
}
function get_nohover(id){
	document.getElementById(id).style.backgroundColor = "#7eadd7";
}
function change_orderby(id){
	document.formulaire._orderby.value=id;
	document.formulaire.submit();
}


