function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var chemin_http='http://www.cacd.fr/';


////////////////////////////////////////////////////////////////////////////////// FONCTION AJAX

function file(fichier,datax)  {
	//var x=1;
	//alert(datax);
	//data=datax;
	//while(datax.indexOf('à')>0) {
		datax=datax.replace('à','*-a-*');
	//}
	//if(datax.indexOf('valeur')>0) alert(datax);
	//datax=datax.replace('ù','-u*');
     if(window.XMLHttpRequest) { // FIREFOX
          xhr_object = new XMLHttpRequest(); 
	 } else if(window.ActiveXObject) {// IE
         // xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		   try {
				xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try {
					xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e) {}
			}
	 } else  {
          return(false);
	 }
	 
     xhr_object.open("POST", fichier, false); 
	 
	 //xhr_object.onprogress=function() { MM_findObj("debug").innerHTML+=" - "+x; x++ }
	 
	 //xhr_object.onload=function() { MM_findObj("debug").innerHTML=x; }
	 
	 xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-1");
	 
     xhr_object.send(datax); 
	 
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
}

///////////////

function affiche_graph(graph) {
	
	MM_findObj('tableau_graph').innerHTML = file(chemin_http+'corporatesolutions/'+graph+'_tableau.php','') ;
	
}

function update_graph(graph,id,type,valeur) {
	
	//alert(graph);
	
	var contenu=file(chemin_http+'corporatesolutions/'+graph+'.php','id='+id+'&type='+type+'&valeur='+valeur) ; //,'id=-1'+liste_supprimer+'&type='+mon_type);
	//alert(contenu);
	MM_findObj('graph_resultats').src=chemin_http+contenu;
	
	//if(id==0) {
	//	setTimeout("affiche_graph('"+graph+"')",1) ;
	
	MM_findObj('tableau_graph').innerHTML = file(chemin_http+'corporatesolutions/'+graph+'_tableau.php','toto=1') ;
	//}
}