function addslashes(ch) {
ch = ch.replace(/\\/g,"\\\\")
ch = ch.replace(/\'/g,"\\'")
ch = ch.replace(/\"/g,"\\\"")
return ch
}

function new_xhr(){
	var xhr_object = null;
	if(window.XMLHttpRequest)
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject){
	   try {
                xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
            }
	}
	else {
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   xhr_object = false;
	}
	return xhr_object;
}

function load_page(select,param,value,layer,param2,param3,add) {
	var xhr2 = new_xhr();
	xhr2.onreadystatechange = function(){
		if ( xhr2.readyState == 4 ){
			if(xhr2.status  != 200){
				document.getElementById(layer).innerHTML ="Error code " + xhr2.status;
			} else {
				document.getElementById(layer).innerHTML = xhr2.responseText;
				$("a#inline").fancybox({'hideOnContentClick': true, 'transitionIn': 'elastic', 'transitionOut': 'elastic'});
				if ( param2 != 0 ) { $("a#inline").fancybox().trigger('click'); }
			}
		} else {
			document.getElementById(layer).innerHTML = "<img src='img/indicator.white.gif' alt=''/>";
		}
	}
	
	xhr2.open("POST", "tools/"+select+".php", true);
	xhr2.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xhr2.send("param=" + param + "&value=" + value+ "&param2=" + param2+ "&param3=" + param3+ "&add=" + add);
	
}

