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 = 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++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function


function fOPenFicheAnnonce( id  ){
	sUrl = "fileadmin/lib/viewAdd.php?id="+id ;
	
	param = "width=700,height=600,scrollbars=yes,resizable=yes,status=no,toolbar=no";
	
	var w = window.open( sUrl , "view_"+id , param )
}


/*===================================
 AUTRES FONCTIONS DE CONTROLE JAVASCRIPT
======================================
*/


//Fonction d'alternace RDC/etage (on ne peut pas cocher la case RDC e laisser le champ etage non vide
function alterChkTxt( frm , obj1, obj2 ){

	var f = eval( "document."+frm);
	var o1 = eval( "f." + obj1 );//la radio ou checkbox 
	var o2 = eval( "f." + obj2 );//le select
	
	if( o1.checked && o2.value != "" ){
		//alert( "Vous ne pouvez pas cocher la case RDC et préciser simultanément un étage!" )
		return false
	}
	return true
}


//Controle si le parc d'activité est sélectionné lorsque le radio parc activite est coché
function fCheckParc( frm , obj1, obj2 ){
	
	
	var f = eval( "document."+frm);
	
	var o1 = eval( "f." + obj1 );//la radio
	var o2 = eval( "f." + obj2 );//le select
	
	
	return true
}


/*
Controle des boutons radios (la fonction generique ne semble fonctionner qu'avec des mono-radios)
*/
function fCheckRadio( frmName, objName ){

	var f = eval( "document."+frmName);
	var o1 = eval( "f." + objName );//la radio
	var ok = false;

	if ( o1.length > 1 ){
		for( i=0;i<o1.length;i++){
			if( o1[ i ].checked == true ){
				ok = true
				break
			}
		}
	}else{
		if( o1.checked == true ) ok = true
	}
	
	return ok;
}

function fTestExtension( frmName , fldName , extList ){
			var tExt = extList.split( "," ) ;
			var fichier = eval( "document." + frmName + "." + fldName + ".value" ) 
			var tmpext = fichier.split( "." )
			var ext = tmpext[ tmpext.length - 1 ]
			
			if( fichier == "" ) return true ;
			if( extList == "" ) {
				alert( "La liste des extensions de test ne peut être vide" )
				return false
			}
			var bExtOk = false
			
			for( i = 0 ; i < tExt.length ; i++ ){
				if( ext.toUpperCase() == tExt[ i ].toUpperCase() ){
					bExtOk = true
					break
				}
			}
			
			if( !bExtOk ){
				alert( "L'extension du fichier est invalide. Seuls les extensions "+extList+" sont autorisées." )
				return false
			}
			
			return true
		}

