/*
 *	Preparation du tableau des dates
 */
var SPECIAL_DAYS={
    1: [
             3         ,              1                
      ]
      ,    0: [
             1         ,              1                
      ]
      };
/*
 *	Preparation du tableau des dates
 */
var SPECIAL_INFOS={
	1: [
        	40        ,        	42             
    ]
    ,	0: [
        	41             
    ]
    };

function dateIsSpecial(year,month, day)
{
  var m= SPECIAL_DAYS[month];
  if (!m) return false;
  for (var i in m)
  {
  	if (m[i]== day) return true;
  }
  return false;
}
function dateInfos(year,month, day)
{
  var infos="-1";
  var m= SPECIAL_DAYS[month];
  var mi= SPECIAL_INFOS[month];
  if (!m) return false;
  for (var i in m)
  {
    if (m[i]== day)
    {
        infos= mi[i];
    
        return infos; 
    }
  }
  
  return infos;
}
function dateChanged(calendar)
{
	if(calendar.dateClicked)
	{
	    load_evenement(calendar)
	}
}
function load_evenement(calendar)
{
    var y=calendar.date.getFullYear();
    var m=calendar.date.getMonth();
    var d=calendar.date.getDate();
    var id_evenement=dateInfos(y,m,d);
   	var adresse="/agenda/fiche/id/"+ id_evenement;
   	new Ajax.Updater('fiche',adresse, {
   	asynchronous:true,
   	evalScripts:true,
   	onLoading: function()
   			   {
   			   	$('indicator').style.display = 'block';
   			   	$('fiche').style.display = 'none';
   			   },
    onComplete: function()
   			   {
   			   	$('indicator').style.display = 'none';
   			   	$('fiche').style.display = 'block';
   			   }
   	})
}
function ourDateStatusFunc(date, y, m, d)
{
    if (dateIsSpecial(y, m, d)) return "special";
    else return true;
}
function pop_up(id_evenement,chemin_evenement)
{
   // alert("pop up sur "+ id_evenement +", chemin" + chemin_evenement);
    url="calendrier/popup?id=" + id_evenement +"&chemin="+ chemin_evenement;
    window.open(url,"zoom","width=400px, height=400px,status=no,scrollbars=yes,resizable=yes,titlebar=no");
}