
function hexa(i){
	i=i%16
	switch (i){
		case 10:return 'A';
		case 11:return 'B';
		case 12:return 'C';
		case 13:return 'D';
		case 14:return 'E';
		case 15:return 'F';
		default : return i;
	}
}
function couleur(i,j){

	r=parseInt(8+Math.sin(i/8+0 +j)*8)
	g=parseInt(8+Math.sin(i/8+2 +j)*8)
	b=parseInt(8+Math.sin(i/8+4+j)*8)

	s='#'+hexa(r)+'F'+hexa(g)+'F'+hexa(b)+'F'
	//alert(s)
	return s;
}
function ecrireCouleur(s,taille){
	for(i=0;i<s.length;i++){
		t=s.substr(i,1)
		if(t==" ")t="&nbsp;"
		document.write("<font color="+couleur(i,taille)+" size="+taille+"> " + t + "</font>");
	}
}
function ecrireCouleurNiveau(niveau){

	document.write("<table bordercolordark=#DDffAA bordercolorlight=#DDffFF border=0 cellspacing=0><tr >")
	document.write("<td width=20 bgcolor=white ess=1>"+niveau+"</td>")
	for(i=0;i<10;i++){
		document.write("<td bgcolor="+couleur(i,niveau+5)+" ess=1>&nbsp;</td>");
	}
	document.write("</table>")
	
}

/**
*Gestion de tableaux
*/
function tableauDebut(titre){
	document.write('<table bgcolor="#F5FFFF" border="5" cellspacing="0" bordercolordark="#DDDDff" bordercolorlight="#DDDDff" width="100%">')
	document.write('<tr>')
	document.write('<td bgcolor="#333388"><center>')
	ecrireCouleur(titre,5)
	document.write('</center></td>')
    document.write('</tr>')
    document.write('<tr> ')
    document.write('<td bordercolor="#333333">')
}
function tableauFin(){
	document.write('</td>')
	document.write('</tr>')
	document.write('</table>')
}

//récupéré dans Easy PHP ... merci bien
/* $Id: functions.js,v 1.21 2002/04/21 11:48:34 loic1 Exp $ */

/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object   the table row
 * @param   string   the action calling this script (over, out or click)
 * @param   string   the default background color
 * @param   string   the color to use for mouseover
 * @param   string   the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()) {
        if (theAction == 'out') {
			//newColor = currentColor;
            newColor = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor = theMarkColor;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor = (thePointerColor != '')
                     ? thePointerColor
                     : theDefaultColor;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
				//--ajout
				if(theCells[c].ess!=1){
	                theCells[c].setAttribute('bgcolor', newColor, 0);
				}
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
				//--ajout
				if(theCells[c].ess!=1){
	                theCells[c].style.backgroundColor = newColor;
				}
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


