Object.extend(Date.prototype, {
	monthnames: ["Janvier", "F&eacute;vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao&ucirc;t", "Septembre", "Octobre", "Novembre", "D&eacute;cembre"],
	daynames: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"]
});

//this is a global variable to have only one instance of the calendar
var calendar = null;

//@element   => is the <div> where the calender will be rendered by Scal.
//@input     => is the <input> where the date will be updated.
//@container => is the <div> for dragging.
//@source    => is the img/button which raises up the calender, the script will locate the calenar over this control.
function showCalendar(element, input, source)            
{
	if (!calendar)
	{
		//The singleton calendar is created.
		calendar = new scal(element, $(input), { updateformat: 'dd/mm/yyyy',
							 openeffect:Element.show,
							 closeeffect:Element.hide,
							 closebutton: '&nbsp;&times;&nbsp;'
						       });
	}
	else
	{
		calendar.updateelement = $(input);
	}

	var date = new Date($F(input));

	calendar.setCurrentDate(isNaN(date) ? new Date() : date);

	//Locates the calendar over the calling control  (in this example the "img").
	if (source = $(source))
	{
		Position.clone($(source), element, {setWidth: false, setHeight: false, offsetLeft: source.getWidth() + 2});
	}

	//finally show the calendar =)
	calendar.openCalendar();
};
