var colorBaseLigne = '#e8ecf3';
var colorOverLigne = '#d1ebba';
var colorSelectedLigne = '#ffffde';

function formatColor(color) {
	var d=document.createElement('div');
	d.style.backgroundColor = color;
	return d.style.backgroundColor;
}

var colorBaseFormatee = formatColor(colorBaseLigne);
var colorOverFormatee = formatColor(colorOverLigne);
var colorSelectedFormatee = formatColor(colorSelectedLigne);

        
function changeColorOver(idElement) {
	if (document.getElementById(idElement).style.backgroundColor == colorBaseFormatee) {
		document.getElementById(idElement).style.backgroundColor = colorOverLigne;
	}
}

function changeColorOut(idElement) {
	if (document.getElementById(idElement).style.backgroundColor == colorOverFormatee) {
		document.getElementById(idElement).style.backgroundColor = colorBaseLigne;
	} 
}

function swapColorLigne(idElement) {
	if (document.getElementById(idElement).style.backgroundColor == colorOverFormatee) {
		document.getElementById(idElement).style.backgroundColor = colorSelectedLigne;
	} else if (document.getElementById(idElement).style.backgroundColor == colorBaseFormatee) {
		document.getElementById(idElement).style.backgroundColor = colorSelectedLigne;
	} else {
		document.getElementById(idElement).style.backgroundColor = colorBaseLigne;
	}
}

function deselectColorLigne(idElement) {
	document.getElementById(idElement).style.backgroundColor = colorBaseLigne;
}

function selectColorLigne(idElement) {
	document.getElementById(idElement).style.backgroundColor = colorSelectedLigne;
}
