
// Fonctions pour le support

function afficheQuestion(id_rubrique) {
	if(texte = file('../liste_question_reponse.php?id_rubrique='+id_rubrique)) {
		writediv(texte);				
	}
}


function file(fichier,id_rubrique) {
     
		 if(window.XMLHttpRequest) // FIREFOX
          xhr_object = new XMLHttpRequest(); 
     else if(window.ActiveXObject) // IE
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
     else 
          return(false); 
 

		 xhr_object.open("GET", fichier, false); 
     xhr_object.send(null); 
		 
		 if(xhr_object.readyState == 4) { 
			 return(xhr_object.responseText);
		 }
		 else {
		 	 return(false);
     }

}

	 
		 
function writediv(texte) {
	effacerdivReponse();
	
	document.getElementById('liste_question').innerHTML = texte;
}


function writedivReponse(texte_reponse) {
	texte = texte_reponse + "<br />";
	
	// on efface les questions
	document.getElementById('liste_question').innerHTML = "";
	
	// on fait apparatire la réponse
	document.getElementById('reponse').innerHTML = createSmallBox ("100%",texte);
}


function effacerdivReponse() {
	document.getElementById('reponse').innerHTML = "";
}



function createSmallBox (largeur,texte) {
	html = '';
	html = html + '<br />';
	html = html + '<table border="0" cellpadding="0" cellspacing="0" align="center">';
	html = html + '<tr>';
	html = html + '<td width="15" height="15"><img src="picts/boxlt.gif" alt="" width="15" height="15" border="0"></td>';
	html = html + '<td background="picts/boxbh.gif"><img src="picts/blk.gif" alt="" width="1" height="1" border="0"></td>';
	html = html + '<td width="15"><img src="picts/boxrt.gif" alt="" width="15" height="15" border="0"></td>';
	html = html + '</tr>';
	
	html = html + '<tr>';
	html = html + '<td style="border-left: 1px solid #f47e30;" class="boxcontent"><img src="picts/boxb.gif" alt="" width="1" height="86" border="0"></td>';
	html = html + '<td width="' + largeur + '" class="boxcontent" valign="top">';
	html = html + '<span class="texte-formule">';
	html = html + texte;
	html = html + '</span>';
	html = html + '</td>';
	html = html + '<td style="border-right: 1px solid #f47e30;" class="boxcontent"><img src="picts/boxb.gif" alt="" width="1" height="86" border="0"></td>';
	html = html + '</tr>';
	
	html = html + '<tr>';
	html = html + '<td height="15"><img src="picts/boxlb.gif" alt="" width="15" height="18" border="0"></td>';
	html = html + '<td background="picts/boxbb.gif"><img src="picts/blk.gif" alt="" width="1" height="1" border="0"></td>';
	html = html + '<td><img src="picts/boxrb.gif" alt="" width="15" height="18" border="0"></td>';
	html = html + '</tr>';
	html = html + '</table>';
	html = html + '<br />';
	
	return html;
}

