function jsCalendar(formId)
{
this.init(formId);
}
jsCalendar.prototype.init = function(formId)
{
// Form Object Identifiers
this.formId = formId;
this.triggerId = 't_'+formId;
this.displayId = 'd_'+formId;
this.objectId = 'o_'+formId;
// Calendar Settings
this.currentDate = new Date();
this.selectedDate = new Date();
this.startDay = 0; //Sun=0, Mon=1, Tue=2, Wed=3, Thu=4, Fri=5, Sat=6
this.monthBrowse = 'on';
this.yearBrowse = 'on';
// Grpahic Settings
this.nextMonthG = '
';
this.prevMonthG = '
';
this.nextYearG = '
';
this.prevYearG = '
';
// Table Settings
this.tableWidth = '200px';
this.tableBorder1 = '1px solid #4682B4';
this.tableBorder2 = '2px solid #4682B4';
this.tableFont = '';
this.headerBorder = '';
this.headerHeight = '23px';
this.headerBG = '#4682B4';
this.headerFontColor = 'white';
this.headerFontSize = '10pt';
this.headerFontWeight = 'bold';
this.headerFontFamily = 'Verdana';
this.dayBorder = '1px solid #4682B4';
this.dayHeight = '';
this.dayWidth = '14.28%';
this.dayBG = '#87CEFA';
this.dayFontColor = 'white';
this.dayFontSize = '8pt';
this.dayFontWeight = 'bold';
this.dayFontFamily = 'Verdana';
this.selectedColor = '#FF9696';
this.weekendColor = '#A596FF';
this.nonmonthColor = '#E1E1E1';
this.defaultColor = 'white';
// Calendar Data
this.lShDays = new Array('Su','Mo','Tu','We','Th','Fr','Sa');
this.lLhDays = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
this.lShMonths = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
this.lLhMonths = new Array('January','Febuary','March','April','May','June','July','August','September','October','November','December');
this.daysPerMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
// Regular Expressions
this.slash = new RegExp('/');
this.dash = new RegExp('-');
this.dateCheck = /^(\d\d?)[\/-](\d\d?)[\/-](\d{2,4})$/;
}
jsCalendar.prototype.triggerTable = function()
{
if(document.getElementById(this.formId).value != '')
this.initializeValue(document.getElementById(this.formId).value);
if(document.getElementById(this.displayId).innerHTML != '')
this.closeTable();
else
this.buildTable();
}
jsCalendar.prototype.checkValue = function(initValue)
{
if(initValue!='' && !initValue.match(this.dateCheck))
{
document.getElementById(this.formId).value = '';
alert('The date format you entered is invalid'+"\r\n"+'Please use the MM/DD/YYYY format');
}
else
document.getElementById(this.formId).value = initValue.replace(/-/g,'/');
}
jsCalendar.prototype.initializeValue = function(initValue)
{
if(initValue.match(this.slash))
initValueArray = initValue.split('/');
else if(initValue.match(this.dash))
initValueArray = initValue.split('-');
if(typeof(initValueArray[1])!='undefined')
{
this.selectedDate.setDate(initValueArray[1]);
this.currentDate.setDate(initValueArray[1]);
}
if(typeof(initValueArray[0])!='undefined')
{
this.selectedDate.setMonth(initValueArray[0]-1);
this.currentDate.setMonth(initValueArray[0]-1);
}
if(typeof(initValueArray[2])!='undefined')
{
this.selectedDate.setYear(initValueArray[2]);
this.currentDate.setYear(initValueArray[2]);
}
}
jsCalendar.prototype.buildTable = function()
{
displayCal = '
| '+leftData+' | ' +''+displayedDate+' | ' +''+rightData+' | ' +'