
var calendrierDisplay = 0;

function infoCalendrier(conn) {
	var obj = document.getElementById("calendrierBox") ;
	obj.innerHTML = conn.responseText ;
	
}

function hideC() {
	if (calendrierDisplay != 0) {
		document.getElementById("calendrierBox").style.display ="none" ;
		calendrierDisplay = 0 ;
	}
}

function hideCOut() {
	if (document.getElementById("calendrierBox").style.display == "block") {
		document.getElementById("calendrierBox").style.display = "none" ;
		calendrierDisplay = 0 ;
	}
}

function displayCalendrierClic(prmState) {
	if (calendrierDisplay == 0) {
		calendrierDisplay = 1 ;
	
		var obj = document.getElementById("calendrierBox") ;
		
		if (x > ((screen.width / 2))) obj.style.left = ( parseInt(x) - ( 155 + 20 ) ) + "px" ;											
		else obj.style.left = (parseInt(x)+ 20) + "px" ;
	
		if (isIE) var offsety = document.documentElement.scrollTop ;
		else var offsety = window.pageYOffset;
	
		if ((y - offsety) > ((screen.height / 2))) obj.style.top = (parseInt(y) - (200 + 25)) + "px" ; 	
		else obj.style.top = (parseInt(y) - 10) + "px" ;
	
		obj.style.width = "155px" ; 
		obj.style.height = "200px" ;
		
		obj.style.innerHTML = "&nbsp;"
		
		window.setTimeout("document.getElementById('" + obj.id + "').style.display = 'block';",50) ;
		// On cherche le mois affiché
		var mois_affiche = document.getElementsByName(prmState + "M")[0].value ;
		
		ajax = new Ajax() ;
		ajax.sendAndLoad("/ajax/info_calendrier.php?state=" + prmState + "&current_month=" + mois_affiche, "GET", infoCalendrier) ;
	}
	else {
		hideC() ;
	}
}


// Mise à jour du mois sélectionné dans le calendrier
function majMoisCalendrier(prmState, prmAction, prmMois, prmAnnee) {
	prmMois = parseInt(prmMois) ;
	prmAnnee = parseInt(prmAnnee) ;
	
	ajax = new Ajax() ;
	ajax.sendAndLoad("/ajax/info_calendrier.php?state=" + prmState + "&moisC=" + prmMois + "&anneeC=" + prmAnnee, "GET", infoMoisCalendrier) ;
}

function infoMoisCalendrier(conn) {
	var obj = document.getElementById("calendrierBox") ;
	obj.innerHTML = conn.responseText ;	
}
