/**
 * <code>public class <b>Config</b><br>
 * extends componence.ComponentConfig</code><br><br>
 *
 *
 * Defines static variable: <code>Object CalendarConfig</code><br>
 * Available as <code>new componence.calendar.Config()</code><br>
 * Packege <b><code>componence.calendar</code></b>
 */

if(!window.componence) var componence={};
if(!componence.calendar) componence.calendar={};

/**
 * Specified common settings for Calendar.<br>
 * Should be included in HEAD section of HTML document before <code>componence-calendar.jar</code><br>
 * 
 * @version {version}
 * @see componence.calendar.Factory
 * @constructor
 * @lastmodified
 * @extends ComponentConfig
 */
componence.calendar.Config = function() {
	this.extend(componence.ComponentConfig);
	
	var /*:boolean:*/ isLocal = (String(document.location).indexOf("file:")==0);
	
	/**
	 * if empty value - inserts current date
	 *
	 * @access public
	 * @type boolean
	 */
	this.insertCurrentDate = true;

	/**
	 * start year
	 *
	 * @access public
	 * @type int
	 */
	this.startYear = 2000;
	
	/**
	 * end year
	 *
	 * @access public
	 * @type int
	 */
	this.endYear   = 2009;
	
	/**
	 * CSS Class names for active (selected) day 
	 *
	 * @type String
	 */
	this.clsActiveTD = "DatePickerBtnSelect";
	
	
	/**
	 * CSS Class names for not active day 
	 *
	 * @type String
	 */
	this.clsNotActiveTD = "DatePickerBtn";
	
	/**
	 * Specified displayng error messages. Default <code>false</code>.
	 * @access public
	 * @type boolean
	 */
	this.debugMode = false;
	
	/**
	 * Path to where all scripts files are located
	 * @access public
	 * @type String
	 */
	this.scriptPath = ComponentConfig.scriptPath;
	
	/**
	 * Path to where all styleshhets files are located
	 * @access public
	 * @type String
	 */
	this.cssPath = ComponentConfig.cssPath;
	
	/**
	 * Path to where all locales scripts files are located
	 * @access public
	 * @type String
	 */
	this.localePath = ComponentConfig.localePath;
	
	/*
	 * See also ComponentConfig
	 * 
	 * this.defaultLanguage="en";
	 * this.defaultLanguage="nl";
	 * this.defaultLanguage="ru";
	 * this.defaultLanguage="ua";
	 */
};

/**
 * Specified common settings for Calendar.<br>
 * <b>Should be included in HEAD section of HTML document before Calendar component</b><br>
 * Define global variable <code>CalendarConfig</code>
 * 
 * @access private
 * @deprecated use componence.calendar.Config
 * @version 4.2.142
 * @see Calendar
 * @constructor
 * @lastmodified
 * @extends ComponentConfig
 */
function JSCalendarConfig() {
	return new componence.calendar.Config();
}

if(window.JSComponentConfig) JSCalendarConfig.prototype = new JSComponentConfig();

var /*:Object:*/ CalendarConfig = new componence.calendar.Config();

var CALENDAR_INPUT = 
	'<!--Begin[CreatingInput]-->'+
		'<INPUT READONLY TYPE="text" NAME="{inputName}" onclick="{inputButtonClick}" value="{inputValue}" {inputAttributes} >' +
		'<INPUT TYPE="BUTTON" VALUE="..." onclick="{inputButtonClick}">'+
	'<!--End[CreatingInput]-->';

/*
* Template "CALENDAR_TITLE"
* This template creates calendar title with close and clear buttons.
*/
var CALENDAR_TITLE = 
	'<!--Begin[CalendarCaption]-->'+
		'<DIV CLASS="DatePickerTitle">'+(
			(window.opera)
			?
			'<input type="button" class="titleBtn" onclick="{closeButtonClick}" title="{closeButtonTitle}" value="&#x00d7;">'+
			'<input type="button" class="titleBtn" onclick="{clearButtonClick}" title="{clearButtonTitle}" value="&#x00ab;">'
			:
			'<div class="titleBtn" onclick="{closeButtonClick}" title="{closeButtonTitle}">&#x00d7;</div>'+
			'<div class="titleBtn" onclick="{clearButtonClick}" title="{clearButtonTitle}">&#x00ab;</div>')
		+'</DIV>'+
	'<!--End[CalendarCaption]-->';

/*
* Template "CALENDAR_MONTHS_YEARS"
* This template creates month and year selectors.
*/
var CALENDAR_MONTHS_YEARS = 
	'<!--Begin[CalendarMonthsYears]-->'+
		'<TD CLASS="DatePickerHdr" WIDTH="5%">'+
			'<INPUT TYPE="button" CLASS="DatePickerHdrBtn" onclick="{prevClick}" value="&#x00ab;" TITLE="{previousMonth}">'+
		'</TD>'+
		'<TD CLASS="DatePickerHdr" COLSPAN="5" ALIGN="CENTER">'+
			'<SELECT ID="{monthID}" CLASS="DatePickerMonth" onchange="{monthOnchange}">{monthsOptions}</SELECT>'+
			'<SELECT ID="{yearID}" CLASS="DatePickerMonth" onchange="{yearOnchange}">{yearOptions}</SELECT>'+
		'</TD>'+
		'<TD CLASS="DatePickerHdr" WIDTH="5%" ALIGN="RIGHT">'+
			'<INPUT TYPE="button" CLASS="DatePickerHdrBtn" onclick="{nextClick}" value="&#187;" TITLE="{nextMonth}">'+
		'</TD>'+
	'<!--End[CalendarMonthsYears]-->';
	
var CALENDAR_YEARS_WEEK = 
  '<!--Begin[CalendarMonthsYears]-->'+
		//'<TD CLASS="DatePickerHdr" WIDTH="5%">'+
		//	'<INPUT TYPE="button" CLASS="DatePickerHdrBtn" onclick="{prevClick}" value="&#x00ab;" TITLE="{previousMonth}">'+
		//'</TD>'+
		'<TD CLASS="DatePickerHdr" COLSPAN="5" ALIGN="CENTER">'+
			'<SELECT ID="{yearID}" CLASS="DatePickerMonth" onchange="{yearOnchange}" style="width:49%;">{yearOptions}</SELECT>'+
			'<SELECT ID="{weekID}" CLASS="DatePickerMonth" onchange="{weekOnchange}" style="width:49%;">{weekOptions}</SELECT>'+
		'</TD>'+
		//'<TD CLASS="DatePickerHdr" WIDTH="5%" ALIGN="RIGHT">'+
		//	'<INPUT TYPE="button" CLASS="DatePickerHdrBtn" onclick="{nextClick}" value="&#187;" TITLE="{nextMonth}">'+
		//'</TD>'+
	'<!--End[CalendarMonthsYears]-->';
/*
* Template "CALENDAR_YEARS_ONLY"
* This template creates year selector.
*/
var CALENDAR_YEARS_ONLY = 
	'<!--Begin[CalendarMonthsYears]-->'+
		'<TD CLASS="DatePickerHdr">'+
			'<INPUT STYLE="width:100%" TYPE="button" CLASS="DatePickerHdrBtn" onclick="{prevYearClick}" value="&#x00ab;" TITLE="{previousYear}">'+
		'</TD>'+
		'<TH CLASS="DatePickerHdr">'+
			'<SELECT ID="{yearID}" CLASS="DatePickerYear" onchange="{yearOnchange}">{yearOptions}</SELECT>'+
		'</TH>'+
		'<TD CLASS="DatePickerHdr">'+
			'<INPUT STYLE="width:100%" TYPE="button" CLASS="DatePickerHdrBtn" onclick="{nextYearClick}" value="&#187;" TITLE="{nextYear}">'+
		'</TD>'+
	'<!--End[CalendarMonthsYears]-->';

/*
* Template "CALENDAR_DAYS_OF_WEEK"
* This template creates days of week row.
*/
var CALENDAR_DAYS_OF_WEEK = 
	'<!--Begin[CalendarDaysOfWeek]-->'+
		'<TR><td colspan=7><table cellpadding=0 cellspacing=0>'+
			'<!--Begin[CalendarDaysOfWeekItem]-->'+
				'<TD CLASS="CalendarDaysOfWeek" unselectable="on">{day}</TD>'+
			'<!--End[CalendarDaysOfWeekItem]-->'+
		'</table></td></TR>'+
	'<!--End[CalendarDaysOfWeek]-->';
	/*
var CALENDAR_DAYS_OF_WEEK = 
	'<!--Begin[CalendarDaysOfWeek]-->'+
		'<TR>'+
			'<!--Begin[CalendarDaysOfWeekItem]-->'+
				'<TD CLASS="CalendarDaysOfWeek" unselectable="on">{day}</TD>'+
			'<!--End[CalendarDaysOfWeekItem]-->'+
		'</TR>'+
	'<!--End[CalendarDaysOfWeek]-->';
	*/
/*
* Template "CALENDAR_DAYS_OF_MONTH"
* This template creates day picker.
* Please, don't change className "CalendarDaysOfMonth",
* becouse its using like type indeficator for Opera and NS6.
*/
var CALENDAR_DAYS_OF_MONTH = 
	'<TABLE CLASS="CalendarDaysOfMonth" border="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%">'+
		'<!--Begin[CalendarDays]-->'+
			'<!--Begin[CalendarDaysOfMonth]-->'+
				'<TR>'+
					'<!--Begin[CalendarDaysOfMonthItem]-->'+
						'<TD align="right" style="border: 0px solid #ffffff; padding-right: 8px;" unselectable="on">{dayA}</TD>'+
					'<!--End[CalendarDaysOfMonthItem]-->'+
				'</TR>'+
			'<!--End[CalendarDaysOfMonth]-->'+
		'<!--End[CalendarDays]-->'+
	'</TABLE>';

/*
* Template "CALENDAR_TIMES"
* This template creates time selector.
*/
var CALENDAR_TIMES = 
	'<!--Begin[CalendarTimes]-->'+
		'<TR>'+
			'<TH COLSPAN="7">'+
			'<SELECT ID="{hoursID}" onchange="{hoursOnchange}" CLASS="CalendarTime">{hoursOptions}</SELECT>'+
			'<SPAN CLASS="CalendarTimeSeparator"> : </SPAN>'+
			'<SELECT ID="{minutesID}" onchange="{minutesOnchange}" CLASS="CalendarTime">{minutesOptions}</SELECT>'+
			'</TH>'+
		'</TR>'+
	'<!--End[CalendarTimes]-->';

/*
* Template "CALENDAR_CLOCK"
* This template creates graphical clock and time selector ( see "CALENDAR_TIMES" ).
*/
var CALENDAR_CLOCK =
	'<!--Begin[CalendarClock]-->'+
	  '<TH>'+
			'<FIELDSET CLASS="clsFieldset">'+
				'<LEGEND CLASS="clsLegend"> {timeCaption} </LEGEND>'+
				'{clock}'+
				'<TABLE BORDER="0" ALING="CENTER" WIDTH="100%">' + CALENDAR_TIMES + '</TABLE>'+
			'</FIELDSET>'+
		'</TH>'+
	'<!--End[CalendarClock]-->';

/*
* Template "CALENDAR_CONTAINER"
* This template creates calendar container for all types.
*/
var CALENDAR_CONTAINER = '<SPAN ID="{calendarSpanID}" CLASS="CalendarContainer">';


/*
* Template "TEMP_DAY"
* This template creates calendar with days, months, years.
*/
var CALENDAR_DAY_OF_MONTH_TEMPLATE = CALENDAR_INPUT + 
							CALENDAR_CONTAINER +
								'<TABLE BORDER=0 CELLSPACING="0" CELLPADDING="0" CLASS="DatePickerTable" STYLE="border:0;background-color:menu;">' +
									'<TR><TD COLSPAN="7">' + CALENDAR_TITLE + '</TD></TR>' +
									'<TR>' + CALENDAR_MONTHS_YEARS + '</TR>' +
									CALENDAR_DAYS_OF_WEEK +
									'<tr><td colspan=7>'+
									CALENDAR_DAYS_OF_MONTH +
									'</td></tr>'+
								'</TABLE>' +
							'</SPAN>';

/*
* Template "TEMP_DAY_WITH_TIME"
* This template creates calendar with times, days, months, years.
*/
var CALENDAR_DAY_OF_MONTH_WITH_TIME_TEMPLATE = CALENDAR_INPUT + 
							CALENDAR_CONTAINER +
								'<TABLE BORDER=0 CELLSPACING="0" CELLPADDING="0" CLASS="DatePickerTable" STYLE="border:0;background-color:menu;">' +
									'<TR><TD COLSPAN="7">' + CALENDAR_TITLE + '</TD></TR>' +
									'<TR>' + CALENDAR_MONTHS_YEARS + '</TR>' +
									CALENDAR_DAYS_OF_WEEK +
									'<tr><td colspan=7>'+
									CALENDAR_DAYS_OF_MONTH +
									'</td></tr>'+
									CALENDAR_TIMES +
								'</TABLE>' +
							'</SPAN>';

/*
* Template "TEMP_DAY_WITH_CLOCK"
* This template creates full calendar with clock, times, days, months, years.
*/
var CALENDAR_DAY_OF_MONTH_WITH_CLOCK_TEMPLATE = CALENDAR_INPUT + 
							CALENDAR_CONTAINER +
							'<TABLE BORDER=0 CELLSPACING="0" CELLPADDING="0">'+
							'<TR><TD COLSPAN="2">' + CALENDAR_TITLE + '</TD></TR>' +
							'<TR VALIGN="TOP">'+
							'<TD>'+
								'<FIELDSET CLASS="clsFieldset">'+
									'<LEGEND CLASS="clsLegend"> {dateCaption} </LEGEND>'+
									'<TABLE CLASS="DatePickerTable" CELLSPACING="0" CELLPADDING="0" BORDER="0" style="margin:10px; ">' +
										'<TR VALIGN="TOP">' + CALENDAR_MONTHS_YEARS + '</TR>' +
											CALENDAR_DAYS_OF_WEEK +
											'<TR><TD COLSPAN="7">' +
												CALENDAR_DAYS_OF_MONTH +
										'</TD></TR>' +
									'</TABLE>' +
								'</FIELDSET>' +
							'</TD>' +
								CALENDAR_CLOCK +
							'</TR>' +
							'</TABLE>' +
							'</SPAN>';

/*
* Template "TEMP_MONTH"
* This template creates calendar with months, years.
*/
var CALENDAR_MONTH_TEMPLATE = CALENDAR_INPUT + 
							CALENDAR_CONTAINER +
								'<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="150">' +
									'<TR><TD COLSPAN="7">' + CALENDAR_TITLE + '</TD></TR>' +
									'<TR>' + CALENDAR_MONTHS_YEARS + '</TR>' +
								'</TABLE>' +
							'</SPAN>';

/*
* Template "TEMP_YEAR"
* This template creates calendar with years only.
*/
var CALENDAR_YEAR_TEMPLATE = CALENDAR_INPUT +
							CALENDAR_CONTAINER +
								'<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="100">' +
									'<TR><TD COLSPAN="3">' + CALENDAR_TITLE + '</TD></TR>' +
									'<TR>' + CALENDAR_YEARS_ONLY + '</TR>' +
								'</TABLE>' +
							'</SPAN>';
/*
* Template "TEMP_WEEK"
* This template creates calendar with years and weeks only.
*/
var TEMP_WEEK = CALENDAR_INPUT + 
							CALENDAR_CONTAINER +
								'<TABLE CELLSPACING="0" CELLPADDING="0" BORDER="0" WIDTH="150">' +
									'<TR><TD COLSPAN="5">' + CALENDAR_TITLE + '</TD></TR>' +
									'<TR>' + CALENDAR_YEARS_WEEK + '</TR>' +
								'</TABLE>' +
							'</SPAN>';
