function affCalendar(chps)
{
	urlCalendar = "";
	document.getElementById("calendardu").style.visibility = 'hidden';
	document.getElementById("calendardu").innerHTML = "";
	document.getElementById("calendarau").style.visibility = 'hidden';
	document.getElementById("calendarau").innerHTML = "";
	if(document.getElementById("du"))
	{
		if(document.getElementById("du").value != " jj/mm/aaaa" && document.getElementById("du").value != "")
		{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps+"&dateLimite="+document.getElementById("du").value;
		}else{
			urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
		}
	}else{
		urlCalendar = "/_includes/asp/calendar.asp?chps="+chps;
	}
	//alert(urlCalendar);
	loadPage(urlCalendar,'calendar'+chps);
}

function select_date(dat,cible){
	document.getElementById(cible).value=dat;
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function closeCalendar(cible)
{
	document.getElementById("calendar"+cible).style.visibility = 'hidden';
	document.getElementById("calendar"+cible).innerHTML = "";
}

function validFormCalendar(chps)
{
	loadPage("/_includes/asp/calendar.asp?chps="+chps+"&START_MONTH="+document.getElementById("START_MONTH").options[document.getElementById("START_MONTH").selectedIndex].value+"&START_YEAR="+document.getElementById("START_YEAR").options[document.getElementById("START_YEAR").selectedIndex].value,"calendar"+chps);
}

function loadPage(url,cible)
{
	//Changement du contenu
	var xhr_object = null; 
	document.getElementById(cible).innerHTML = '<div style="width: 160px; height:140px; margin: 0px;"><img src="/img-sarthe-tourisme/loading.gif" hspace="64" vspace="54"></div>';
	document.getElementById(cible).style.visibility = 'visible';
	//document.getElementById(cible).innerHTML = "";
 
	if(window.XMLHttpRequest) // Firefox 
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   return; 
	} 
 
	xhr_object.open("GET", url, true);
	
	xhr_object.onreadystatechange = function() 
	{ 
	   if(xhr_object.readyState == 4)
	   {
	   		document.getElementById(cible).innerHTML = xhr_object.responseText;
			document.getElementById(cible).style.visibility = 'visible';
		}
	} 
	 
	xhr_object.send(null); 
}

function selectAllCrit(checkSource,nbDeb,nbFin)
{
	if(checkSource.checked)
	{
		action = true;
	}else{
		action = false;
	}
	
	for(i=nbDeb;i<=nbFin;i++)
	{
		document.getElementById("critere"+i).checked = action;
	}
}