
var id_calendrier = "calendrier_container";

/**
 * Retourne la position left
 * @param el : objet
 * @return
 */
function calendrierGetLeft(el)
{
	var tmp = el.offsetLeft;
	el = el.offsetParent
	while(el)
	{
		tmp += el.offsetLeft;
		el = el.offsetParent;
	}
	return tmp;
}

/**
 * Retourne la position top
 * @param el : objet
 * @return
 */
function calendrierGetTop(el)
{
	var tmp = el.offsetTop;
	el = el.offsetParent
	while(el)
	{
		tmp += el.offsetTop;
		el = el.offsetParent;
	}
	return tmp;
}

/**
 * On affiche le calendrier
 * @param t : objet
 * @return
 */
function calendrierAffiche(t)
{
	var cal = document.getElementById(id_calendrier);
	
	// on affiche le calendrier
	cal.style.display = '';	
	// on le place
	var the_left 	= calendrierGetLeft(t);
	var the_top 	= calendrierGetTop(t) + t.offsetHeight;
	cal.style.left = the_left + 'px';
	cal.style.top = the_top + 'px';
	// Scroll it into view.
	cal.scrollIntoView();
}


