2 |
- |
1 |
//Javasript name: My Date Time Picker
|
|
|
2 |
//Date created: 16-Nov-2003 23:19
|
|
|
3 |
//Creator: TengYong Ng
|
|
|
4 |
//Website: http://www.rainforestnet.com
|
|
|
5 |
//Copyright (c) 2003 TengYong Ng
|
|
|
6 |
//FileName: DateTimePicker_css.js
|
|
|
7 |
//Version: 2.2.4
|
|
|
8 |
// Note: Permission given to use and modify this script in ANY kind of applications if
|
|
|
9 |
// header lines are left unchanged.
|
|
|
10 |
//Permission is granted to redistribute and modify this javascript under a FreeBSD License.
|
|
|
11 |
//New Css style version added by Yvan Lavoie (Québec, Canada) 29-Jan-2009
|
|
|
12 |
//Formatted for JSLint compatibility by Labsmedia.com (30-Dec-2010)
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
//Global variables
|
|
|
16 |
|
|
|
17 |
var winCal;
|
|
|
18 |
var dtToday;
|
|
|
19 |
var Cal;
|
|
|
20 |
var MonthName;
|
|
|
21 |
var WeekDayName1;
|
|
|
22 |
var WeekDayName2;
|
|
|
23 |
var exDateTime;//Existing Date and Time
|
|
|
24 |
var selDate;//selected date. version 1.7
|
|
|
25 |
var calSpanID = "calBorder"; // span ID
|
|
|
26 |
var domStyle = null; // span DOM object with style
|
|
|
27 |
var cnLeft = "0";//left coordinate of calendar span
|
|
|
28 |
var cnTop = "0";//top coordinate of calendar span
|
|
|
29 |
var xpos = 0; // mouse x position
|
|
|
30 |
var ypos = 0; // mouse y position
|
|
|
31 |
var calHeight = 0; // calendar height
|
|
|
32 |
var CalWidth = 208;// calendar width
|
|
|
33 |
var CellWidth = 30;// width of day cell.
|
|
|
34 |
var TimeMode = 24;// TimeMode value. 12 or 24
|
|
|
35 |
var StartYear = 1940; //First Year in drop down year selection
|
|
|
36 |
var EndYear = 5; // The last year of pickable date. if current year is 2011, the last year that still picker will be 2016 (2011+5)
|
|
|
37 |
var CalPosOffsetX = -1; //X position offset relative to calendar icon, can be negative value
|
|
|
38 |
var CalPosOffsetY = 0; //Y position offset relative to calendar icon, can be negative value
|
|
|
39 |
|
|
|
40 |
//Configurable parameters start
|
|
|
41 |
var SpanBorderColor = "#000000";//span border color
|
|
|
42 |
var SpanBgColor = "#FFFFFF"; //span background color
|
|
|
43 |
var MonthYearColor = "#cc0033"; //Font Color of Month and Year in Calendar header.
|
|
|
44 |
var WeekHeadColor = "#18861B"; //var WeekHeadColor="#18861B";//Background Color in Week header.
|
|
|
45 |
var SundayColor = "#C0F64F"; //var SundayColor="#C0F64F";//Background color of Sunday.
|
|
|
46 |
var SaturdayColor = "#C0F64F"; //Background color of Saturday.
|
|
|
47 |
var WeekDayColor = "#FFEDA6"; //Background color of weekdays.
|
|
|
48 |
var FontColor = "blue"; //color of font in Calendar day cell.
|
|
|
49 |
var TodayColor = "#ffbd35"; //var TodayColor="#FFFF33";//Background color of today.
|
|
|
50 |
var SelDateColor = "#8DD53C"; //var SelDateColor = "#8DD53C";//Backgrond color of selected date in textbox.
|
|
|
51 |
var YrSelColor = "#cc0033"; //color of font of Year selector.
|
|
|
52 |
var MthSelColor = "#cc0033"; //color of font of Month selector if "MonthSelector" is "arrow".
|
|
|
53 |
var HoverColor = "#E0FF38"; //color when mouse move over.
|
|
|
54 |
var DisableColor = "#999966"; //color of disabled cell.
|
|
|
55 |
var CalBgColor = "#ffffff"; //Background color of Calendar window.
|
|
|
56 |
|
|
|
57 |
var WeekChar = 2;//number of character for week day. if 2 then Mo,Tu,We. if 3 then Mon,Tue,Wed.
|
|
|
58 |
var DateSeparator = "-";//Date Separator, you can change it to "-" if you want.
|
|
|
59 |
var ShowLongMonth = true;//Show long month name in Calendar header. example: "January".
|
|
|
60 |
var ShowMonthYear = true;//Show Month and Year in Calendar header.
|
|
|
61 |
var ThemeBg = "";//Background image of Calendar window.
|
|
|
62 |
var PrecedeZero = true;//Preceding zero [true|false]
|
|
|
63 |
var MondayFirstDay = true;//true:Use Monday as first day; false:Sunday as first day. [true|false] //added in version 1.7
|
|
|
64 |
var UseImageFiles = true;//Use image files with "arrows" and "close" button
|
|
|
65 |
var imageFilesPath = "images2/";
|
|
|
66 |
//Configurable parameters end
|
|
|
67 |
|
|
|
68 |
//use the Month and Weekday in your preferred language.
|
|
|
69 |
var MonthName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
|
70 |
var WeekDayName1 = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
|
71 |
var WeekDayName2 = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
//end Configurable parameters
|
|
|
75 |
|
|
|
76 |
//end Global variable
|
|
|
77 |
|
|
|
78 |
|
|
|
79 |
// Calendar prototype
|
|
|
80 |
function Calendar(pDate, pCtrl)
|
|
|
81 |
{
|
|
|
82 |
//Properties
|
|
|
83 |
this.Date = pDate.getDate();//selected date
|
|
|
84 |
this.Month = pDate.getMonth();//selected month number
|
|
|
85 |
this.Year = pDate.getFullYear();//selected year in 4 digits
|
|
|
86 |
this.Hours = pDate.getHours();
|
|
|
87 |
|
|
|
88 |
if (pDate.getMinutes() < 10)
|
|
|
89 |
{
|
|
|
90 |
this.Minutes = "0" + pDate.getMinutes();
|
|
|
91 |
}
|
|
|
92 |
else
|
|
|
93 |
{
|
|
|
94 |
this.Minutes = pDate.getMinutes();
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
if (pDate.getSeconds() < 10)
|
|
|
98 |
{
|
|
|
99 |
this.Seconds = "0" + pDate.getSeconds();
|
|
|
100 |
}
|
|
|
101 |
else
|
|
|
102 |
{
|
|
|
103 |
this.Seconds = pDate.getSeconds();
|
|
|
104 |
}
|
|
|
105 |
this.MyWindow = winCal;
|
|
|
106 |
this.Ctrl = pCtrl;
|
|
|
107 |
this.Format = "ddMMyyyy";
|
|
|
108 |
this.Separator = DateSeparator;
|
|
|
109 |
this.ShowTime = false;
|
|
|
110 |
this.Scroller = "DROPDOWN";
|
|
|
111 |
if (pDate.getHours() < 12)
|
|
|
112 |
{
|
|
|
113 |
this.AMorPM = "AM";
|
|
|
114 |
}
|
|
|
115 |
else
|
|
|
116 |
{
|
|
|
117 |
this.AMorPM = "PM";
|
|
|
118 |
}
|
|
|
119 |
this.ShowSeconds = false;
|
|
|
120 |
this.EnableDateMode = ""
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
Calendar.prototype.GetMonthIndex = function (shortMonthName)
|
|
|
124 |
{
|
|
|
125 |
for (var i = 0; i < 12; i += 1)
|
|
|
126 |
{
|
|
|
127 |
if (MonthName[i].substring(0, 3).toUpperCase() === shortMonthName.toUpperCase())
|
|
|
128 |
{
|
|
|
129 |
return i;
|
|
|
130 |
}
|
|
|
131 |
}
|
|
|
132 |
};
|
|
|
133 |
|
|
|
134 |
Calendar.prototype.IncYear = function () {
|
|
|
135 |
if (Cal.Year <= dtToday.getFullYear()+EndYear)
|
|
|
136 |
Cal.Year += 1;
|
|
|
137 |
};
|
|
|
138 |
|
|
|
139 |
Calendar.prototype.DecYear = function () {
|
|
|
140 |
if (Cal.Year > StartYear)
|
|
|
141 |
Cal.Year -= 1;
|
|
|
142 |
};
|
|
|
143 |
|
|
|
144 |
Calendar.prototype.IncMonth = function() {
|
|
|
145 |
if (Cal.Year <= dtToday.getFullYear() + EndYear) {
|
|
|
146 |
Cal.Month += 1;
|
|
|
147 |
if (Cal.Month >= 12) {
|
|
|
148 |
Cal.Month = 0;
|
|
|
149 |
Cal.IncYear();
|
|
|
150 |
}
|
|
|
151 |
}
|
|
|
152 |
};
|
|
|
153 |
|
|
|
154 |
Calendar.prototype.DecMonth = function() {
|
|
|
155 |
if (Cal.Year >= StartYear) {
|
|
|
156 |
Cal.Month -= 1;
|
|
|
157 |
if (Cal.Month < 0) {
|
|
|
158 |
Cal.Month = 11;
|
|
|
159 |
Cal.DecYear();
|
|
|
160 |
}
|
|
|
161 |
}
|
|
|
162 |
};
|
|
|
163 |
|
|
|
164 |
Calendar.prototype.SwitchMth = function (intMth)
|
|
|
165 |
{
|
|
|
166 |
Cal.Month = parseInt(intMth, 10);
|
|
|
167 |
};
|
|
|
168 |
|
|
|
169 |
Calendar.prototype.SwitchYear = function (intYear)
|
|
|
170 |
{
|
|
|
171 |
Cal.Year = parseInt(intYear, 10);
|
|
|
172 |
};
|
|
|
173 |
|
|
|
174 |
Calendar.prototype.SetHour = function(intHour) {
|
|
|
175 |
var MaxHour,
|
|
|
176 |
MinHour,
|
|
|
177 |
HourExp = new RegExp("^\\d\\d"),
|
|
|
178 |
SingleDigit = new RegExp("^\\d{1}$");
|
|
|
179 |
|
|
|
180 |
if (TimeMode === 24) {
|
|
|
181 |
MaxHour = 23;
|
|
|
182 |
MinHour = 0;
|
|
|
183 |
}
|
|
|
184 |
else if (TimeMode === 12) {
|
|
|
185 |
MaxHour = 12;
|
|
|
186 |
MinHour = 1;
|
|
|
187 |
}
|
|
|
188 |
else {
|
|
|
189 |
alert("TimeMode can only be 12 or 24");
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) > MaxHour)) {
|
|
|
193 |
intHour = MinHour;
|
|
|
194 |
}
|
|
|
195 |
|
|
|
196 |
else if ((HourExp.test(intHour) || SingleDigit.test(intHour)) && (parseInt(intHour, 10) < MinHour)) {
|
|
|
197 |
intHour = MaxHour;
|
|
|
198 |
}
|
|
|
199 |
|
|
|
200 |
intHour = parseInt(intHour, 10);
|
|
|
201 |
if (SingleDigit.test(intHour)) {
|
|
|
202 |
intHour = "0" + intHour;
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
if (HourExp.test(intHour) && (parseInt(intHour, 10) <= MaxHour) && (parseInt(intHour, 10) >= MinHour)) {
|
|
|
206 |
if ((TimeMode === 12) && (Cal.AMorPM === "PM")) {
|
|
|
207 |
if (parseInt(intHour, 10) === 12) {
|
|
|
208 |
Cal.Hours = 12;
|
|
|
209 |
}
|
|
|
210 |
else {
|
|
|
211 |
Cal.Hours = parseInt(intHour, 10) + 12;
|
|
|
212 |
}
|
|
|
213 |
}
|
|
|
214 |
|
|
|
215 |
else if ((TimeMode === 12) && (Cal.AMorPM === "AM")) {
|
|
|
216 |
if (intHour === 12) {
|
|
|
217 |
intHour -= 12;
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
Cal.Hours = parseInt(intHour, 10);
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
else if (TimeMode === 24) {
|
|
|
224 |
Cal.Hours = parseInt(intHour, 10);
|
|
|
225 |
}
|
|
|
226 |
}
|
|
|
227 |
|
|
|
228 |
};
|
|
|
229 |
|
|
|
230 |
Calendar.prototype.SetMinute = function (intMin)
|
|
|
231 |
{
|
|
|
232 |
var MaxMin = 59,
|
|
|
233 |
MinMin = 0,
|
|
|
234 |
|
|
|
235 |
SingleDigit = new RegExp("\\d"),
|
|
|
236 |
SingleDigit2 = new RegExp("^\\d{1}$"),
|
|
|
237 |
MinExp = new RegExp("^\\d{2}$"),
|
|
|
238 |
|
|
|
239 |
strMin = 0;
|
|
|
240 |
|
|
|
241 |
if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) > MaxMin))
|
|
|
242 |
{
|
|
|
243 |
intMin = MinMin;
|
|
|
244 |
}
|
|
|
245 |
|
|
|
246 |
else if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) < MinMin))
|
|
|
247 |
{
|
|
|
248 |
intMin = MaxMin;
|
|
|
249 |
}
|
|
|
250 |
|
|
|
251 |
strMin = intMin + "";
|
|
|
252 |
if (SingleDigit2.test(intMin))
|
|
|
253 |
{
|
|
|
254 |
strMin = "0" + strMin;
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
if ((MinExp.test(intMin) || SingleDigit.test(intMin)) && (parseInt(intMin, 10) <= 59) && (parseInt(intMin, 10) >= 0))
|
|
|
258 |
{
|
|
|
259 |
Cal.Minutes = strMin;
|
|
|
260 |
}
|
|
|
261 |
};
|
|
|
262 |
|
|
|
263 |
Calendar.prototype.SetSecond = function (intSec)
|
|
|
264 |
{
|
|
|
265 |
var MaxSec = 59,
|
|
|
266 |
MinSec = 0,
|
|
|
267 |
|
|
|
268 |
SingleDigit = new RegExp("\\d"),
|
|
|
269 |
SingleDigit2 = new RegExp("^\\d{1}$"),
|
|
|
270 |
SecExp = new RegExp("^\\d{2}$"),
|
|
|
271 |
|
|
|
272 |
strSec = 0;
|
|
|
273 |
|
|
|
274 |
if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) > MaxSec))
|
|
|
275 |
{
|
|
|
276 |
intSec = MinSec;
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
else if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) < MinSec))
|
|
|
280 |
{
|
|
|
281 |
intSec = MaxSec;
|
|
|
282 |
}
|
|
|
283 |
|
|
|
284 |
strSec = intSec + "";
|
|
|
285 |
if (SingleDigit2.test(intSec))
|
|
|
286 |
{
|
|
|
287 |
strSec = "0" + strSec;
|
|
|
288 |
}
|
|
|
289 |
|
|
|
290 |
if ((SecExp.test(intSec) || SingleDigit.test(intSec)) && (parseInt(intSec, 10) <= 59) && (parseInt(intSec, 10) >= 0))
|
|
|
291 |
{
|
|
|
292 |
Cal.Seconds = strSec;
|
|
|
293 |
}
|
|
|
294 |
|
|
|
295 |
};
|
|
|
296 |
|
|
|
297 |
Calendar.prototype.SetAmPm = function (pvalue)
|
|
|
298 |
{
|
|
|
299 |
this.AMorPM = pvalue;
|
|
|
300 |
if (pvalue === "PM")
|
|
|
301 |
{
|
|
|
302 |
this.Hours = parseInt(this.Hours, 10) + 12;
|
|
|
303 |
if (this.Hours === 24)
|
|
|
304 |
{
|
|
|
305 |
this.Hours = 12;
|
|
|
306 |
}
|
|
|
307 |
}
|
|
|
308 |
|
|
|
309 |
else if (pvalue === "AM")
|
|
|
310 |
{
|
|
|
311 |
this.Hours -= 12;
|
|
|
312 |
}
|
|
|
313 |
};
|
|
|
314 |
|
|
|
315 |
Calendar.prototype.getShowHour = function() {
|
|
|
316 |
var finalHour;
|
|
|
317 |
|
|
|
318 |
if (TimeMode === 12) {
|
|
|
319 |
if (parseInt(this.Hours, 10) === 0) {
|
|
|
320 |
this.AMorPM = "AM";
|
|
|
321 |
finalHour = parseInt(this.Hours, 10) + 12;
|
|
|
322 |
}
|
|
|
323 |
|
|
|
324 |
else if (parseInt(this.Hours, 10) === 12) {
|
|
|
325 |
this.AMorPM = "PM";
|
|
|
326 |
finalHour = 12;
|
|
|
327 |
}
|
|
|
328 |
|
|
|
329 |
else if (this.Hours > 12) {
|
|
|
330 |
this.AMorPM = "PM";
|
|
|
331 |
if ((this.Hours - 12) < 10) {
|
|
|
332 |
finalHour = "0" + ((parseInt(this.Hours, 10)) - 12);
|
|
|
333 |
}
|
|
|
334 |
else {
|
|
|
335 |
finalHour = parseInt(this.Hours, 10) - 12;
|
|
|
336 |
}
|
|
|
337 |
}
|
|
|
338 |
else {
|
|
|
339 |
this.AMorPM = "AM";
|
|
|
340 |
if (this.Hours < 10) {
|
|
|
341 |
finalHour = "0" + parseInt(this.Hours, 10);
|
|
|
342 |
}
|
|
|
343 |
else {
|
|
|
344 |
finalHour = this.Hours;
|
|
|
345 |
}
|
|
|
346 |
}
|
|
|
347 |
}
|
|
|
348 |
|
|
|
349 |
else if (TimeMode === 24) {
|
|
|
350 |
if (this.Hours < 10) {
|
|
|
351 |
finalHour = "0" + parseInt(this.Hours, 10);
|
|
|
352 |
}
|
|
|
353 |
else {
|
|
|
354 |
finalHour = this.Hours;
|
|
|
355 |
}
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
return finalHour;
|
|
|
359 |
};
|
|
|
360 |
|
|
|
361 |
Calendar.prototype.getShowAMorPM = function ()
|
|
|
362 |
{
|
|
|
363 |
return this.AMorPM;
|
|
|
364 |
};
|
|
|
365 |
|
|
|
366 |
Calendar.prototype.GetMonthName = function (IsLong)
|
|
|
367 |
{
|
|
|
368 |
var Month = MonthName[this.Month];
|
|
|
369 |
if (IsLong)
|
|
|
370 |
{
|
|
|
371 |
return Month;
|
|
|
372 |
}
|
|
|
373 |
else
|
|
|
374 |
{
|
|
|
375 |
return Month.substr(0, 3);
|
|
|
376 |
}
|
|
|
377 |
};
|
|
|
378 |
|
|
|
379 |
Calendar.prototype.GetMonDays = function() { //Get number of days in a month
|
|
|
380 |
|
|
|
381 |
var DaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
|
382 |
if (Cal.IsLeapYear()) {
|
|
|
383 |
DaysInMonth[1] = 29;
|
|
|
384 |
}
|
|
|
385 |
|
|
|
386 |
return DaysInMonth[this.Month];
|
|
|
387 |
};
|
|
|
388 |
|
|
|
389 |
Calendar.prototype.IsLeapYear = function ()
|
|
|
390 |
{
|
|
|
391 |
if ((this.Year % 4) === 0)
|
|
|
392 |
{
|
|
|
393 |
if ((this.Year % 100 === 0) && (this.Year % 400) !== 0)
|
|
|
394 |
{
|
|
|
395 |
return false;
|
|
|
396 |
}
|
|
|
397 |
else
|
|
|
398 |
{
|
|
|
399 |
return true;
|
|
|
400 |
}
|
|
|
401 |
}
|
|
|
402 |
else
|
|
|
403 |
{
|
|
|
404 |
return false;
|
|
|
405 |
}
|
|
|
406 |
};
|
|
|
407 |
|
|
|
408 |
Calendar.prototype.FormatDate = function (pDate)
|
|
|
409 |
{
|
|
|
410 |
var MonthDigit = this.Month + 1;
|
|
|
411 |
if (PrecedeZero === true)
|
|
|
412 |
{
|
|
|
413 |
if ((pDate < 10) && String(pDate).length===1) //length checking added in version 2.2
|
|
|
414 |
{
|
|
|
415 |
pDate = "0" + pDate;
|
|
|
416 |
}
|
|
|
417 |
if (MonthDigit < 10)
|
|
|
418 |
{
|
|
|
419 |
MonthDigit = "0" + MonthDigit;
|
|
|
420 |
}
|
|
|
421 |
}
|
|
|
422 |
|
|
|
423 |
switch (this.Format.toUpperCase())
|
|
|
424 |
{
|
|
|
425 |
case "DDMMYYYY":
|
|
|
426 |
return (pDate + DateSeparator + MonthDigit + DateSeparator + this.Year);
|
|
|
427 |
case "DDMMMYYYY":
|
|
|
428 |
return (pDate + DateSeparator + this.GetMonthName(false) + DateSeparator + this.Year);
|
|
|
429 |
case "MMDDYYYY":
|
|
|
430 |
return (MonthDigit + DateSeparator + pDate + DateSeparator + this.Year);
|
|
|
431 |
case "MMMDDYYYY":
|
|
|
432 |
return (this.GetMonthName(false) + DateSeparator + pDate + DateSeparator + this.Year);
|
|
|
433 |
case "YYYYMMDD":
|
|
|
434 |
return (this.Year + DateSeparator + MonthDigit + DateSeparator + pDate);
|
|
|
435 |
case "YYMMDD":
|
|
|
436 |
return (String(this.Year).substring(2, 4) + DateSeparator + MonthDigit + DateSeparator + pDate);
|
|
|
437 |
case "YYMMMDD":
|
|
|
438 |
return (String(this.Year).substring(2, 4) + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
|
|
|
439 |
case "YYYYMMMDD":
|
|
|
440 |
return (this.Year + DateSeparator + this.GetMonthName(false) + DateSeparator + pDate);
|
|
|
441 |
default:
|
|
|
442 |
return (pDate + DateSeparator + (this.Month + 1) + DateSeparator + this.Year);
|
|
|
443 |
}
|
|
|
444 |
};
|
|
|
445 |
|
|
|
446 |
// end Calendar prototype
|
|
|
447 |
|
|
|
448 |
function GenCell(pValue, pHighLight, pColor, pClickable)
|
|
|
449 |
{ //Generate table cell with value
|
|
|
450 |
var PValue,
|
|
|
451 |
PCellStr,
|
|
|
452 |
PClickable,
|
|
|
453 |
vTimeStr;
|
|
|
454 |
|
|
|
455 |
if (!pValue)
|
|
|
456 |
{
|
|
|
457 |
PValue = "";
|
|
|
458 |
}
|
|
|
459 |
else
|
|
|
460 |
{
|
|
|
461 |
PValue = pValue;
|
|
|
462 |
}
|
|
|
463 |
|
|
|
464 |
if (pColor === undefined)
|
|
|
465 |
pColor = CalBgColor;
|
|
|
466 |
|
|
|
467 |
if (pClickable !== undefined){
|
|
|
468 |
PClickable = pClickable;
|
|
|
469 |
}
|
|
|
470 |
else{
|
|
|
471 |
PClickable = true;
|
|
|
472 |
}
|
|
|
473 |
|
|
|
474 |
if (Cal.ShowTime)
|
|
|
475 |
{
|
|
|
476 |
vTimeStr = ' ' + Cal.Hours + ':' + Cal.Minutes;
|
|
|
477 |
if (Cal.ShowSeconds)
|
|
|
478 |
{
|
|
|
479 |
vTimeStr += ':' + Cal.Seconds;
|
|
|
480 |
}
|
|
|
481 |
if (TimeMode === 12)
|
|
|
482 |
{
|
|
|
483 |
vTimeStr += ' ' + Cal.AMorPM;
|
|
|
484 |
}
|
|
|
485 |
}
|
|
|
486 |
|
|
|
487 |
else
|
|
|
488 |
{
|
|
|
489 |
vTimeStr = "";
|
|
|
490 |
}
|
|
|
491 |
|
|
|
492 |
if (PValue !== "")
|
|
|
493 |
{
|
|
|
494 |
if (PClickable === true) {
|
|
|
495 |
if (Cal.ShowTime === true)
|
|
|
496 |
{ PCellStr = "<td id='c" + PValue + "' class='calTD' style='text-align:center;cursor:pointer;background-color:"+pColor+"' onmousedown='selectDate(this," + PValue + ");'>" + PValue + "</td>"; }
|
|
|
497 |
else { PCellStr = "<td class='calTD' style='text-align:center;cursor:pointer;background-color:" + pColor + "' onmouseover='changeBorder(this, 0);' onmouseout=\"changeBorder(this, 1, '" + pColor + "');\" onClick=\"javascript:callback('" + Cal.Ctrl + "','" + Cal.FormatDate(PValue) + "');\">" + PValue + "</td>"; }
|
|
|
498 |
}
|
|
|
499 |
else
|
|
|
500 |
{ PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'>"+PValue+"</td>"; }
|
|
|
501 |
}
|
|
|
502 |
else
|
|
|
503 |
{ PCellStr = "<td style='text-align:center;background-color:"+pColor+"' class='calTD'> </td>"; }
|
|
|
504 |
|
|
|
505 |
return PCellStr;
|
|
|
506 |
}
|
|
|
507 |
|
|
|
508 |
function RenderCssCal(bNewCal)
|
|
|
509 |
{
|
|
|
510 |
if (typeof bNewCal === "undefined" || bNewCal !== true)
|
|
|
511 |
{
|
|
|
512 |
bNewCal = false;
|
|
|
513 |
}
|
|
|
514 |
var vCalHeader,
|
|
|
515 |
vCalData,
|
|
|
516 |
vCalTime = "",
|
|
|
517 |
vCalClosing = "",
|
|
|
518 |
winCalData = "",
|
|
|
519 |
CalDate,
|
|
|
520 |
|
|
|
521 |
i,
|
|
|
522 |
j,
|
|
|
523 |
|
|
|
524 |
SelectStr,
|
|
|
525 |
vDayCount = 0,
|
|
|
526 |
vFirstDay,
|
|
|
527 |
|
|
|
528 |
WeekDayName = [],//Added version 1.7
|
|
|
529 |
strCell,
|
|
|
530 |
|
|
|
531 |
showHour,
|
|
|
532 |
ShowArrows = false,
|
|
|
533 |
HourCellWidth = "35px", //cell width with seconds.
|
|
|
534 |
|
|
|
535 |
SelectAm,
|
|
|
536 |
SelectPm,
|
|
|
537 |
|
|
|
538 |
funcCalback,
|
|
|
539 |
|
|
|
540 |
headID,
|
|
|
541 |
e,
|
|
|
542 |
cssStr,
|
|
|
543 |
style,
|
|
|
544 |
cssText,
|
|
|
545 |
span;
|
|
|
546 |
|
|
|
547 |
calHeight = 0; // reset the window height on refresh
|
|
|
548 |
|
|
|
549 |
// Set the default cursor for the calendar
|
|
|
550 |
|
|
|
551 |
winCalData = "<span style='cursor:auto;'>";
|
|
|
552 |
vCalHeader = "<table style='background-color:"+CalBgColor+";width:200px;padding:0;margin:5px auto 5px auto'><tbody>";
|
|
|
553 |
|
|
|
554 |
//Table for Month & Year Selector
|
|
|
555 |
|
|
|
556 |
vCalHeader += "<tr><td colspan='7'><table border='0' width='200px' cellpadding='0' cellspacing='0'><tr>";
|
|
|
557 |
//******************Month and Year selector in dropdown list************************
|
|
|
558 |
|
|
|
559 |
if (Cal.Scroller === "DROPDOWN")
|
|
|
560 |
{
|
|
|
561 |
vCalHeader += "<td align='center'><select name='MonthSelector' onChange='javascript:Cal.SwitchMth(this.selectedIndex);RenderCssCal();'>";
|
|
|
562 |
for (i = 0; i < 12; i += 1)
|
|
|
563 |
{
|
|
|
564 |
if (i === Cal.Month)
|
|
|
565 |
{
|
|
|
566 |
SelectStr = "Selected";
|
|
|
567 |
}
|
|
|
568 |
else
|
|
|
569 |
{
|
|
|
570 |
SelectStr = "";
|
|
|
571 |
}
|
|
|
572 |
vCalHeader += "<option " + SelectStr + " value=" + i + ">" + MonthName[i] + "</option>";
|
|
|
573 |
}
|
|
|
574 |
|
|
|
575 |
vCalHeader += "</select></td>";
|
|
|
576 |
//Year selector
|
|
|
577 |
|
|
|
578 |
vCalHeader += "<td align='center'><select name='YearSelector' size='1' onChange='javascript:Cal.SwitchYear(this.value);RenderCssCal();'>";
|
|
|
579 |
for (i = StartYear; i <= (dtToday.getFullYear() + EndYear); i += 1)
|
|
|
580 |
{
|
|
|
581 |
if (i === Cal.Year)
|
|
|
582 |
{
|
|
|
583 |
SelectStr = 'selected="selected"';
|
|
|
584 |
}
|
|
|
585 |
else
|
|
|
586 |
{
|
|
|
587 |
SelectStr = '';
|
|
|
588 |
}
|
|
|
589 |
vCalHeader += "<option " + SelectStr + " value=" + i + ">" + i + "</option>\n";
|
|
|
590 |
}
|
|
|
591 |
vCalHeader += "</select></td>\n";
|
|
|
592 |
calHeight += 30;
|
|
|
593 |
}
|
|
|
594 |
|
|
|
595 |
//******************End Month and Year selector in dropdown list*********************
|
|
|
596 |
|
|
|
597 |
//******************Month and Year selector in arrow*********************************
|
|
|
598 |
|
|
|
599 |
else if (Cal.Scroller === "ARROW")
|
|
|
600 |
{
|
|
|
601 |
if (UseImageFiles)
|
|
|
602 |
{
|
|
|
603 |
vCalHeader += "<td><img onmousedown='javascript:Cal.DecYear();RenderCssCal();' src='"+imageFilesPath+"cal_fastreverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n";//Year scroller (decrease 1 year)
|
|
|
604 |
vCalHeader += "<td><img onmousedown='javascript:Cal.DecMonth();RenderCssCal();' src='" + imageFilesPath + "cal_reverse.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (decrease 1 month)
|
|
|
605 |
vCalHeader += "<td width='70%' class='calR' style='color:"+YrSelColor+"'>"+ Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>"; //Month and Year
|
|
|
606 |
vCalHeader += "<td><img onmousedown='javascript:Cal.IncMonth();RenderCssCal();' src='" + imageFilesPath + "cal_forward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Month scroller (increase 1 month)
|
|
|
607 |
vCalHeader += "<td><img onmousedown='javascript:Cal.IncYear();RenderCssCal();' src='" + imageFilesPath + "cal_fastforward.gif' width='13px' height='9' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>\n"; //Year scroller (increase 1 year)
|
|
|
608 |
calHeight += 22;
|
|
|
609 |
}
|
|
|
610 |
else
|
|
|
611 |
{
|
|
|
612 |
vCalHeader += "<td><span id='dec_year' title='reverse year' onmousedown='javascript:Cal.DecYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>-</span></td>";//Year scroller (decrease 1 year)
|
|
|
613 |
vCalHeader += "<td><span id='dec_month' title='reverse month' onmousedown='javascript:Cal.DecMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'><</span></td>\n";//Month scroller (decrease 1 month)
|
|
|
614 |
vCalHeader += "<td width='70%' class='calR' style='color:" + YrSelColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td>\n"; //Month and Year
|
|
|
615 |
vCalHeader += "<td><span id='inc_month' title='forward month' onmousedown='javascript:Cal.IncMonth();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'>></span></td>\n";//Month scroller (increase 1 month)
|
|
|
616 |
vCalHeader += "<td><span id='inc_year' title='forward year' onmousedown='javascript:Cal.IncYear();RenderCssCal();' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white; color:" + YrSelColor + "'>+</span></td>\n";//Year scroller (increase 1 year)
|
|
|
617 |
calHeight += 22;
|
|
|
618 |
}
|
|
|
619 |
}
|
|
|
620 |
|
|
|
621 |
vCalHeader += "</tr></table></td></tr>";
|
|
|
622 |
|
|
|
623 |
//******************End Month and Year selector in arrow******************************
|
|
|
624 |
|
|
|
625 |
//Calendar header shows Month and Year
|
|
|
626 |
if (ShowMonthYear && Cal.Scroller === "DROPDOWN")
|
|
|
627 |
{
|
|
|
628 |
vCalHeader += "<tr><td colspan='7' class='calR' style='color:" + MonthYearColor + "'>" + Cal.GetMonthName(ShowLongMonth) + " " + Cal.Year + "</td></tr>";
|
|
|
629 |
calHeight += 19;
|
|
|
630 |
}
|
|
|
631 |
|
|
|
632 |
//Week day header
|
|
|
633 |
|
|
|
634 |
vCalHeader += "<tr><td colspan=\"7\"><table style='border-spacing:1px;border-collapse:separate;'><tr>";
|
|
|
635 |
if (MondayFirstDay === true)
|
|
|
636 |
{
|
|
|
637 |
WeekDayName = WeekDayName2;
|
|
|
638 |
}
|
|
|
639 |
else
|
|
|
640 |
{
|
|
|
641 |
WeekDayName = WeekDayName1;
|
|
|
642 |
}
|
|
|
643 |
for (i = 0; i < 7; i += 1)
|
|
|
644 |
{
|
|
|
645 |
vCalHeader += "<td style='background-color:"+WeekHeadColor+";width:"+CellWidth+"px;color:#FFFFFF' class='calTD'>" + WeekDayName[i].substr(0, WeekChar) + "</td>";
|
|
|
646 |
}
|
|
|
647 |
|
|
|
648 |
calHeight += 19;
|
|
|
649 |
vCalHeader += "</tr>";
|
|
|
650 |
//Calendar detail
|
|
|
651 |
CalDate = new Date(Cal.Year, Cal.Month);
|
|
|
652 |
CalDate.setDate(1);
|
|
|
653 |
|
|
|
654 |
vFirstDay = CalDate.getDay();
|
|
|
655 |
|
|
|
656 |
//Added version 1.7
|
|
|
657 |
if (MondayFirstDay === true)
|
|
|
658 |
{
|
|
|
659 |
vFirstDay -= 1;
|
|
|
660 |
if (vFirstDay === -1)
|
|
|
661 |
{
|
|
|
662 |
vFirstDay = 6;
|
|
|
663 |
}
|
|
|
664 |
}
|
|
|
665 |
|
|
|
666 |
//Added version 1.7
|
|
|
667 |
vCalData = "<tr>";
|
|
|
668 |
calHeight += 19;
|
|
|
669 |
for (i = 0; i < vFirstDay; i += 1)
|
|
|
670 |
{
|
|
|
671 |
vCalData = vCalData + GenCell();
|
|
|
672 |
vDayCount = vDayCount + 1;
|
|
|
673 |
}
|
|
|
674 |
|
|
|
675 |
//Added version 1.7
|
|
|
676 |
for (j = 1; j <= Cal.GetMonDays(); j += 1)
|
|
|
677 |
{
|
|
|
678 |
if ((vDayCount % 7 === 0) && (j > 1))
|
|
|
679 |
{
|
|
|
680 |
vCalData = vCalData + "<tr>";
|
|
|
681 |
}
|
|
|
682 |
|
|
|
683 |
vDayCount = vDayCount + 1;
|
|
|
684 |
//added version 2.1.2
|
|
|
685 |
if (Cal.EnableDateMode === "future" && ((j < dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Month < dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Year < dtToday.getFullYear())))
|
|
|
686 |
{
|
|
|
687 |
strCell = GenCell(j, false, DisableColor, false); //Before today's date is not clickable
|
|
|
688 |
}
|
|
|
689 |
// FIX
|
|
|
690 |
// FIXED PAST DATE TO INCLUDE TODAY's DATE
|
|
|
691 |
// FIX
|
|
|
692 |
else if (Cal.EnableDateMode === "past" && ((j > dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Month > dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()) || (Cal.Year > dtToday.getFullYear()))) {
|
|
|
693 |
strCell = GenCell(j, false, DisableColor, false); //After today's date is not clickable
|
|
|
694 |
}
|
|
|
695 |
//if End Year + Current Year = Cal.Year. Disable.
|
|
|
696 |
else if (Cal.Year > (dtToday.getFullYear()+EndYear))
|
|
|
697 |
{
|
|
|
698 |
strCell = GenCell(j, false, DisableColor, false);
|
|
|
699 |
}
|
|
|
700 |
else if ((j === dtToday.getDate()) && (Cal.Month === dtToday.getMonth()) && (Cal.Year === dtToday.getFullYear()))
|
|
|
701 |
{
|
|
|
702 |
strCell = GenCell(j, true, TodayColor);//Highlight today's date
|
|
|
703 |
}
|
|
|
704 |
else
|
|
|
705 |
{
|
|
|
706 |
if ((j === selDate.getDate()) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())){
|
|
|
707 |
//modified version 1.7
|
|
|
708 |
strCell = GenCell(j, true, SelDateColor);
|
|
|
709 |
}
|
|
|
710 |
else
|
|
|
711 |
{
|
|
|
712 |
if (MondayFirstDay === true)
|
|
|
713 |
{
|
|
|
714 |
if (vDayCount % 7 === 0)
|
|
|
715 |
{
|
|
|
716 |
strCell = GenCell(j, false, SundayColor);
|
|
|
717 |
}
|
|
|
718 |
else if ((vDayCount + 1) % 7 === 0)
|
|
|
719 |
{
|
|
|
720 |
strCell = GenCell(j, false, SaturdayColor);
|
|
|
721 |
}
|
|
|
722 |
else
|
|
|
723 |
{
|
|
|
724 |
strCell = GenCell(j, null, WeekDayColor);
|
|
|
725 |
}
|
|
|
726 |
}
|
|
|
727 |
else
|
|
|
728 |
{
|
|
|
729 |
if (vDayCount % 7 === 0)
|
|
|
730 |
{
|
|
|
731 |
strCell = GenCell(j, false, SaturdayColor);
|
|
|
732 |
}
|
|
|
733 |
else if ((vDayCount + 6) % 7 === 0)
|
|
|
734 |
{
|
|
|
735 |
strCell = GenCell(j, false, SundayColor);
|
|
|
736 |
}
|
|
|
737 |
else
|
|
|
738 |
{
|
|
|
739 |
strCell = GenCell(j, null, WeekDayColor);
|
|
|
740 |
}
|
|
|
741 |
}
|
|
|
742 |
}
|
|
|
743 |
}
|
|
|
744 |
|
|
|
745 |
vCalData = vCalData + strCell;
|
|
|
746 |
|
|
|
747 |
if ((vDayCount % 7 === 0) && (j < Cal.GetMonDays()))
|
|
|
748 |
{
|
|
|
749 |
vCalData = vCalData + "</tr>";
|
|
|
750 |
calHeight += 19;
|
|
|
751 |
}
|
|
|
752 |
}
|
|
|
753 |
|
|
|
754 |
// finish the table proper
|
|
|
755 |
|
|
|
756 |
if (vDayCount % 7 !== 0)
|
|
|
757 |
{
|
|
|
758 |
while (vDayCount % 7 !== 0)
|
|
|
759 |
{
|
|
|
760 |
vCalData = vCalData + GenCell();
|
|
|
761 |
vDayCount = vDayCount + 1;
|
|
|
762 |
}
|
|
|
763 |
}
|
|
|
764 |
|
|
|
765 |
vCalData = vCalData + "</table></td></tr>";
|
|
|
766 |
|
|
|
767 |
|
|
|
768 |
//Time picker
|
|
|
769 |
if (Cal.ShowTime === true)
|
|
|
770 |
{
|
|
|
771 |
showHour = Cal.getShowHour();
|
|
|
772 |
|
|
|
773 |
if (Cal.ShowSeconds === false && TimeMode === 24)
|
|
|
774 |
{
|
|
|
775 |
ShowArrows = true;
|
|
|
776 |
HourCellWidth = "10px";
|
|
|
777 |
}
|
|
|
778 |
|
|
|
779 |
vCalTime = "<tr><td colspan='7' style=\"text-align:center;\"><table border='0' width='199px' cellpadding='0' cellspacing='0'><tbody><tr><td height='5px' width='" + HourCellWidth + "'> </td>";
|
|
|
780 |
|
|
|
781 |
if (ShowArrows && UseImageFiles) //this is where the up and down arrow control the hour.
|
|
|
782 |
{
|
|
|
783 |
vCalTime += "<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%;'><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"plus\");' onmousedown='startSpin(\"Hour\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onclick='nextStep(\"Hour\", \"minus\");' onmousedown='startSpin(\"Hour\", \"minus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table></td>\n";
|
|
|
784 |
}
|
|
|
785 |
|
|
|
786 |
vCalTime += "<td width='28px'><input type='text' name='hour' maxlength=2 size=1 style=\"WIDTH:28px\" value=" + showHour + " onkeyup=\"javascript:Cal.SetHour(this.value)\">";
|
|
|
787 |
vCalTime += "</td><td style='font-weight:bold;text-align:center;'>:</td><td width='28px'>";
|
|
|
788 |
vCalTime += "<input type='text' name='minute' maxlength=2 size=1 style=\"WIDTH: 28px\" value=" + Cal.Minutes + " onkeyup=\"javascript:Cal.SetMinute(this.value)\">";
|
|
|
789 |
|
|
|
790 |
if (Cal.ShowSeconds)
|
|
|
791 |
{
|
|
|
792 |
vCalTime += "</td><td style='font-weight:bold;'>:</td><td width='28px'>";
|
|
|
793 |
vCalTime += "<input type='text' name='second' maxlength=2 size=1 style=\"WIDTH: 28px\" value=" + Cal.Seconds + " onkeyup=\"javascript:Cal.SetSecond(parseInt(this.value,10))\">";
|
|
|
794 |
}
|
|
|
795 |
|
|
|
796 |
if (TimeMode === 12)
|
|
|
797 |
{
|
|
|
798 |
SelectAm = (Cal.AMorPM === "AM") ? "Selected" : "";
|
|
|
799 |
SelectPm = (Cal.AMorPM === "PM") ? "Selected" : "";
|
|
|
800 |
|
|
|
801 |
vCalTime += "</td><td>";
|
|
|
802 |
vCalTime += "<select name=\"ampm\" onChange=\"javascript:Cal.SetAmPm(this.options[this.selectedIndex].value);\">\n";
|
|
|
803 |
vCalTime += "<option " + SelectAm + " value=\"AM\">AM</option>";
|
|
|
804 |
vCalTime += "<option " + SelectPm + " value=\"PM\">PM<option>";
|
|
|
805 |
vCalTime += "</select>";
|
|
|
806 |
}
|
|
|
807 |
|
|
|
808 |
if (ShowArrows && UseImageFiles) //this is where the up and down arrow to change the "Minute".
|
|
|
809 |
{
|
|
|
810 |
vCalTime += "</td>\n<td style='vertical-align:middle;'><table cellspacing='0' cellpadding='0' style='line-height:0pt;width:100%'><tr><td style='text-align:center;'><img onclick='nextStep(\"Minute\", \"plus\");' onmousedown='startSpin(\"Minute\", \"plus\");' onmouseup='stopSpin();' src='" + imageFilesPath + "cal_plus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr><tr><td style='text-align:center;'><img onmousedown='startSpin(\"Minute\", \"minus\");' onmouseup='stopSpin();' onclick='nextStep(\"Minute\",\"minus\");' src='" + imageFilesPath + "cal_minus.gif' width='13px' height='9px' onmouseover='changeBorder(this, 0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td></tr></table>";
|
|
|
811 |
}
|
|
|
812 |
|
|
|
813 |
vCalTime += "</td>\n<td align='right' valign='bottom' width='" + HourCellWidth + "px'></td></tr>";
|
|
|
814 |
vCalTime += "<tr><td colspan='8' style=\"text-align:center;\"><input style='width:60px;font-size:12px;' onClick='javascript:closewin(\"" + Cal.Ctrl + "\");' type=\"button\" value=\"OK\"> <input style='width:60px;font-size:12px;' onClick='javascript: winCal.style.visibility = \"hidden\"' type=\"button\" value=\"Cancel\"></td></tr>";
|
|
|
815 |
}
|
|
|
816 |
else //if not to show time.
|
|
|
817 |
{
|
|
|
818 |
vCalTime += "\n<tr>\n<td colspan='7' style=\"text-align:right;\">";
|
|
|
819 |
//close button
|
|
|
820 |
if (UseImageFiles) {
|
|
|
821 |
vCalClosing += "<img onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\"); stopSpin();' src='"+imageFilesPath+"cal_close.gif' width='16px' height='14px' onmouseover='changeBorder(this,0)' onmouseout='changeBorder(this, 1)' style='border:1px solid white'></td>";
|
|
|
822 |
}
|
|
|
823 |
else {
|
|
|
824 |
vCalClosing += "<span id='close_cal' title='close'onmousedown='javascript:closewin(\"" + Cal.Ctrl + "\");stopSpin();' onmouseover='changeBorder(this, 0)'onmouseout='changeBorder(this, 1)' style='border:1px solid white; font-family: Arial;font-size: 10pt;'>x</span></td>";
|
|
|
825 |
}
|
|
|
826 |
vCalClosing += "</tr>";
|
|
|
827 |
}
|
|
|
828 |
vCalClosing += "</tbody></table></td></tr>";
|
|
|
829 |
calHeight += 31;
|
|
|
830 |
vCalClosing += "</tbody></table>\n</span>";
|
|
|
831 |
|
|
|
832 |
//end time picker
|
|
|
833 |
funcCalback = "function callback(id, datum) {";
|
|
|
834 |
funcCalback += " var CalId = document.getElementById(id);if (datum=== 'undefined') { var d = new Date(); datum = d.getDate() + '/' +(d.getMonth()+1) + '/' + d.getFullYear(); } window.calDatum=datum;CalId.value=datum;";
|
|
|
835 |
funcCalback += " if(Cal.ShowTime){";
|
|
|
836 |
funcCalback += " CalId.value+=' '+Cal.getShowHour()+':'+Cal.Minutes;";
|
|
|
837 |
funcCalback += " if (Cal.ShowSeconds) CalId.value+=':'+Cal.Seconds;";
|
|
|
838 |
funcCalback += " if (TimeMode === 12) CalId.value+=''+Cal.getShowAMorPM();";
|
|
|
839 |
funcCalback += "}if(CalId.onchange!=undefined) CalId.onchange();CalId.focus();winCal.style.visibility='hidden';}";
|
|
|
840 |
|
|
|
841 |
|
|
|
842 |
// determines if there is enough space to open the cal above the position where it is called
|
|
|
843 |
if (ypos > calHeight)
|
|
|
844 |
{
|
|
|
845 |
ypos = ypos - calHeight;
|
|
|
846 |
}
|
|
|
847 |
|
|
|
848 |
if (!winCal)
|
|
|
849 |
{
|
|
|
850 |
headID = document.getElementsByTagName("head")[0];
|
|
|
851 |
|
|
|
852 |
// add javascript function to the span cal
|
|
|
853 |
e = document.createElement("script");
|
|
|
854 |
e.type = "text/javascript";
|
|
|
855 |
e.language = "javascript";
|
|
|
856 |
e.text = funcCalback;
|
|
|
857 |
headID.appendChild(e);
|
|
|
858 |
// add stylesheet to the span cal
|
|
|
859 |
|
|
|
860 |
cssStr = ".calTD {font-family: verdana; font-size: 12px; text-align: center; border:0; }\n";
|
|
|
861 |
cssStr += ".calR {font-family: verdana; font-size: 12px; text-align: center; font-weight: bold;}";
|
|
|
862 |
|
|
|
863 |
style = document.createElement("style");
|
|
|
864 |
style.type = "text/css";
|
|
|
865 |
style.rel = "stylesheet";
|
|
|
866 |
if (style.styleSheet)
|
|
|
867 |
{ // IE
|
|
|
868 |
style.styleSheet.cssText = cssStr;
|
|
|
869 |
}
|
|
|
870 |
|
|
|
871 |
else
|
|
|
872 |
{ // w3c
|
|
|
873 |
cssText = document.createTextNode(cssStr);
|
|
|
874 |
style.appendChild(cssText);
|
|
|
875 |
}
|
|
|
876 |
|
|
|
877 |
headID.appendChild(style);
|
|
|
878 |
// create the outer frame that allows the cal. to be moved
|
|
|
879 |
span = document.createElement("span");
|
|
|
880 |
span.id = calSpanID;
|
|
|
881 |
span.style.position = "absolute";
|
|
|
882 |
span.style.left = (xpos + CalPosOffsetX) + 'px';
|
|
|
883 |
span.style.top = (ypos - CalPosOffsetY) + 'px';
|
|
|
884 |
span.style.width = CalWidth + 'px';
|
|
|
885 |
span.style.border = "solid 1pt " + SpanBorderColor;
|
|
|
886 |
span.style.padding = "0";
|
|
|
887 |
span.style.cursor = "move";
|
|
|
888 |
span.style.backgroundColor = SpanBgColor;
|
|
|
889 |
span.style.zIndex = 100;
|
|
|
890 |
document.body.appendChild(span);
|
|
|
891 |
winCal = document.getElementById(calSpanID);
|
|
|
892 |
}
|
|
|
893 |
|
|
|
894 |
else
|
|
|
895 |
{
|
|
|
896 |
winCal.style.visibility = "visible";
|
|
|
897 |
winCal.style.Height = calHeight;
|
|
|
898 |
|
|
|
899 |
// set the position for a new calendar only
|
|
|
900 |
if (bNewCal === true)
|
|
|
901 |
{
|
|
|
902 |
winCal.style.left = (xpos + CalPosOffsetX) + 'px';
|
|
|
903 |
winCal.style.top = (ypos - CalPosOffsetY) + 'px';
|
|
|
904 |
}
|
|
|
905 |
}
|
|
|
906 |
|
|
|
907 |
winCal.innerHTML = winCalData + vCalHeader + vCalData + vCalTime + vCalClosing;
|
|
|
908 |
return true;
|
|
|
909 |
}
|
|
|
910 |
|
|
|
911 |
|
|
|
912 |
function NewCssCal(pCtrl, pFormat, pScroller, pShowTime, pTimeMode, pShowSeconds, pEnableDateMode)
|
|
|
913 |
{
|
|
|
914 |
// get current date and time
|
|
|
915 |
|
|
|
916 |
dtToday = new Date();
|
|
|
917 |
Cal = new Calendar(dtToday);
|
|
|
918 |
|
|
|
919 |
if (pShowTime !== undefined)
|
|
|
920 |
{
|
|
|
921 |
if (pShowTime) {
|
|
|
922 |
Cal.ShowTime = true;
|
|
|
923 |
}
|
|
|
924 |
else {
|
|
|
925 |
Cal.ShowTime = false;
|
|
|
926 |
}
|
|
|
927 |
|
|
|
928 |
if (pTimeMode)
|
|
|
929 |
{
|
|
|
930 |
pTimeMode = parseInt(pTimeMode, 10);
|
|
|
931 |
}
|
|
|
932 |
if (pTimeMode === 12 || pTimeMode === 24)
|
|
|
933 |
{
|
|
|
934 |
TimeMode = pTimeMode;
|
|
|
935 |
}
|
|
|
936 |
else
|
|
|
937 |
{
|
|
|
938 |
TimeMode = 24;
|
|
|
939 |
}
|
|
|
940 |
|
|
|
941 |
if (pShowSeconds !== undefined)
|
|
|
942 |
{
|
|
|
943 |
if (pShowSeconds)
|
|
|
944 |
{
|
|
|
945 |
Cal.ShowSeconds = true;
|
|
|
946 |
}
|
|
|
947 |
else
|
|
|
948 |
{
|
|
|
949 |
Cal.ShowSeconds = false;
|
|
|
950 |
}
|
|
|
951 |
}
|
|
|
952 |
else
|
|
|
953 |
{
|
|
|
954 |
Cal.ShowSeconds = false;
|
|
|
955 |
}
|
|
|
956 |
|
|
|
957 |
}
|
|
|
958 |
|
|
|
959 |
if (pCtrl !== undefined)
|
|
|
960 |
{
|
|
|
961 |
Cal.Ctrl = pCtrl;
|
|
|
962 |
}
|
|
|
963 |
|
|
|
964 |
if (pFormat!== undefined && pFormat !=="")
|
|
|
965 |
{
|
|
|
966 |
Cal.Format = pFormat.toUpperCase();
|
|
|
967 |
}
|
|
|
968 |
else
|
|
|
969 |
{
|
|
|
970 |
Cal.Format = "MMDDYYYY";
|
|
|
971 |
}
|
|
|
972 |
|
|
|
973 |
if (pScroller!== undefined && pScroller!=="")
|
|
|
974 |
{
|
|
|
975 |
if (pScroller.toUpperCase() === "ARROW")
|
|
|
976 |
{
|
|
|
977 |
Cal.Scroller = "ARROW";
|
|
|
978 |
}
|
|
|
979 |
else
|
|
|
980 |
{
|
|
|
981 |
Cal.Scroller = "DROPDOWN";
|
|
|
982 |
}
|
|
|
983 |
}
|
|
|
984 |
|
|
|
985 |
if (pEnableDateMode !== undefined && (pEnableDateMode === "future" || pEnableDateMode === "past")) {
|
|
|
986 |
Cal.EnableDateMode= pEnableDateMode;
|
|
|
987 |
}
|
|
|
988 |
|
|
|
989 |
exDateTime = document.getElementById(pCtrl).value; //Existing Date Time value in textbox.
|
|
|
990 |
|
|
|
991 |
if (exDateTime)
|
|
|
992 |
{ //Parse existing Date String
|
|
|
993 |
var Sp1 = exDateTime.indexOf(DateSeparator, 0),//Index of Date Separator 1
|
|
|
994 |
Sp2 = exDateTime.indexOf(DateSeparator, parseInt(Sp1, 10) + 1),//Index of Date Separator 2
|
|
|
995 |
tSp1,//Index of Time Separator 1
|
|
|
996 |
tSp2,//Index of Time Separator 2
|
|
|
997 |
strMonth,
|
|
|
998 |
strDate,
|
|
|
999 |
strYear,
|
|
|
1000 |
intMonth,
|
|
|
1001 |
YearPattern,
|
|
|
1002 |
strHour,
|
|
|
1003 |
strMinute,
|
|
|
1004 |
strSecond,
|
|
|
1005 |
winHeight,
|
|
|
1006 |
offset = parseInt(Cal.Format.toUpperCase().lastIndexOf("M"), 10) - parseInt(Cal.Format.toUpperCase().indexOf("M"), 10) - 1,
|
|
|
1007 |
strAMPM = "";
|
|
|
1008 |
//parse month
|
|
|
1009 |
|
|
|
1010 |
if (Cal.Format.toUpperCase() === "DDMMYYYY" || Cal.Format.toUpperCase() === "DDMMMYYYY")
|
|
|
1011 |
{
|
|
|
1012 |
if (DateSeparator === "")
|
|
|
1013 |
{
|
|
|
1014 |
strMonth = exDateTime.substring(2, 4 + offset);
|
|
|
1015 |
strDate = exDateTime.substring(0, 2);
|
|
|
1016 |
strYear = exDateTime.substring(4 + offset, 8 + offset);
|
|
|
1017 |
}
|
|
|
1018 |
else
|
|
|
1019 |
{
|
|
|
1020 |
if (exDateTime.indexOf("D*") !== -1)
|
|
|
1021 |
{ //DTG
|
|
|
1022 |
strMonth = exDateTime.substring(8, 11);
|
|
|
1023 |
strDate = exDateTime.substring(0, 2);
|
|
|
1024 |
strYear = "20" + exDateTime.substring(11, 13); //Hack, nur für Jahreszahlen ab 2000
|
|
|
1025 |
}
|
|
|
1026 |
else
|
|
|
1027 |
{
|
|
|
1028 |
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
|
|
|
1029 |
strDate = exDateTime.substring(0, Sp1);
|
|
|
1030 |
strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
|
|
|
1031 |
}
|
|
|
1032 |
}
|
|
|
1033 |
}
|
|
|
1034 |
|
|
|
1035 |
else if (Cal.Format.toUpperCase() === "MMDDYYYY" || Cal.Format.toUpperCase() === "MMMDDYYYY"){
|
|
|
1036 |
if (DateSeparator === ""){
|
|
|
1037 |
strMonth = exDateTime.substring(0, 2 + offset);
|
|
|
1038 |
strDate = exDateTime.substring(2 + offset, 4 + offset);
|
|
|
1039 |
strYear = exDateTime.substring(4 + offset, 8 + offset);
|
|
|
1040 |
}
|
|
|
1041 |
else{
|
|
|
1042 |
strMonth = exDateTime.substring(0, Sp1);
|
|
|
1043 |
strDate = exDateTime.substring(Sp1 + 1, Sp2);
|
|
|
1044 |
strYear = exDateTime.substring(Sp2 + 1, Sp2 + 5);
|
|
|
1045 |
}
|
|
|
1046 |
}
|
|
|
1047 |
|
|
|
1048 |
else if (Cal.Format.toUpperCase() === "YYYYMMDD" || Cal.Format.toUpperCase() === "YYYYMMMDD")
|
|
|
1049 |
{
|
|
|
1050 |
if (DateSeparator === ""){
|
|
|
1051 |
strMonth = exDateTime.substring(4, 6 + offset);
|
|
|
1052 |
strDate = exDateTime.substring(6 + offset, 8 + offset);
|
|
|
1053 |
strYear = exDateTime.substring(0, 4);
|
|
|
1054 |
}
|
|
|
1055 |
else{
|
|
|
1056 |
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
|
|
|
1057 |
strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
|
|
|
1058 |
strYear = exDateTime.substring(0, Sp1);
|
|
|
1059 |
}
|
|
|
1060 |
}
|
|
|
1061 |
|
|
|
1062 |
else if (Cal.Format.toUpperCase() === "YYMMDD" || Cal.Format.toUpperCase() === "YYMMMDD")
|
|
|
1063 |
{
|
|
|
1064 |
if (DateSeparator === "")
|
|
|
1065 |
{
|
|
|
1066 |
strMonth = exDateTime.substring(2, 4 + offset);
|
|
|
1067 |
strDate = exDateTime.substring(4 + offset, 6 + offset);
|
|
|
1068 |
strYear = exDateTime.substring(0, 2);
|
|
|
1069 |
}
|
|
|
1070 |
else
|
|
|
1071 |
{
|
|
|
1072 |
strMonth = exDateTime.substring(Sp1 + 1, Sp2);
|
|
|
1073 |
strDate = exDateTime.substring(Sp2 + 1, Sp2 + 3);
|
|
|
1074 |
strYear = exDateTime.substring(0, Sp1);
|
|
|
1075 |
}
|
|
|
1076 |
}
|
|
|
1077 |
|
|
|
1078 |
if (isNaN(strMonth)){
|
|
|
1079 |
intMonth = Cal.GetMonthIndex(strMonth);
|
|
|
1080 |
}
|
|
|
1081 |
else{
|
|
|
1082 |
intMonth = parseInt(strMonth, 10) - 1;
|
|
|
1083 |
}
|
|
|
1084 |
if ((parseInt(intMonth, 10) >= 0) && (parseInt(intMonth, 10) < 12)) {
|
|
|
1085 |
Cal.Month = intMonth;
|
|
|
1086 |
}
|
|
|
1087 |
//end parse month
|
|
|
1088 |
|
|
|
1089 |
//parse year
|
|
|
1090 |
YearPattern = /^\d{4}$/;
|
|
|
1091 |
if (YearPattern.test(strYear)) {
|
|
|
1092 |
if ((parseInt(strYear, 10)>=StartYear) && (parseInt(strYear, 10)<= (dtToday.getFullYear()+EndYear)))
|
|
|
1093 |
Cal.Year = parseInt(strYear, 10);
|
|
|
1094 |
}
|
|
|
1095 |
//end parse year
|
|
|
1096 |
|
|
|
1097 |
//parse Date
|
|
|
1098 |
if ((parseInt(strDate, 10) <= Cal.GetMonDays()) && (parseInt(strDate, 10) >= 1)) {
|
|
|
1099 |
Cal.Date = strDate;
|
|
|
1100 |
}
|
|
|
1101 |
//end parse Date
|
|
|
1102 |
|
|
|
1103 |
//parse time
|
|
|
1104 |
|
|
|
1105 |
if (Cal.ShowTime === true)
|
|
|
1106 |
{
|
|
|
1107 |
//parse AM or PM
|
|
|
1108 |
if (TimeMode === 12)
|
|
|
1109 |
{
|
|
|
1110 |
strAMPM = exDateTime.substring(exDateTime.length - 2, exDateTime.length);
|
|
|
1111 |
Cal.AMorPM = strAMPM;
|
|
|
1112 |
}
|
|
|
1113 |
|
|
|
1114 |
tSp1 = exDateTime.indexOf(":", 0);
|
|
|
1115 |
tSp2 = exDateTime.indexOf(":", (parseInt(tSp1, 10) + 1));
|
|
|
1116 |
if (tSp1 > 0)
|
|
|
1117 |
{
|
|
|
1118 |
strHour = exDateTime.substring(tSp1, tSp1 - 2);
|
|
|
1119 |
Cal.SetHour(strHour);
|
|
|
1120 |
|
|
|
1121 |
strMinute = exDateTime.substring(tSp1 + 1, tSp1 + 3);
|
|
|
1122 |
Cal.SetMinute(strMinute);
|
|
|
1123 |
|
|
|
1124 |
strSecond = exDateTime.substring(tSp2 + 1, tSp2 + 3);
|
|
|
1125 |
Cal.SetSecond(strSecond);
|
|
|
1126 |
|
|
|
1127 |
}
|
|
|
1128 |
else if (exDateTime.indexOf("D*") !== -1)
|
|
|
1129 |
{ //DTG
|
|
|
1130 |
strHour = exDateTime.substring(2, 4);
|
|
|
1131 |
Cal.SetHour(strHour);
|
|
|
1132 |
strMinute = exDateTime.substring(4, 6);
|
|
|
1133 |
Cal.SetMinute(strMinute);
|
|
|
1134 |
|
|
|
1135 |
}
|
|
|
1136 |
}
|
|
|
1137 |
|
|
|
1138 |
}
|
|
|
1139 |
selDate = new Date(Cal.Year, Cal.Month, Cal.Date);//version 1.7
|
|
|
1140 |
RenderCssCal(true);
|
|
|
1141 |
}
|
|
|
1142 |
|
|
|
1143 |
function closewin(id) {
|
|
|
1144 |
if (Cal.ShowTime === true) {
|
|
|
1145 |
var MaxYear = dtToday.getFullYear() + EndYear;
|
|
|
1146 |
var beforeToday =
|
|
|
1147 |
(Cal.Date < dtToday.getDate()) &&
|
|
|
1148 |
(Cal.Month === dtToday.getMonth()) &&
|
|
|
1149 |
(Cal.Year === dtToday.getFullYear())
|
|
|
1150 |
||
|
|
|
1151 |
(Cal.Month < dtToday.getMonth()) &&
|
|
|
1152 |
(Cal.Year === dtToday.getFullYear())
|
|
|
1153 |
||
|
|
|
1154 |
(Cal.Year < dtToday.getFullYear());
|
|
|
1155 |
|
|
|
1156 |
if ((Cal.Year <= MaxYear) && (Cal.Year >= StartYear) && (Cal.Month === selDate.getMonth()) && (Cal.Year === selDate.getFullYear())) {
|
|
|
1157 |
if (Cal.EnableDateMode === "future") {
|
|
|
1158 |
if (beforeToday === false) {
|
|
|
1159 |
callback(id, Cal.FormatDate(Cal.Date));
|
|
|
1160 |
}
|
|
|
1161 |
}
|
|
|
1162 |
else
|
|
|
1163 |
callback(id, Cal.FormatDate(Cal.Date));
|
|
|
1164 |
}
|
|
|
1165 |
}
|
|
|
1166 |
|
|
|
1167 |
var CalId = document.getElementById(id);
|
|
|
1168 |
CalId.focus();
|
|
|
1169 |
winCal.style.visibility = 'hidden';
|
|
|
1170 |
}
|
|
|
1171 |
|
|
|
1172 |
function changeBorder(element, col, oldBgColor)
|
|
|
1173 |
{
|
|
|
1174 |
if (col === 0)
|
|
|
1175 |
{
|
|
|
1176 |
element.style.background = HoverColor;
|
|
|
1177 |
element.style.borderColor = "black";
|
|
|
1178 |
element.style.cursor = "pointer";
|
|
|
1179 |
}
|
|
|
1180 |
|
|
|
1181 |
else
|
|
|
1182 |
{
|
|
|
1183 |
if (oldBgColor)
|
|
|
1184 |
{
|
|
|
1185 |
element.style.background = oldBgColor;
|
|
|
1186 |
}
|
|
|
1187 |
else
|
|
|
1188 |
{
|
|
|
1189 |
element.style.background = "white";
|
|
|
1190 |
}
|
|
|
1191 |
element.style.borderColor = "white";
|
|
|
1192 |
element.style.cursor = "auto";
|
|
|
1193 |
}
|
|
|
1194 |
}
|
|
|
1195 |
|
|
|
1196 |
function selectDate(element, date) {
|
|
|
1197 |
Cal.Date = date;
|
|
|
1198 |
selDate = new Date(Cal.Year, Cal.Month, Cal.Date);
|
|
|
1199 |
element.style.background = SelDateColor;
|
|
|
1200 |
RenderCssCal();
|
|
|
1201 |
}
|
|
|
1202 |
|
|
|
1203 |
function pickIt(evt)
|
|
|
1204 |
{
|
|
|
1205 |
var objectID,
|
|
|
1206 |
dom,
|
|
|
1207 |
de,
|
|
|
1208 |
b;
|
|
|
1209 |
// accesses the element that generates the event and retrieves its ID
|
|
|
1210 |
if (document.addEventListener)
|
|
|
1211 |
{ // w3c
|
|
|
1212 |
objectID = evt.target.id;
|
|
|
1213 |
if (objectID.indexOf(calSpanID) !== -1)
|
|
|
1214 |
{
|
|
|
1215 |
dom = document.getElementById(objectID);
|
|
|
1216 |
cnLeft = evt.pageX;
|
|
|
1217 |
cnTop = evt.pageY;
|
|
|
1218 |
|
|
|
1219 |
if (dom.offsetLeft)
|
|
|
1220 |
{
|
|
|
1221 |
cnLeft = (cnLeft - dom.offsetLeft);
|
|
|
1222 |
cnTop = (cnTop - dom.offsetTop);
|
|
|
1223 |
}
|
|
|
1224 |
}
|
|
|
1225 |
|
|
|
1226 |
// get mouse position on click
|
|
|
1227 |
xpos = (evt.pageX);
|
|
|
1228 |
ypos = (evt.pageY);
|
|
|
1229 |
}
|
|
|
1230 |
|
|
|
1231 |
else
|
|
|
1232 |
{ // IE
|
|
|
1233 |
objectID = event.srcElement.id;
|
|
|
1234 |
cnLeft = event.offsetX;
|
|
|
1235 |
cnTop = (event.offsetY);
|
|
|
1236 |
|
|
|
1237 |
// get mouse position on click
|
|
|
1238 |
de = document.documentElement;
|
|
|
1239 |
b = document.body;
|
|
|
1240 |
|
|
|
1241 |
xpos = event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
|
|
|
1242 |
ypos = event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
|
|
|
1243 |
}
|
|
|
1244 |
|
|
|
1245 |
// verify if this is a valid element to pick
|
|
|
1246 |
if (objectID.indexOf(calSpanID) !== -1)
|
|
|
1247 |
{
|
|
|
1248 |
domStyle = document.getElementById(objectID).style;
|
|
|
1249 |
}
|
|
|
1250 |
|
|
|
1251 |
if (domStyle)
|
|
|
1252 |
{
|
|
|
1253 |
domStyle.zIndex = 100;
|
|
|
1254 |
return false;
|
|
|
1255 |
}
|
|
|
1256 |
|
|
|
1257 |
else
|
|
|
1258 |
{
|
|
|
1259 |
domStyle = null;
|
|
|
1260 |
return;
|
|
|
1261 |
}
|
|
|
1262 |
}
|
|
|
1263 |
|
|
|
1264 |
|
|
|
1265 |
|
|
|
1266 |
function dragIt(evt)
|
|
|
1267 |
{
|
|
|
1268 |
if (domStyle)
|
|
|
1269 |
{
|
|
|
1270 |
if (document.addEventListener)
|
|
|
1271 |
{ //for IE
|
|
|
1272 |
domStyle.left = (event.clientX - cnLeft + document.body.scrollLeft) + 'px';
|
|
|
1273 |
domStyle.top = (event.clientY - cnTop + document.body.scrollTop) + 'px';
|
|
|
1274 |
}
|
|
|
1275 |
else
|
|
|
1276 |
{ //Firefox
|
|
|
1277 |
domStyle.left = (evt.clientX - cnLeft + document.body.scrollLeft) + 'px';
|
|
|
1278 |
domStyle.top = (evt.clientY - cnTop + document.body.scrollTop) + 'px';
|
|
|
1279 |
}
|
|
|
1280 |
}
|
|
|
1281 |
}
|
|
|
1282 |
|
|
|
1283 |
// performs a single increment or decrement
|
|
|
1284 |
function nextStep(whatSpinner, direction)
|
|
|
1285 |
{
|
|
|
1286 |
if (whatSpinner === "Hour")
|
|
|
1287 |
{
|
|
|
1288 |
if (direction === "plus")
|
|
|
1289 |
{
|
|
|
1290 |
Cal.SetHour(Cal.Hours + 1);
|
|
|
1291 |
RenderCssCal();
|
|
|
1292 |
}
|
|
|
1293 |
else if (direction === "minus")
|
|
|
1294 |
{
|
|
|
1295 |
Cal.SetHour(Cal.Hours - 1);
|
|
|
1296 |
RenderCssCal();
|
|
|
1297 |
}
|
|
|
1298 |
}
|
|
|
1299 |
else if (whatSpinner === "Minute")
|
|
|
1300 |
{
|
|
|
1301 |
if (direction === "plus")
|
|
|
1302 |
{
|
|
|
1303 |
Cal.SetMinute(parseInt(Cal.Minutes, 10) + 1);
|
|
|
1304 |
RenderCssCal();
|
|
|
1305 |
}
|
|
|
1306 |
else if (direction === "minus")
|
|
|
1307 |
{
|
|
|
1308 |
Cal.SetMinute(parseInt(Cal.Minutes, 10) - 1);
|
|
|
1309 |
RenderCssCal();
|
|
|
1310 |
}
|
|
|
1311 |
}
|
|
|
1312 |
|
|
|
1313 |
}
|
|
|
1314 |
|
|
|
1315 |
// starts the time spinner
|
|
|
1316 |
function startSpin(whatSpinner, direction)
|
|
|
1317 |
{
|
|
|
1318 |
document.thisLoop = setInterval(function ()
|
|
|
1319 |
{
|
|
|
1320 |
nextStep(whatSpinner, direction);
|
|
|
1321 |
}, 125); //125 ms
|
|
|
1322 |
}
|
|
|
1323 |
|
|
|
1324 |
//stops the time spinner
|
|
|
1325 |
function stopSpin()
|
|
|
1326 |
{
|
|
|
1327 |
clearInterval(document.thisLoop);
|
|
|
1328 |
}
|
|
|
1329 |
|
|
|
1330 |
function dropIt()
|
|
|
1331 |
{
|
|
|
1332 |
stopSpin();
|
|
|
1333 |
|
|
|
1334 |
if (domStyle)
|
|
|
1335 |
{
|
|
|
1336 |
domStyle = null;
|
|
|
1337 |
}
|
|
|
1338 |
}
|
|
|
1339 |
|
|
|
1340 |
// Default events configuration
|
|
|
1341 |
|
|
|
1342 |
document.onmousedown = pickIt;
|
|
|
1343 |
document.onmousemove = dragIt;
|
|
|
1344 |
document.onmouseup = dropIt;
|