function color_cell(nom_cell,col){
	var elem;
    if(document.all){window.document.all(nom_cell).style.background= col;}
    else if (document.getElementById){
        elem=document.getElementById(nom_cell);
    	elem.style.background=col;
    }
}

function montre_calque(nom_calque){
    if(document.all){eval('document.all.'+nom_calque).style.visibility='visible';}                     //Internet Explorer
    else if (document.layers){eval('document.'+nom_calque).visibility='show';}                         //Netscape 4.5 et 4.7
    else if (document.getElementById){document.getElementById(nom_calque).style.visibility='visible';} //Netscape 6
}

 function cache_calque(nom_calque){
    if(document.all){eval('document.all.'+nom_calque).style.visibility='hidden';}                     //Internet Explorer
    else if (document.layers){eval('document.'+nom_calque).visibility='hidden';}                      //Netscape 4.5 et 4.7
    else if (document.getElementById){document.getElementById(nom_calque).style.visibility='hidden';} //Netscape 6
}

function montre(id) {
	if (document.getElementById) {
		document.getElementById(id).style.visibility="visible";
	}
	else if (document.all) {
		document.all[id].style.visibility="visible";
	} 
	else if (document.layers) {
		document.layers[id].visibility="visible";
	} 
}

function cache(id) {
	if (document.getElementById) {
		document.getElementById(id).style.visibility="hidden";
	} 
	else if (document.all) {
		document.all[id].style.visibility="hidden";
	} 
	else if (document.layers) {
		document.layers[id].visibility="hidden";
	} 
}

function getsize(){
 	var taille;
 	if (navigator.appName=="Microsoft Internet Explorer"){taille=document.body.clientWidth;}
	else if (navigator.appName=="Netscape"||navigator.appName=="Opera"){taille=window.innerWidth;}
	var url;
	url="index1.php?taille="+(taille)+"&page=<?=$page?>&langue=<?=$langue?>&fam_id=<?=$fam_id?>&sousFamilleChoisie=<?=$sousFamilleChoisie?>";
	window.parent.location=url;
}

function trim(inputString) 
{
	if (typeof inputString != "string") { return inputString; }
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	while (ch == " ") { // Check for spaces at the beginning of the string
		retValue = retValue.substring(1, retValue.length);
		ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);
	while (ch == " ") { // Check for spaces at the end of the string
		retValue = retValue.substring(0, retValue.length-1);
		ch = retValue.substring(retValue.length-1, retValue.length);
	}
	while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
		retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	}
	return retValue; // Return the trimmed string back to the user
}

function ouvreFenetre(mypage,myname,w,h,scroll,pos){
	if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
}

//Confirmation d'une action
function confirmation(url,endmsg) {
res = confirm(endmsg);
if(res) document.location.href = url;
}

function surbrillanceON(ligne, classe){
		ligne.className = classe;
}

function surbrillanceOFF(ligne, classe){
	ligne.className = classe;
}

