/*
Copyright (c) ScanFrame 2008.
All Rights Reserved.

$Source: /export/cvs/primo/com/jscripts/calendar.js,v $
$Author: arjan $
$Revision: 1.4 $

Identification:
  JSCRIPTS

Initial Author:
  AVO 20080909

Purpose:
	Library for date picker loading and creation.

*/

// Sentry start
if (!__calendar__){
//---------------------------------------------------------------------------

// Create an object to control loading.
var __calendar__ = {loaded: false, object: null, params: {}};
// Create temporary function to store the passed parameters with when this script is loaded.
SfLib.CalendarDialog = function (input, lang, show_time)
{
	__calendar__.params.input = input;
	__calendar__.params.lang = lang;
	__calendar__.params.show_time = show_time;
};
// Dynamically load the needed style sheet.
SfLib.StylesheetImport('jscripts/calendar/rich_calendar.css', 'rich_calendar_css');
// Import the main calendar script.
SfLib.JavascriptImport
(
	'jscripts/calendar/rich_calendar.js',
	'rich_calendar_base',
	function()
	{
		SfLib.JavascriptImport
		(
			'jscripts/calendar/rc_lang_en.js',
			'rich_calendar_en',
			function()
			{
				SfLib.JavascriptImport(
					'jscripts/calendar/rc_lang_nl.js',
					'rich_calendar_nl',
					function()
					{
						// Assign the new actual function.
						SfLib.CalendarDialog = function (input, lang, show_time)
						{
							if (__calendar__.object)
									__calendar__.object.hide();
							__calendar__.object = new RichCalendar(input, show_time);
							__calendar__.object.language = lang;
							__calendar__.object.parse_date(input.value);
							__calendar__.object.auto_close = true;
							__calendar__.object.show_at_element(input, 'under');
						};
						SfLib.CalendarDialog(__calendar__.params.input, __calendar__.params.lang, __calendar__.params.show_time);
					});
			});
	}
);
//---------------------------------------------------------------------------
// Sentry end.
}

