var idSite=2;

var manualSubmit = false;

function loadStatsMenu(type){
	getReunion_date();
	getCourse_reu();
	testAffCourse();
	waitReloadDisplay();
	
	if (manualSubmit)
	{
	   show('loading');
	   valid(type);
	   waitReloadDisplay();
	   manualSubmit = false;
	}
}
function getReunion_date(){
	var date=getE('date').value;
	var date=getE('date').value;
	var type_stat=getE('type_course');
	var stat=type_stat.options[type_stat.selectedIndex].value;
	
	select = file('/sites/module/phpPourAjax/getReu_date.php?date_r='+date+'&type='+stat); //alert(select);
	writediv(select,"listReu");
	
}
function getCourse_reu(){
	var reu=getE('select_reu');
	var id_r=reu.options[reu.selectedIndex].value;
	var type_stat=getE('type_course');
	var stat=type_stat.options[type_stat.selectedIndex].value;
	
	if(id_r!='all'){ 
		select = file('/sites/module/phpPourAjax/getCourse_reu.php?id_r='+id_r+'&type='+stat);
		writediv(select,"listCourse");
	}else {
		writediv("","listCourse");
	}
	
}
function valid(type){
	var type_stat=getE('type_stat');
	var stat=type_stat.options[type_stat.selectedIndex].value;
	
	var date=getE('date').value;
	
	var reu=getE('select_reu');
	var id_r=reu.options[reu.selectedIndex].value;
	
	if(id_r!='all'){
		var course=getE('select_course');
		var id_c=course.options[course.selectedIndex].value;
	}
	
	select = fileL('/sites/module/phpPourAjax/affStats.php?date='+date+'&stat='+stat+'&reu='+id_r+'&id_c='+id_c+'&type='+type+'&idSite='+idSite,"stats");

    
}
function valid2(type,date,stat,id_r,id_c,idSite){
	select = fileL('/sites/module/phpPourAjax/affStats.php?date='+date+'&stat='+stat+'&reu='+id_r+'&id_c='+id_c+'&type='+type+'&idSite='+idSite,"stats");
    
}
function testAffCourse(){
	var type_stat=getE('type_stat');
	var stat=type_stat.options[type_stat.selectedIndex].value;
	if(stat=='reu_g' || stat=='reu_p'){
		hide('listCourse');
		var course=getE('select_course');
		course.selectedIndex=0;
	}else{
		show('listCourse');
	}
}

    
    
