**************************************************
*      Carpediem V 1.02 : a simple date-picker   * 
**************************************************     
*	Carpe Diem et Partem Noctis              *
* Author : Alain Bruguieres                      *
* (alain.bruguieres@free.fr)                     *
*                                                *
* License: GPL; you may use this code freely,    *
* provided you don't try to make money with it.  *
* Provided as is, without any warranty.          *
* Feel free to use this code, but don't remove   *
* this disclaimer please.                        *
* If you to use my code, please listen to a Bach *
* Cantata (if you don't know which one,          * 
* why not try BWV 49 ?) and send me an e-mail.   *  
**************************************************
*
* Purpose: insert a date-picker control in you html page
*
*************************************************** 
* How does it work?
***************************************************
* The following code must be inserted in your html page, 
* between <head> and </head> :
*
*	<script type="text/javascript" src="cal.js"></script>
*
*
* Now assume that somewhere in the body of your page, you have a text input control like this:
*
*       <input id="LaDate" size="10" maxlength="10" type="text"> 
*
* and you want to associate a date-picker to it; first of all you must specify an id for your 
* text input control, for instance id=LaDate :
*
*       <input id="LaDate" size="10" maxlength="10" type="text">
*
* then add the following link to your page to create the date-picker :
*
*       <img src="calendar_icon.png" align=center onClick="javascript:open_cal('LaDate');">
*
* Of course you can modify freely this html code; the only thing that matters is the onClick property.
*
*****************************************************
* How to use carpediem in a php-generated page?
*****************************************************
* If you want to use the date-picker in a php-generated code, the following php function will create both 
* a text input control and a date-picker inside a form; the arguments are the name of the datevariable to be
* returned by the form, and the initial value for the date control
*
* function saisie_date($VarDate,$JOUR) {
*	$control="ZSD_".$VarDate; //id of the text input control
*	$onClick="javascript:open_cal('".$control."');";
*	echo "<INPUT TYPE=TEXT id='$control' NAME='$VarDate'  VALUE='$JOUR' 
*	style='background: white;' SIZE='9' MAXLENGTH='10'>
*	<img src='images/calendar_icon.png' width=20 height=18 border=0 
*	align='center' onClick=\"$onClick\" alt='Cal.' title='ouvrir un calendrier'><br>";
*	}
*
*****************************************************
* What's new from 1.01?
*****************************************************
* The month and year may be selected from a list.
* Selectable years range from current - 9 to current + 9.
* Of course you can easily alter this behaviour by editing the code
* (the relevant variables are 'bigbang' and 'bigcrunch') 
*
*****************************************************
* Acknowledgements: I am aware of the remarkable work of Kedar R. Bhave and Hugo Ortega_Hernandez
* (and I have borrowed Hugo Ortega_Hernandez' icon.)
* However the present date picker was written entirely from scratch; the aim being to have a very 
* straightforward code. 
*
* In particular, all date input are converted from the format "DD/MM/YYYY" 
* (or any other format defined by the global variable Template) to date objects; 
* then the standard javascript functions on date objects are used. We don't have to
* manage oddities such as february 29th's...
*
* You may easily customize this code by editing the GENERAL SETTINGS section. 
******************************************************