document.observe('dom:loaded', function () {
	el = $('heure');
	if (el) {
		new PeriodicalExecuter(function(pe) {
			var today = new Date;
			
			var listejours = new Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
			var listemois = new Array("janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre");
					
			var jj = today.getDate();
			
			var hh = today.getHours();
			if (hh<10) hh = "0"+hh;
			
			var mm = today.getMinutes();
			if (mm<10) mm = "0"+mm;
			
			var ss = today.getSeconds();
			if (ss<10) ss = "0"+ss;
			
			var todaystr = (listejours[today.getDay()]+" "+jj+" "+listemois[today.getMonth()]+" "+(2000+parseInt(today.getYear())%100)+" - "+hh+"h"+mm);

			if ($('heure').innerHTML != todaystr) $('heure').innerHTML = todaystr;
		}, 1);
	}
});

function showResidence(id) {
	$('page').innerHTML = '<div align="center" style="padding-top: 50px;"><img src="images/loading.gif" alt="Chargement en cours..." /></div>';
	ahah('ajax.php?residence='+id, 'page')
}
function ahah(url, target, delay) {
  if (delay == undefined) {
    new Ajax.Updater($(target), url, {
        evalScripts: true
      }
    );
  } else {
    new Ajax.PeriodicalUpdater($(target), url, {
        evalScripts: true,
        frequency: (delay/1000)
      }
    );
  }
}
