

var newWin = null;
function closeWin(){
	if (newWin != null){
		if(!newWin.closed)
			newWin.close();
	}
}


function Write_Object_no(URL,width,height)
{
	document.write('<center>');
	document.write('<embed src="' + URL + document.location.search + '" quality="high"');
	document.write('bgcolor="#ffffff" wmode="transparent" width="' + width + '" height="' + height + '" ');
	document.write('name="flash_fr" align="middle" wmode="window" ');
	document.write('allowScriptAccess="sameDomain" allowFullScreen="false" ');
	document.write('type="application/x-shockwave-flash" ');
	document.write('pluginspage="http://www.adobe.com/go/getflashplayer_fr" />');
	document.write('</center>');
}


function popup(strURL,strType,strHeight,strWidth) 
{
	closeWin();
	var strOptions="";
	if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth;
	if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth;
	if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
	if (strType=="scroll") strOptions="status,height="+strHeight+",width="+strWidth+",scrollbars";
	newWin = window.open(strURL, 'newWin', strOptions);
	newWin.focus();
}



function tableau(mois,annee)
{

   var url = '/ajax/ajax_calendrier.php';
   var parametres = 'mois=' + mois + '&annee=' + annee;


		var myAjax = new Ajax.Request(
			url,
			{
				method: 'post',
				parameters: parametres,
				onComplete: remplirCalendrier
			}
		);


}
function remplirCalendrier(reponsejson) {
       //on utilise la fonction evalJSON de prototype pour parser la réponse JSON
       var data=reponsejson.responseText.evalJSON();
      
       //On place les liens suivants,précédents et le mois en cours
       $('link_suivant').onclick=function(){eval(data.lien_suivant);};
       
       $('link_precedent').onclick=function(){eval(data.lien_precedent);};
       $('titre').innerHTML=data.mois_en_cours;
     
       var compteur=1;
       var id='';
      
       
       while(compteur<43){     
          id=compteur.toString();
          $(id).innerHTML=data.calendrier[(compteur-1)].fill;
          compteur++;
       }

}

