﻿<!--
// THE WEB OBJECTS TOOL LIBRARY 1.0 - POWERED BY THE-E-GHOST
// Script calendriers initialise par http://www.toutjavascript.com
// Conception par http://the-e-ghost.com - Septembre 2006
// Reproduction gratuite a condition de laisser ce commentaire

// *******************************************************************************************************************************
// BIBLIOTHEQUE DES FUNCTIONS GENERIQUES *****************************************************************************************
// Ecriture dans le document
function d(content) {
	window.document.write(content);
}
// Ecriture dans un calque
function displayTarget(content,target) {
    document.getElementById(target).innerHTML			= content;
}
// Assignation d'une valeur a un element
function valueTarget(value,target) {
    document.getElementById(target).value				= value;
}
// Assignation visibilite heritee a un element
function showTarget(target) {
	document.getElementById(target).style.visibility 	= '';
}
// Assignation visibilite hidden a un element
function hideTarget(target) {
	document.getElementById(target).style.visibility 	= 'hidden';
}
// Positionnement horizontal d'un calque
function leftTarget(target,value) {
	document.getElementById(target).style.left = value;
}
// Positionnement vertical d'un calque
function topTarget(target,value) {
	document.getElementById(target).style.top = value;
}
// Assignation d'une largeur a un calque
function widthTarget(target,value) {
	document.getElementById(target).style.width = value;
}
// Assignation d'une hauteur a un calque
function heightTarget(target,value) {
	document.getElementById(target).style.height = value;
}
// Positionnement vertical d'un calque avec scroll
function topTargetWithScroll(target,value) {
	dimTop 		= getTop(target);
	deltaTop	= (dimTop - value)/scrollAcc;
	if (Math.abs(deltaTop) < 1) {
		topTarget(target,value);
	} else {
		topTarget(target,dimTop-deltaTop); 
		setTimeout('topTargetWithScroll(\''+target+'\','+value+')',timerPas);
	}
}
// Positionnement horizontal d'un calque avec scroll
function leftTargetWithScroll(target,value) {
	dimLeft		= getLeft(target);
	deltaLeft	= (dimLeft - value)/scrollAcc;
	if (Math.abs(deltaLeft) < 1) {
		leftTarget(target,value);
	} else {
		leftTarget(target,dimLeft-deltaLeft); 
		setTimeout('leftTargetWithScroll(\''+target+'\','+value+')',timerPas);
	}
}
// Asignation d'une largeur de calque avec scroll
function widthTargetWithScroll(target,value) {
	dimWidth	= getWidth(target);
	deltaWidth	= (dimWidth - value)/scrollAcc;
	if (Math.abs(deltaWidth) < 1) {
		widthTarget(target,value);
	} else {
		widthTarget(target,dimWidth-deltaWidth); 
		setTimeout('widthTargetWithScroll(\''+target+'\','+value+')',timerPas);
	}
}
// Assignation d'une hauteur de calque avec scroll
function heightTargetWithScroll(target,value) {
	dimHeight	= getHeight(target);
	deltaHeight	= (dimHeight - value)/scrollAcc;
	if (Math.abs(deltaHeight) < 1) {
		heightTarget(target,value);
	} else {
		heightTarget(target,dimHeight-deltaHeight); 
		setTimeout('heightTargetWithScroll(\''+target+'\','+value+')',timerPas);
	}
}
// Redimensionnement H, L, X, Y d'un calque avec scroll
function resizeAllWithScroll(target,topValue,leftValue,widthValue,heightValue) {
	dimTop		= getTop(target);
	dimLeft 	= getLeft(target);
	dimWidth 	= getWidth(target);
	dimHeight 	= getHeight(target);
	deltaTop	= (dimTop - topValue)/scrollAcc;
	deltaLeft	= (dimLeft - leftValue)/scrollAcc;
	deltaWidth	= (dimWidth - widthValue)/scrollAcc;
	deltaHeight	= (dimHeight - heightValue)/scrollAcc;
	if (getMax(Math.abs(deltaTop),Math.abs(deltaLeft),Math.abs(deltaWidth),Math.abs(deltaHeight)) < 1) {
		topTarget(target,topValue);
		leftTarget(target,leftValue);
		widthTarget(target,widthValue);
		heightTarget(target,heightValue);
	} else {
		topTarget(target,dimTop-deltaTop); 
		leftTarget(target,dimLeft-deltaLeft); 
		widthTarget(target,dimWidth-deltaWidth); 
		heightTarget(target,dimHeight-deltaHeight); 
		setTimeout('resizeAllWithScroll(\''+target+'\','+topValue+','+leftValue+','+widthValue+','+heightValue+')', timerPas);
	}
}
// Assignation d'une valeur de z index a un calque
function zindexTarget(target,value) {
	document.getElementById(target).style.zIndex = value;
}
// Recuperation de la largeur de la fenetre du navigateur
function getScreenWidth() {
	screenWidth = getWidth('ecran');
	return screenWidth;
}
// Recuperation de la hauteur de la fenetre du navigateur
function getScreenHeight() {
	screenHeight = getHeight('ecran');
	return screenHeight;
}
// Recuperation de la position top du calque
function getTop(target) {
	value = document.getElementById(target).offsetTop;
	return value;
}
// Recuperation de la position left du calque
function getLeft(target) {
	value = document.getElementById(target).offsetLeft;
	return value;
}
// Recuperation de la largeur du calque
function getWidth(target) {
	value = document.getElementById(target).offsetWidth;
	return value;
}
// Recuperation de la hauteur de calque
function getHeight(target) {
	value = document.getElementById(target).offsetHeight;
	return value;
}
// Recherche de la valeur maxi d'une serie de valeur
function getMax(val1) {
	argv		= getMax.arguments;
	argc		= getMax.arguments.length;
	maxVal		= val1;
	i 			= 1;
	while(i < argc) {
		if (argv[i] > maxVal)	maxVal=argv[i];
		i++;
	}
	return maxVal;
}
// Recherche de la valeur mini d'une serie de valeur
function getMin(val1) {
	argv		= getMin.arguments;
	argc		= getMin.arguments.length;
	minVal		= val1;
	i 			= 1;
	while(i < argc) {
		if (argv[i] < minVal)	minVal=argv[i];
		i++;
	}
	return minVal;
}

// fonctions d'anti-selection de texte (permet de lisser le scroll et le resize...)
function disableselect(e) 									{return false}
function reEnable() 										{return true}

// *******************************************************************************************************************************
// FUNCTIONS DU LISTENER *********************************************************************************************************
function executeListennerMove(e) {
	// Detection de la position du curseur de souris
    if (document.all) {										// avec IE, on utilise l'objet "event"
    	positionCurseurX									= event.x;
    	positionCurseurY									= event.y;
    } else {												// avec Netscape, Mozilla, on utilise l'evenement "e" en argument 
    	positionCurseurX									= e.pageX;
    	positionCurseurY									= e.pageY;
    }
	// SCROLL BOX
    if (activeStatut == 'scroll') {
		leftTarget(activeBoxName,positionCurseurX - positionLeftDelta);
		topTarget(activeBoxName,positionCurseurY - positionTopDelta);
	} else if (activeStatut == 'scrollH') {
		leftTarget(activeBoxName,positionCurseurX - positionLeftDelta);
	} else if (activeStatut == 'scrollV') {
		topTarget(activeBoxName,positionCurseurY - positionTopDelta);
	// RESIZE BOX
	} else if (activeStatut == 'resize') {
		sizeWidthBox 												= positionCurseurX - positionLeftPrec[activeBoxName] + 5;
		sizeHeightBox 												= positionCurseurY - positionTopPrec[activeBoxName] + 5;
		if (sizeWidthBox > dimensionWidthDefault[activeBoxName])	widthTarget(activeBoxName,sizeWidthBox);
		if (sizeHeightBox > dimensionHeightDefault[activeBoxName])	heightTarget(activeBoxName,sizeHeightBox);
	} else if (activeStatut == 'resizeH') {
		sizeWidthBox 												= positionCurseurX - positionLeftPrec[activeBoxName] + 5;
		if (sizeWidthBox > dimensionWidthDefault[activeBoxName])	widthTarget(activeBoxName,sizeWidthBox);
	} else if (activeStatut == 'resizeV') {
		sizeHeightBox 												= positionCurseurY - positionTopPrec[activeBoxName] + 5;
		if (sizeHeightBox > dimensionHeightDefault[activeBoxName])	heightTarget(activeBoxName,sizeHeightBox);
	}
}

function executeListennerUp() {
	// OFFBOX -> sauvegarde les dimensions de la box et reinitialise les variables de statut
	if (activeBoxName != '') {
		if (fullscreenStatut[activeBoxName] == 'normal') {	// la fonction est gelee en mode plein ecran
			positionTopPrec[activeBoxName]					= parseInt(getTop(activeBoxName));
			positionLeftPrec[activeBoxName]					= parseInt(getLeft(activeBoxName));
			dimensionWidthPrec[activeBoxName]				= parseInt(getWidth(activeBoxName));
			if (visibilityStatut[activeBoxName] == 'visible') {
				dimensionHeightPrec[activeBoxName]			= parseInt(getHeight(activeBoxName));
			}
			activeStatut 									= '';
			activeBoxName 									= '';
		}
		//Pour IE4+ : Degel de la selection de texte dans la page
		document.onselectstart										= new Function('return true');
		//Pour Netscape 6 : Degel de la selection de texte dans la page
		if (window.sidebar) {
			document.onmousedown									= true;
			document.onclick										= true;
		}
	}
}

// LISTENNER MOUVEMENT DE SOURIS *************************************************************************************************
// Affectation des functions aux evenements de souris
if (document.layers)										document.captureEvents(Event.MOUSEMOVE);
document.onmousemove										= executeListennerMove;	// function executee lors d'un mouvement de souris
if (document.layers)										document.captureEvents(Event.MOUSEUP);
document.onmouseup											= executeListennerUp;	// function executee lors d'un clic haut de souris


// *******************************************************************************************************************************
// COMPOSANT FRAMEWORK	**********************************************************************************************************
// Generation de la page d'accueil a menu integre dans des boxs avec drag and drop
// Compatible Windows IE, firefox, netscape, opera, plateforme Win et Mac

// generation d'un calque a 100% de dimension pour les detections de taille ecran
d('<DIV id="ecran" STYLE="position:absolute; visibility:hidden; ');
d('width:100%; height:100%; top:0; left:0; background-color:red">');
d('</DIV>');

		
// DEFINITION DES VARIABLES DU MODULE BOX ------------------------------------------------------
// definition des variables module
var timerPas												= 10;
var zIndexBoxCount											= 0;
var positionLeftDelta										= 0;
var positionTopDelta										= 0;
var positionCurseurX										= 0;
var positionCurseurY										= 0;
var activeStatut											= '';
var activeBoxName											= '';
var positionTopDefault										= new Array();
var positionLeftDefault										= new Array();
var positionTopPrec											= new Array();
var positionLeftPrec										= new Array();
var dimensionHeightDefault									= new Array();
var dimensionWidthDefault									= new Array();
var dimensionHeightPrec										= new Array();
var dimensionWidthPrec										= new Array();
var visibilityStatut										= new Array();
var fullscreenStatut										= new Array();
var boxContent												= new Array();
var scrollLeftValue											= 0;
var scrollTopValue											= 0;
var boxTexteHeight											= new Array();
var contenerTexteHeight										= new Array();
var deltaTexte												= 2;

// DEFINITION DES FONCTIONS --------------------------------------------------------------------	
// ACTIVEBOX
function activeBox(boxName) {
	// sauvegarde du nom de la cible dans une variable globale
	activeBoxName											= boxName;
	// incrementation du z-index applique a la box
	zIndexBoxCount++;
	zindexTarget(activeBoxName,zIndexBoxCount);
	// calcul du delta position du curseur - position de la cible
	positionLeftDelta										= positionCurseurX - positionLeftPrec[activeBoxName];
	positionTopDelta										= positionCurseurY - positionTopPrec[activeBoxName];
	//Pour IE4+ : Gel de la selection de texte dans la page
	document.onselectstart										= new Function('return false');
	//Pour Netscape 6 : Gel de la selection de texte dans la page
	if (window.sidebar) {
		document.onmousedown									= disableselect;
		document.onclick										= reEnable;
	}
}
// SCROLLBOX
function scrollBox(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'scroll';
}
function scrollBoxH(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'scrollH';
}
function scrollBoxV(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'scrollV';
}
// RESIZEBOX
function resizeBox(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'resize';
}
function resizeBoxH(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'resizeH';
}
function resizeBoxV(boxName) {
	activeBox(boxName);
	if (activeStatut == '') activeStatut = 'resizeV';
}
// HIDE BOX - n'est actif que si la box n'est pas en full screen
function hideBox(boxName) {
	activeBox(boxName);
	if (fullscreenStatut[activeBoxName] == 'normal') {
		z = '<table class="box" width="100%" border="0" cellspacing="0" cellpadding="0" height="20" bgcolor="#bbbbbb"><tr>';
		z += '<td class="titreBox" onMouseDown="javascript:scrollBox(\''+activeBoxName+'\')" onMouseUp="javascript:offBox(\''+activeBoxName+'\')">&nbsp;'+activeBoxName+'</td>';
		z += '<td class="initBox" width="20" onclick="javascript:initBox(\''+activeBoxName+'\')"></td>';
		z += '<td class="showBox" width="20" onclick="javascript:showBox(\''+activeBoxName+'\')"></td>';
		z += '</tr></table>';
		heightTarget(activeBoxName,20);
		visibilityStatut[activeBoxName] = 'hidden';
		displayTarget(z,activeBoxName);
	}
}
// SHOW BOX
function showBox(boxName) {
	activeBox(boxName);
	heightTarget(activeBoxName,dimensionHeightPrec[activeBoxName]);
	visibilityStatut[activeBoxName] = 'visible';
	displayTarget(boxContent[activeBoxName],activeBoxName);
}
// FULL-SCREEN BOX
function fullscreenBox(boxName) {
	activeBox(boxName);
	if (fullscreenStatut[activeBoxName] == 'full') { 
		activeStatut							= '';
		fullscreenStatut[activeBoxName] 		= 'normal';
		resizeAllWithScroll(activeBoxName,positionTopPrec[activeBoxName],positionLeftPrec[activeBoxName],dimensionWidthPrec[activeBoxName],dimensionHeightPrec[activeBoxName]);
	} else {
		activeStatut							= 'fullscreen';
		fullscreenStatut[activeBoxName] 		= 'full';
		resizeAllWithScroll(activeBoxName,0,0,getScreenWidth(),getScreenHeight());
	}
}
// INITIALISATION BOX
function initBox(boxName) {
	activeBox(boxName);
	activeStatut							= '';
	fullscreenStatut[activeBoxName] 		= 'normal';
	resizeAllWithScroll(activeBoxName,positionTopDefault[activeBoxName],positionLeftDefault[activeBoxName],dimensionWidthDefault[activeBoxName],dimensionHeightDefault[activeBoxName]);
	positionTopPrec[activeBoxName]			= positionTopDefault[activeBoxName];
	positionLeftPrec[activeBoxName]			= positionLeftDefault[activeBoxName];
	dimensionHeightPrec[activeBoxName]		= dimensionHeightDefault[activeBoxName];
	dimensionWidthPrec[activeBoxName]		= dimensionWidthDefault[activeBoxName];
	if (visibilityStatut[activeBoxName] == 'hidden')		showBox(activeBoxName); // on affiche la box si elle etait masquee
	visibilityStatut[activeBoxName] 		= 'visible';							// on initialise le statut visible
}
// SCROLL DES BOX DE TEXTE
function scrollTexte(boxName, direction) {
	positionTexte							= getTop(boxName+'_contener');						// recuperation position contener
	contenerHeight							= getHeight(boxName+'_contener');					// recuperation hauteur du contener
	scrollTexteLimit						= (contenerHeight-boxTexteHeight[boxName])*(-1);	// definition de la limite de scroll
	if (direction == 'up')					deltaTexteTemp = deltaTexte;						// definition du delta position
	else									deltaTexteTemp = (-1)*deltaTexte;
	positionTexte							= positionTexte + deltaTexteTemp;					// correction de la position
	if (positionTexte > 0)					positionTexte = 0;									// detection des limites de scroll
	if (positionTexte < scrollTexteLimit)	positionTexte = scrollTexteLimit;
	topTarget(boxName+'_contener',positionTexte);												// scroll du contener
	if (activeTexteBox == 'yes') {
		setTimeout('scrollTexte(\''+boxName+'\',\''+direction+'\')',50);						// relance de la function
	}
}
// CREATION DES BOX SCROLLABLES
function createScrollBox (boxName,content, boxTop, boxLeft, boxWidth, boxHeight) {
	// detecte et conserve les dimensions et positions initiales
	positionTopDefault[boxName] 		= boxTop;
	positionLeftDefault[boxName] 		= boxLeft;
	dimensionHeightDefault[boxName] 	= boxHeight;
	dimensionWidthDefault[boxName] 		= boxWidth;
	positionTopPrec[boxName] 			= boxTop;
	positionLeftPrec[boxName] 			= boxLeft;
	dimensionHeightPrec[boxName] 		= boxHeight;
	dimensionWidthPrec[boxName] 		= boxWidth;
	visibilityStatut[boxName] 			= 'visible';
	fullscreenStatut[boxName] 			= 'normal';
	// generation de la box
	head = '<DIV id="'+boxName+'" STYLE="position:absolute; width:'+boxWidth+'; height:'+boxHeight+'; top:'+boxTop+'; left:'+boxLeft+'; background-color:#ffffff;">';
	z = '<table class="box" width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">';
	z += '<tr height="20"><td height="20">';
	z += '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="20" bgcolor="#bbbbbb"><tr>';
	z += '<td class="titreBox" onMouseDown="javascript:scrollBox(\''+boxName+'\')">&nbsp;'+boxName+'</td>';
	z += '<td class="initBox" width="20" onclick="javascript:initBox(\''+boxName+'\')"></td>';
	z += '<td class="fullscreenBox" width="20" onclick="javascript:fullscreenBox(\''+boxName+'\')"></td>';
	z += '<td class="hideBox" width="20" onclick="javascript:hideBox(\''+boxName+'\')"></td>';
	z += '</tr></table>';
	z += '</td></tr>';
	z += '<tr>';
	z += '<td align="left" valign="top">'+content+'</td>';
	z += '</tr>';
	z += '<tr height="16"><td>';
	z += '<table width="100%" border="0" cellspacing="0" cellpadding="0" height="16">';
	z += '<tr>';
	z += '<td><img src="'+wayToJsLib+'/images/pixelTransparent.gif" alt="" border="0"></td>';
	z += '<td class="resizeBox" width="16" onmousedown="javascript:resizeBox(\''+boxName+'\')"></td>';
	z += '</tr>';
	z += '</table>';
	z += '</td></tr></table>';
	foot = '</DIV>';
	// sauvegarde du contenu de la box
	boxContent[boxName] = z;
	z = head + z + foot;
	return z;
}
// CREATION DES TEXTE BOX
function createTexteBox (boxName, content, boxWidth, boxHeight) {
	boxWidthContener					= boxWidth - 10;

	zt = '<table style="border: solid '+TEX_borderwidth+' '+TEX_bordercolor+'" width="'+boxWidth+'" border="0" cellspacing="0" cellpadding="0" height="'+boxHeight+'">';
	zt += '<tr>';
	zt += '<td align="left" valign="top">';

	zt += '<div id="'+boxName+'" style="position:relative; height:'+boxHeight+'; width:'+boxWidthContener+'; top:0; left:0">';
	zt += '<div id="'+boxName+'_mask" style="position:absolute; width:'+boxWidthContener+'; height:'+boxHeight+'; top:0; left:0; clip:rect(0 '+boxWidthContener+' '+boxHeight+' 0);">';
	zt += '<div id="'+boxName+'_contener" style="position:relative; width:'+boxWidthContener+'; top:0; left:0">';
	zt += content;
	zt += '</div>';
	zt += '</div>';
	zt += '</div>';

	zt += '</td>';
	zt += '<td align="right" valign="top" width="20">';
	zt += '<table width="10" border="0" cellspacing="0" cellpadding="0" height="'+boxHeight+'" bgcolor="'+TEX_navigationcolor+'">';
	zt += '<tr>';
	zt += '<td align="right" valign="top">';
	zt += '<a href="#" onMouseOver="javascript:activeTexteBox=\'yes\'; scrollTexte(\''+boxName+'\',\'up\');" onMouseOut="javascript:activeTexteBox=\'no\'; deltaTexte=2" ';
	zt += 'onMouseDown="javascript:; deltaTexte=6" onMouseUp="javascript:; deltaTexte=2">';
	zt += '<img src="'+wayToJsLib+'/images/up.gif" alt="" border="0"></a></td>';
	zt += '</tr>';
	zt += '<tr>';
	zt += '<td align="right" valign="bottom">';
	zt += '<a href="#" onMouseOver="javascript:activeTexteBox=\'yes\'; scrollTexte(\''+boxName+'\',\'down\');" onMouseOut="javascript:activeTexteBox=\'no\'; deltaTexte=2" ';
	zt += 'onMouseDown="javascript:; deltaTexte=6" onMouseUp="javascript:; deltaTexte=2">';
	zt += '<img src="'+wayToJsLib+'/images/down.gif" alt="" border="0"></a></td>';
	zt += '</tr>';
	zt += '</table>';
	zt += '</td>';
	zt += '</tr>';
	zt += '</table>';

	boxTexteHeight[boxName]				= boxHeight;
	return zt;
}

// *******************************************************************************************************************************
// COMPOSANT CALENDRIER - SELECT ET INPUT ****************************************************************************************
/* 	syntaxe du composant : genereCalendar('nomDuCalendrier[string]', 'typeDuCalendrier["select"/"input"]', ('nom du champ'), 
		('value champ'));
	2 types de calendrier :
	select : 	type agenda -> affiche des dates avec des hyperliens, a partir des variables array CAL_lien et CAL_targetLien
	input : 	type choix de date -> permet de completer un champ texte a partir du calendrier.
				le champ se nomme nomDuCalendrier + 'Chp'
	compatible Windows IE, firefox, netscape, opera
*/
// initialisation variables systeme
var CAL_ferie						= new Array("01/01","01/05","08/05","14/07","15/08","01/11","11/11","25/12");
var CAL_mois						= new Array("Janvier","F&eacute;vrier","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Septembre","Octobre","Novembre","D&eacute;cembre");
var CAL_lien						= new Array();
var CAL_targetLien					= new Array();
var CAL_a							= new Array();
var CAL_a2							= new Array();
var CAL_m							= new Array();
var CAL_visibility					= new Array();
var CAL_typeCalendar				= new Array();
var CAL_Z;
var CAL_indexLien;
var nomChamp;

// bibliotheque des functions ----------------------------------------------------------------------------------------------------
function genereCalendar(calendarName,calendarType) {
	argv							= genereCalendar.arguments;
	if (argv[2])					nomChamp = argv[2];			// si il a ete specifie, on recupere le nom du champ
	else							nomChamp = calendarName;	// sinon on genere un nom par defaut avec le nom du calendrier
	if (argv[3])					valueChamp = argv[3];		// si elle a ete specifiee, on recupere la valeur a afficher dans le champ
	else							valueChamp = '../../....';	// sinon on affiche une valeur par defaut
	CAL_visibility[calendarName] 	= 'show';
	CAL_a2[calendarName]			= 0;
	CAL_a[calendarName]				= 0;
	CAL_m[calendarName]				= 0;
	CAL_typeCalendar[calendarName]	= calendarType;
	if (calendarType == 'input') {
		CAL_content = '<div style="position:relative;top:0;left:0">';	
		CAL_content += '<TABLE border="0" cellspacing="0" cellpadding="1" width="'+CAL_calwidth+'"><TR>';
		CAL_content += '<TD align="left"><input type="text" id="'+nomChamp+'" name="'+nomChamp+'" size="10" value="'+valueChamp+'"></TD>';
		CAL_content += '<TD align="left" valign="top"><a href="javascript:showCalendar(\''+calendarName+'\');"><img src="'+wayToJsLib+'/images/open.gif" alt="ouvrir calendrier" border="0"></a></TD>';
		CAL_content += '<TD align="left" valign="top" width="100%"><a href="javascript:displayCalendar(0,\''+calendarName+'\');"><img src="'+wayToJsLib+'/images/reset.gif" alt="reset calendrier" border="0"></a></TD>';
		CAL_content += '</TR></TABLE>';
		CAL_content += '<div id="'+calendarName+'" style="position:absolute;top:25;left:1;visibility:hidden">'+calendar(0,calendarName)+'</div></div>';
	} else {
		CAL_content = '<div id="'+calendarName+'" style="position:relative;top:0;left:0">'+calendar(0,calendarName)+'</div>';
	}
	return CAL_content;
}

function displayCalendar(targetMois,calendarName) {
	displayTarget(calendar(targetMois,calendarName),calendarName);
}

function showCalendar(calendarName) {
	if (CAL_visibility[calendarName] == 'show') {
		CAL_visibility[calendarName]	= 'hidden';
		showTarget(calendarName);
	} else {
		CAL_visibility[calendarName]	= 'show';
		hideTarget(calendarName);
	}
}

function estFerie(j,m) {
	var nb							= CAL_ferie.length;
	for(var i=0;i<nb;i++) {
		if ((CAL_ferie[i].substring(0,2) == j) && (CAL_ferie[i].substring(3,5) == m)) return true;
	}
	return false;
}

function estLien(j,m,a,calendarName) {
	var nb							= CAL_lien[calendarName].length;
	for	(var i=0; i<nb; i++) {
		if ((CAL_lien[calendarName][i].substring(0,2) == j) && (CAL_lien[calendarName][i].substring(3,5) == m)&&(CAL_lien[calendarName][i].substring(6,10) == a)) {
			CAL_indexLien			= i;
			return true;
		}
	}
	return false;
}

function completeChp(j,m,a,nomChamp) {
	var contenuChp					= j + '/' + m + '/' + a;
	valueTarget(contenuChp,nomChamp);
}

function calendar(targetMois,calendarName) {
	var d_jour							= new Date();
	if (targetMois == 0) {
		CAL_a[calendarName]				= d_jour.getYear();
		CAL_m[calendarName]				= d_jour.getMonth() + 1;
		if (CAL_a[calendarName] < 1970) {
			CAL_a[calendarName] 		= 1900 + CAL_a[calendarName]
		}
		CAL_a2[calendarName]			= CAL_a[calendarName];
	} else {
		CAL_m[calendarName]				= CAL_m[calendarName] + targetMois;
		if (CAL_m[calendarName] <= 0) {
			CAL_m[calendarName] 		= CAL_m[calendarName] + 12;
			CAL_a[calendarName] 		= CAL_a[calendarName] - 1;
		}
		if (CAL_m[calendarName] >= 13) {
			CAL_m[calendarName] 		= CAL_m[calendarName] - 12 ;
			CAL_a[calendarName] 		= CAL_a[calendarName] + 1;
		}
	}	
	var d								= new Date(CAL_a[calendarName],CAL_m[calendarName]-1,1);
	var dfin							= new Date(CAL_a[calendarName],CAL_m[calendarName]-1,1);
	var nb_jour							= 31;
	var aff_j							= "";
	for(k=32; k>27; k--) {
		dfin.setMonth(CAL_m[calendarName]-1);
		dfin.setDate(k);
		if (dfin.getMonth() != CAL_m[calendarName]-1) {
			nb_jour 					= k - 1;
		}
	}
	var j1								= d.getDay(); if (j1 == 0) j1 = 7;
	var jour							= 0;
	Z	= '<TABLE border="0" cellspacing="0" cellpadding="0" bgcolor="'+CAL_bgcolor+'" width="'+CAL_calwidth+'">';
	Z 	+= '<TR><TD>';
	Z	+= '<TABLE border="0" cellspacing="0" cellpadding="0" width="100%">';
	Z 	+= '<TR><TD align="left">';
	Z	+= '<a href="javascript:void(displayCalendar(-12,\''+calendarName+'\'))" '+CAL_linkstyle+'>&lt;&lt;</a>&nbsp;<a href="javascript:void(displayCalendar(-1,\''+calendarName+'\'))" '+CAL_linkstyle+'>&lt;</a>&nbsp;&nbsp;';
	Z 	+= '</TD><TD align="center">';
	Z	+= '<FONT '+CAL_style+'>'+CAL_mois[CAL_m[calendarName]-1] + " " + CAL_a[calendarName]+'</FONT>';
	Z 	+= '</TD><TD align="right">';
	Z	+= '&nbsp;&nbsp;<a href="javascript:void(displayCalendar(1,\''+calendarName+'\'))" '+CAL_linkstyle+'>&gt;</a>&nbsp;<a href="javascript:void(displayCalendar(12,\''+calendarName+'\'))" '+CAL_linkstyle+'>&gt;&gt;</a>';
	Z	+= '</TD></TR></TABLE>';
	Z	+= '</TD></TR><TR><TD>';
	Z	+= '<TABLE border="0" cellspacing="0" cellpadding="1" bgcolor="'+CAL_bgcolor+'" width="100%">';
	Z	+= '<TR bgcolor="'+CAL_bandojourcolor+'"><TD '+CAL_style+'>L</TD><TD '+CAL_style+'>M</TD><TD '+CAL_style+'>M</TD><TD '+CAL_style+'>J</TD><TD '+CAL_style+'>V</TD><TD '+CAL_style+'>S</TD><TD '+CAL_style+'>D</TD></TR>';
	for(i=0;i<6;i++) {
		Z							+= "<TR>";
		for (j=0; j<7; j++) {
			jour					= 7 * i + j - j1 + 2; 
			aff_j					= jour;
			if ((jour == d_jour.getDate()) && (CAL_m[calendarName] == d_jour.getMonth()+1) && (CAL_a[calendarName] == CAL_a2[calendarName])) {
				aff_j				= '<FONT '+CAL_jourcourantstyle+'>' + aff_j + '</FONT>';
			}
			if ((7*i+j >= j1-1) && (jour <= nb_jour)) {
				if (CAL_typeCalendar[calendarName] == 'select') {
					if (estLien(jour,CAL_m[calendarName],CAL_a[calendarName],calendarName)) {
						Z += '<TD bgcolor="'+CAL_liencolor+'" '+CAL_style+'>';
						Z += '<a href="'+CAL_targetLien[calendarName][CAL_indexLien]+'" onClick="javascript:showCalendar(\''+calendarName+'\');" '+CAL_linkstyle+'>'+aff_j+'</a></TD>';
					} else if ((j == 6) || (estFerie(jour,CAL_m[calendarName]))) {
						Z += '<TD bgcolor="'+CAL_feriecolor+'" '+CAL_style+'>'+aff_j+'</TD>';
					} else {
						Z += '<TD '+CAL_style+'>'+aff_j+'</TD>';
					}
				} else {
					var aHTML		= '<a href="javascript:completeChp(\''+jour+'\',\''+CAL_m[calendarName]+'\',\''+CAL_a[calendarName]+'\',\''+nomChamp+'\');" ';
					aHTML			+= 'onClick="javascript:showCalendar(\''+calendarName+'\');" '+CAL_linkstyle+'>';
					if ((j == 6) || (estFerie(jour,CAL_m[calendarName]))) {
						ferieHTML	= 'bgcolor="'+CAL_feriecolor+'"';
					} else {
						ferieHTML	= '';
					}
					Z += '<TD '+ferieHTML+' '+CAL_style+'>'+aHTML+aff_j+'</a></TD>';
				}
			} else {
				Z	+= '<TD '+CAL_style+'>&nbsp;</TD>';
			}
		}
		Z	+= '</TR>';
	}
	Z	+= '</TABLE>';
	Z	+= '</TD></TR></TABLE>';
	
	return Z;
}
-->