///////////////////////////////////////
// Module d'évènements
// par Claude Deschênes
// 
// Scripts complémentaires
///////////////////////////////////////
// NOTE :
// la variable grlobale "mod_path" peut être utilisé pour désigné l'emplacement du module
///////////////////////////////////////

function funccal(year,month,day,nbyearmoins,nbyearplus,nbmonthmoins,nbmonthplus){
  getXhr();
  
  xhr.onreadystatechange = function(){
    if(xhr.readyState == 4 && xhr.status == 200){
		document.getElementById('calendar').innerHTML =  xhr.responseText;
		  
		// on met en service les nouveaux contrôles
		ajax_reload_script();
     }
   }

	if(nbyearmoins==true) { 
			year=year-1; 
	}
	if(nbyearplus==true) { 
			year=year+1; 
	}
	if(nbmonthmoins==true) { 
		if(month==1) { 
			month=12;
			year=year-1;
		}
		else month=month-1; 
	}
	if(nbmonthplus==true) { 
		if(month==12) { 
			month=1;
			year=year+1;
		}
		else month=month+1; 
	}
	
	var typeCal = document.getElementById('typeCal').value;
	envoi("inc.php","incUrl="+"modules/evenements/public/_calendar.php"+"&ajax=1&mod_var="+typeCal+"&"+"year="+year+"&month="+month+"&day="+day );

}


function eventInfo(year,month,day){
	// if typeCal is larger calendar use ajax request
	var typeCal = document.getElementById('typeCal').value;
	if (typeCal == 'cal') {
		getXhr();
	  
		xhr.onreadystatechange = function(){
		    if(xhr.readyState == 4 && xhr.status == 200){
		    	document.getElementById('evenement').innerHTML =  xhr.responseText;
		    }
		}
		envoi("inc.php","incUrl="+"modules/evenements/public/_event.php"+"&ajax=1&"+"year="+year+"&month="+month+"&day="+day );
	}
	else {
		getXhr();
		  
		xhr.onreadystatechange = function(){
		    if(xhr.readyState == 4 && xhr.status == 200){
		        Shadowbox.open({
		            content:    '<link href="text.css" rel="stylesheet" type="text/css" />'+xhr.responseText,
		            player:     "html",
		            title:      "",
		            height:     300,
		            width:      500
		        });
		    }
		}
		envoi("inc.php","incUrl="+"modules/evenements/public/_event.php"+"&ajax=1&"+"year="+year+"&month="+month+"&day="+day );
	}
}
