// JavaScript Document
function openCalendrier(id)
{
	var elem = document.getElementById(id);
	var Cwidth='280';
	var Cheight='220';
	var Cleft = (screen.availWidth -  Cwidth) / 2;
	var Ctop = (screen.availHeight -  Cheight) / 2;
	var Cdate = elem.value;
	window.open('http://www.cdlhem.ch/admin/calendrier/calendrier.php?date='+Cdate+'&id='+id,'nom_popup','menubar=no, status=no, scrollbars=no, menubar=no, width='+Cwidth+', height='+Cheight+', top='+Ctop+', left='+Cleft);
}

function fermer(date, id)
{
	if(date!='')
		window.opener.document.getElementById(id).value = date;
	this.close();
}

function bgColorise(elem, couleur)
{
	elem.style.backgroundColor = couleur;
}

function clic(elem, id, mois, annee)
{
//	document.getElementById("addComment").innerHTML = "*"+trim(elem.innerHTML)+"*";
	if(trim(elem.innerHTML)!='&nbsp;')
	{
		date = trim(elem.innerHTML)+" "+mois+" "+annee;
		fermer(date, id);
	}
}

function trim (myString)
{
	return myString.replace(/^\s+/g,'').replace(/\s+$/g,'')
}