]> git.llucax.com Git - mecon/meconlib.git/blob - www/js/general_script.js
Se corrige el updateCellAttributes() para que no ponga estilo comun por defecto.
[mecon/meconlib.git] / www / js / general_script.js
1 function MM_swapImgRestore() { //v3.0
2 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
3 }
4
5 function MM_displayStatusMsg(msgStr) { //v1.0
6 status=msgStr;
7 document.MM_returnValue = true;
8 }
9
10 function MM_preloadImages() { //v3.0
11 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
12 var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
13 if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
14 }
15
16 function MM_findObj(n, d) { //v3.0
17 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
18 d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
19 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
20 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
21 }
22
23 function MM_swapImage() { //v3.0
24 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
25 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
26 }
27
28 function MM_nbGroup(event, grpName) { //v3.0
29 var i,img,nbArr,args=MM_nbGroup.arguments;
30 if (event == "init" && args.length > 2) {
31 if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
32 img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
33 if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
34 nbArr[nbArr.length] = img;
35 for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
36 if (!img.MM_up) img.MM_up = img.src;
37 img.src = img.MM_dn = args[i+1];
38 nbArr[nbArr.length] = img;
39 } }
40 } else if (event == "over") {
41 document.MM_nbOver = nbArr = new Array();
42 for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
43 if (!img.MM_up) img.MM_up = img.src;
44 img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
45 nbArr[nbArr.length] = img;
46 }
47 } else if (event == "out" ) {
48 for (i=0; i < document.MM_nbOver.length; i++) {
49 img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
50 } else if (event == "down") {
51 if ((nbArr = document[grpName]) != null)
52 for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
53 document[grpName] = nbArr = new Array();
54 for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
55 if (!img.MM_up) img.MM_up = img.src;
56 img.src = img.MM_dn = args[i+1];
57 nbArr[nbArr.length] = img;
58 } }
59 }
60
61
62 /* Calendario */
63 var weekend = [0,6];
64 var weekendColor = "#DDEEFF";
65 var fontface = "Arial, Helvetica, sans-serif";
66 var fontsize = 2;
67
68 var gNow = new Date();
69 var ggWinCal;
70 isNav = (navigator.appName.indexOf("Netscape") != -1) ? true : false;
71 isIE = (navigator.appName.indexOf("Microsoft") != -1) ? true : false;
72
73 Calendar.Months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
74 "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
75
76 Calendar.DOMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
77 Calendar.lDOMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
78
79 function Calendar(p_item, p_WinCal, p_month, p_year, p_format) {
80         if ((p_month == null) && (p_year == null))      return;
81
82         if (p_WinCal == null)
83                 this.gWinCal = ggWinCal;
84         else
85                 this.gWinCal = p_WinCal;
86         
87         if (p_month == null) {
88                 this.gMonthName = null;
89                 this.gMonth = null;
90                 this.gYearly = true;
91         } else {
92                 this.gMonthName = Calendar.get_month(p_month);
93                 this.gMonth = new Number(p_month);
94                 this.gYearly = false;
95         }
96
97         this.gYear = p_year;
98         this.gFormat = p_format;
99         this.gBGColor = "white";
100         this.gFGColor = "black";
101         this.gTextColor = "black";
102         this.gHeaderColor = "black";
103         this.gReturnItem = p_item;
104 }
105
106 Calendar.get_month = Calendar_get_month;
107 Calendar.get_daysofmonth = Calendar_get_daysofmonth;
108 Calendar.calc_month_year = Calendar_calc_month_year;
109 Calendar.print = Calendar_print;
110
111 function Calendar_get_month(monthNo) {
112         return Calendar.Months[monthNo];
113 }
114
115 function Calendar_get_daysofmonth(monthNo, p_year) {
116         /* 
117         Check for leap year ..
118         1.Years evenly divisible by four are normally leap years, except for... 
119         2.Years also evenly divisible by 100 are not leap years, except for... 
120         3.Years also evenly divisible by 400 are leap years. 
121         */
122         if ((p_year % 4) == 0) {
123                 if ((p_year % 100) == 0 && (p_year % 400) != 0)
124                         return Calendar.DOMonth[monthNo];
125         
126                 return Calendar.lDOMonth[monthNo];
127         } else
128                 return Calendar.DOMonth[monthNo];
129 }
130
131 function Calendar_calc_month_year(p_Month, p_Year, incr) {
132         /* 
133         Will return an 1-D array with 1st element being the calculated month 
134         and second being the calculated year 
135         after applying the month increment/decrement as specified by 'incr' parameter.
136         'incr' will normally have 1/-1 to navigate thru the months.
137         */
138         var ret_arr = new Array();
139         
140         if (incr == -1) {
141                 // B A C K W A R D
142                 if (p_Month == 0) {
143                         ret_arr[0] = 11;
144                         ret_arr[1] = parseInt(p_Year) - 1;
145                 }
146                 else {
147                         ret_arr[0] = parseInt(p_Month) - 1;
148                         ret_arr[1] = parseInt(p_Year);
149                 }
150         } else if (incr == 1) {
151                 // F O R W A R D
152                 if (p_Month == 11) {
153                         ret_arr[0] = 0;
154                         ret_arr[1] = parseInt(p_Year) + 1;
155                 }
156                 else {
157                         ret_arr[0] = parseInt(p_Month) + 1;
158                         ret_arr[1] = parseInt(p_Year);
159                 }
160         }
161         
162         return ret_arr;
163 }
164
165 function Calendar_print() {
166         ggWinCal.print();
167 }
168
169 function Calendar_calc_month_year(p_Month, p_Year, incr) {
170         /* 
171         Will return an 1-D array with 1st element being the calculated month 
172         and second being the calculated year 
173         after applying the month increment/decrement as specified by 'incr' parameter.
174         'incr' will normally have 1/-1 to navigate thru the months.
175         */
176         var ret_arr = new Array();
177         
178         if (incr == -1) {
179                 // B A C K W A R D
180                 if (p_Month == 0) {
181                         ret_arr[0] = 11;
182                         ret_arr[1] = parseInt(p_Year) - 1;
183                 }
184                 else {
185                         ret_arr[0] = parseInt(p_Month) - 1;
186                         ret_arr[1] = parseInt(p_Year);
187                 }
188         } else if (incr == 1) {
189                 // F O R W A R D
190                 if (p_Month == 11) {
191                         ret_arr[0] = 0;
192                         ret_arr[1] = parseInt(p_Year) + 1;
193                 }
194                 else {
195                         ret_arr[0] = parseInt(p_Month) + 1;
196                         ret_arr[1] = parseInt(p_Year);
197                 }
198         }
199         
200         return ret_arr;
201 }
202
203 // This is for compatibility with Navigator 3, we have to create and discard one object before the prototype object exists.
204 new Calendar();
205
206 Calendar.prototype.getMonthlyCalendarCode = function() {
207         var vCode = "";
208         var vHeader_Code = "";
209         var vData_Code = "";
210         
211         // Begin Table Drawing code here..
212         vCode = vCode + "<TABLE  CELLSPACING=0 CELPADDING=0 BORDER=0 BGCOLOR=#336699 WIDTH=100% ALIGN=center><TR><TD><TABLE ALIGN=CENTER BORDER=0 CELLSPACING=2 CELPADDING=0 WIDTH=100%>";
213         
214         vHeader_Code = this.cal_header();
215         vData_Code = this.cal_data();
216         vCode = vCode + vHeader_Code + vData_Code;
217         
218         vCode = vCode + "</TABLE></TR></TD></TABLE>";
219         
220         return vCode;
221 }
222
223 Calendar.prototype.show = function() {
224         var vCode = "";
225         
226         this.gWinCal.document.open();
227
228         // Setup the page...
229         this.wwrite("<html>");
230         this.wwrite("<head><title>Calendario</title>");
231         this.wwrite("</head><style type=text/css>.sin_subrayar { text-decoration: none}</style>");
232         
233         this.wwrite("<body " + 
234                 "link=\"" + this.gLinkColor + "\" " + 
235                 "bgcolor=\"" + this.gBackGroundColor + "\" " + 
236                 "vlink=\"" + this.gLinkColor + "\" " +
237                 "alink=\"" + this.gLinkColor + "\" " +
238                 "text=\"" + this.gTextColor + "\">");
239
240         // Show navigation buttons
241         var prevMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, -1);
242         var prevMM = prevMMYYYY[0];
243         var prevYYYY = prevMMYYYY[1];
244
245         var nextMMYYYY = Calendar.calc_month_year(this.gMonth, this.gYear, 1);
246         var nextMM = nextMMYYYY[0];
247         var nextYYYY = nextMMYYYY[1];
248         
249         this.wwrite("<BR><TABLE WIDTH=100% ALIGN=center BORDER=0 BGCOLOR=#336699 CELLPADDING=0 CELLSPACING=0><TR><TD><TABLE BORDER=0 CELLSPACING=2 CELLPADDING=0 ALIGN=center width=100%><TR><TD ALIGN=center BGCOLOR=#DDEEFF>");
250         this.wwrite("<font face='"+fontface+"' size=2><B><A class=sin_subrayar HREF=\"" +
251                 "javascript:window.opener.Build(" + 
252                 "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)-1) + "', '" + this.gFormat + "'" +
253                 ");" +
254                 "\"><<</B><\/A></font></TD><TD ALIGN=center BGCOLOR=#DDEEFF>");
255         this.wwrite("<font face='"+fontface+"'  size=2><B><A class=sin_subrayar  HREF=\"" +
256                 "javascript:window.opener.Build(" + 
257                 "'" + this.gReturnItem + "', '" + prevMM + "', '" + prevYYYY + "', '" + this.gFormat + "'" +
258                 ");" +
259                 "\"><<\/A></B></font></TD><TD ALIGN=center BGCOLOR=#DDEEFF>");
260         this.wwrite("<font face='"+fontface+"'  size=2>");
261         
262         this.wwriteA("<FONT FACE='" + fontface + "' SIZE=2 color=#336699><B>");
263         this.wwriteA(this.gMonthName + " " + this.gYear);
264         this.wwriteA("</B>");
265
266         this.wwrite("</font></TD><TD ALIGN=center BGCOLOR=#DDEEFF>");
267         this.wwrite("<font face='"+fontface+"' size=2><B><A class=sin_subrayar  HREF=\"" +
268                 "javascript:window.opener.Build(" + 
269                 "'" + this.gReturnItem + "', '" + nextMM + "', '" + nextYYYY + "', '" + this.gFormat + "'" +
270                 ");" +
271                 "\">><\/A></B></font></TD><TD ALIGN=center BGCOLOR=#DDEEFF>");
272         this.wwrite("<font face='"+fontface+"'  size=2><B><A class=sin_subrayar  HREF=\"" +
273                 "javascript:window.opener.Build(" + 
274                 "'" + this.gReturnItem + "', '" + this.gMonth + "', '" + (parseInt(this.gYear)+1) + "', '" + this.gFormat + "'" +
275                 ");" +
276                 "\">>><\/A></B></font></TD></TR></TABLE></TD></TR></TABLE><BR>");
277
278         // Get the complete calendar code for the month..
279         vCode = this.getMonthlyCalendarCode();
280         this.wwrite(vCode);
281
282         this.wwrite("</font></body></html>");
283         this.gWinCal.document.close();
284 }
285
286 Calendar.prototype.showY = function() {
287         var vCode = "";
288         var i;
289         var vr, vc, vx, vy;             // Row, Column, X-coord, Y-coord
290         var vxf = 285;                  // X-Factor
291         var vyf = 200;                  // Y-Factor
292         var vxm = 10;                   // X-margin
293         var vym;                                // Y-margin
294         if (isIE)       vym = 75;
295         else if (isNav) vym = 25;
296         
297         this.gWinCal.document.open();
298
299         this.wwrite("<html>");
300         this.wwrite("<head><title>Calendar</title>");
301         this.wwrite("<style type='text/css'>\n<!--");
302         for (i=0; i<12; i++) {
303                 vc = i % 3;
304                 if (i>=0 && i<= 2)      vr = 0;
305                 if (i>=3 && i<= 5)      vr = 1;
306                 if (i>=6 && i<= 8)      vr = 2;
307                 if (i>=9 && i<= 11)     vr = 3;
308                 
309                 vx = parseInt(vxf * vc) + vxm;
310                 vy = parseInt(vyf * vr) + vym;
311
312                 this.wwrite(".lclass" + i + " {position:absolute;top:" + vy + ";left:" + vx + ";}");
313         }
314         this.wwrite("-->\n</style>");
315         this.wwrite("</head>");
316
317         this.wwrite("<body " + 
318                 "link=\"" + this.gLinkColor + "\" " + 
319                 "vlink=\"" + this.gLinkColor + "\" " +
320                 "alink=\"" + this.gLinkColor + "\" " +
321                 "text=\"" + this.gTextColor + "\">");
322         this.wwrite("<FONT FACE='" + fontface + "' SIZE=2><B>");
323         this.wwrite("Year : " + this.gYear);
324         this.wwrite("</B><BR>");
325
326         // Show navigation buttons
327         var prevYYYY = parseInt(this.gYear) - 1;
328         var nextYYYY = parseInt(this.gYear) + 1;
329         
330         this.wwrite("<TABLE WIDTH='100%' BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR='#e0e0e0'><TR><TD ALIGN=center>");
331         this.wwrite("[<A HREF=\"" +
332                 "javascript:window.opener.Build(" + 
333                 "'" + this.gReturnItem + "', null, '" + prevYYYY + "', '" + this.gFormat + "'" +
334                 ");" +
335                 "\" alt='Prev Year'><<<\/A>]</TD><TD ALIGN=center>");
336         this.wwrite("[<A HREF=\"javascript:window.print();\">Print</A>]</TD><TD ALIGN=center>");
337         this.wwrite("[<A HREF=\"" +
338                 "javascript:window.opener.Build(" + 
339                 "'" + this.gReturnItem + "', null, '" + nextYYYY + "', '" + this.gFormat + "'" +
340                 ");" +
341                 "\">>><\/A>]</TD></TR></TABLE><BR>");
342
343         // Get the complete calendar code for each month..
344         var j;
345         for (i=11; i>=0; i--) {
346                 if (isIE)
347                         this.wwrite("<DIV ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
348                 else if (isNav)
349                         this.wwrite("<LAYER ID=\"layer" + i + "\" CLASS=\"lclass" + i + "\">");
350
351                 this.gMonth = i;
352                 this.gMonthName = Calendar.get_month(this.gMonth);
353                 vCode = this.getMonthlyCalendarCode();
354                 this.wwrite(this.gMonthName + "/" + this.gYear + "<BR>");
355                 this.wwrite(vCode);
356
357                 if (isIE)
358                         this.wwrite("</DIV>");
359                 else if (isNav)
360                         this.wwrite("</LAYER>");
361         }
362
363         this.wwrite("</font><BR></body></html>");
364         this.gWinCal.document.close();
365 }
366
367 Calendar.prototype.wwrite = function(wtext) {
368         this.gWinCal.document.writeln(wtext);
369 }
370
371 Calendar.prototype.wwriteA = function(wtext) {
372         this.gWinCal.document.write(wtext);
373 }
374
375 Calendar.prototype.cal_header = function() {
376         var vCode = "";
377         
378         vCode = vCode + "<TR>";
379         vCode = vCode + "<TD ALIGN=center WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Dom</B></FONT></TD>";
380         vCode = vCode + "<TD ALIGN=center  WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Lun</B></FONT></TD>";
381         vCode = vCode + "<TD ALIGN=center  WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mar</B></FONT></TD>";
382         vCode = vCode + "<TD ALIGN=center  WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Mie</B></FONT></TD>";
383         vCode = vCode + "<TD ALIGN=center  WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Jue</B></FONT></TD>";
384         vCode = vCode + "<TD ALIGN=center  WIDTH='14%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Vie</B></FONT></TD>";
385         vCode = vCode + "<TD ALIGN=center  WIDTH='16%' BGCOLOR='#336699'><FONT SIZE='2' FACE='" + fontface + "' COLOR='" + this.gHeaderColor + "'><B>Sab</B></FONT></TD>";
386         vCode = vCode + "</TR>";
387         
388         return vCode;
389 }
390
391 Calendar.prototype.cal_data = function() {
392         var vDate = new Date();
393         vDate.setDate(1);
394         vDate.setMonth(this.gMonth);
395         vDate.setFullYear(this.gYear);
396
397         var vFirstDay=vDate.getDay();
398         var vDay=1;
399         var vLastDay=Calendar.get_daysofmonth(this.gMonth, this.gYear);
400         var vOnLastDay=0;
401         var vCode = "";
402
403         /*
404         Get day for the 1st of the requested month/year..
405         Place as many blank cells before the 1st day of the month as necessary. 
406         */
407
408         vCode = vCode + "<TR>";
409         for (i=0; i<vFirstDay; i++) {
410                 vCode = vCode + "<TD ALIGN=center BGCOLOR=#FFFFFF WIDTH='14%'" + this.write_weekend_string(i) + "><FONT SIZE='2' FACE='" + fontface + "'>&nbsp;</FONT></TD>";
411         }
412
413         // Write rest of the 1st week
414         for (j=vFirstDay; j<7; j++) {
415                 vCode = vCode + "<TD ALIGN=center WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" + 
416                         "<A HREF='#' " + 
417                                 "onClick=\"self.opener.document." + this.gReturnItem + ".value='" + 
418                                 this.format_data(vDay) + 
419                                 "';self.opener.document." + this.gReturnItem + "H.value='"+this.format_data(vDay)+"';window.close();\">" + 
420                                 this.format_day(vDay) + 
421                         "</A>" + 
422                         "</FONT></TD>";
423                 vDay=vDay + 1;
424         }
425         vCode = vCode + "</TR>";
426
427         // Write the rest of the weeks
428         for (k=2; k<7; k++) {
429                 vCode = vCode + "<TR>";
430
431                 for (j=0; j<7; j++) {
432                         vCode = vCode + "<TD ALIGN=center WIDTH='14%'" + this.write_weekend_string(j) + "><FONT SIZE='2' FACE='" + fontface + "'>" + 
433                                 "<A HREF='#' " + 
434                                         "onClick=\"self.opener.document." + this.gReturnItem + ".value='" + 
435                                         this.format_data(vDay) + 
436                                         "';self.opener.document." + this.gReturnItem + "H.value='"+this.format_data(vDay)+"';window.close();\">" + 
437                                 this.format_day(vDay) + 
438                                 "</A>" + 
439                                 "</FONT></TD>";
440                         vDay=vDay + 1;
441
442                         if (vDay > vLastDay) {
443                                 vOnLastDay = 1;
444                                 break;
445                         }
446                 }
447
448                 if (j == 6)
449                         vCode = vCode + "</TR>";
450                 if (vOnLastDay == 1)
451                         break;
452         }
453         
454         // Fill up the rest of last week with proper blanks, so that we get proper square blocks
455         for (m=1; m<(7-j); m++) {
456                 if (this.gYearly)
457                         vCode = vCode + "<TD ALIGN=center WIDTH='14%'" + this.write_weekend_string(j+m) + 
458                         "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>&nbsp;</FONT></TD>";
459                 else
460                         vCode = vCode + "<TD ALIGN=center WIDTH='14%'" + this.write_weekend_string(j+m) + 
461                         "><FONT SIZE='2' FACE='" + fontface + "' COLOR='gray'>" + m + "</FONT></TD>";
462         }
463         
464         return vCode;
465 }
466
467 Calendar.prototype.format_day = function(vday) {
468         var vNowDay = gNow.getDate();
469         var vNowMonth = gNow.getMonth();
470         var vNowYear = gNow.getFullYear();
471
472         if (vday == vNowDay && this.gMonth == vNowMonth && this.gYear == vNowYear)
473                 return ("<FONT COLOR=\"RED\"><B>" + vday + "</B></FONT>");
474         else
475                 return (vday);
476 }
477
478 Calendar.prototype.write_weekend_string = function(vday) {
479         var i;
480
481         // Return special formatting for the weekend day.
482         for (i=0; i<weekend.length; i++) {
483                 if (vday == weekend[i])
484                         return (" BGCOLOR=\"" + weekendColor + "\"");
485         }
486         
487         return (" BGCOLOR='#FFFFFF'");
488 }
489
490 Calendar.prototype.format_data = function(p_day) {
491         var vData;
492         var vMonth = 1 + this.gMonth;
493         vMonth = (vMonth.toString().length < 2) ? "0" + vMonth : vMonth;
494         var vMon = Calendar.get_month(this.gMonth).substr(0,3).toUpperCase();
495         var vFMon = Calendar.get_month(this.gMonth).toUpperCase();
496         var vY4 = new String(this.gYear);
497         var vY2 = new String(this.gYear.substr(2,2));
498         var vDD = (p_day.toString().length < 2) ? "0" + p_day : p_day;
499
500         switch (this.gFormat) {
501                 case "MM\/DD\/YYYY" :
502                         vData = vMonth + "\/" + vDD + "\/" + vY4;
503                         break;
504                 case "MM\/DD\/YY" :
505                         vData = vMonth + "\/" + vDD + "\/" + vY2;
506                         break;
507                 case "MM-DD-YYYY" :
508                         vData = vMonth + "-" + vDD + "-" + vY4;
509                         break;
510                 case "MM-DD-YY" :
511                         vData = vMonth + "-" + vDD + "-" + vY2;
512                         break;
513
514                 case "DD\/MON\/YYYY" :
515                         vData = vDD + "\/" + vMon + "\/" + vY4;
516                         break;
517                 case "DD\/MON\/YY" :
518                         vData = vDD + "\/" + vMon + "\/" + vY2;
519                         break;
520                 case "DD-MON-YYYY" :
521                         vData = vDD + "-" + vMon + "-" + vY4;
522                         break;
523                 case "DD-MON-YY" :
524                         vData = vDD + "-" + vMon + "-" + vY2;
525                         break;
526
527                 case "DD\/MONTH\/YYYY" :
528                         vData = vDD + "\/" + vFMon + "\/" + vY4;
529                         break;
530                 case "DD\/MONTH\/YY" :
531                         vData = vDD + "\/" + vFMon + "\/" + vY2;
532                         break;
533                 case "DD-MONTH-YYYY" :
534                         vData = vDD + "-" + vFMon + "-" + vY4;
535                         break;
536                 case "DD-MONTH-YY" :
537                         vData = vDD + "-" + vFMon + "-" + vY2;
538                         break;
539
540                 case "DD\/MM\/YYYY" :
541                         vData = vDD + "\/" + vMonth + "\/" + vY4;
542                         break;
543                 case "DD\/MM\/YY" :
544                         vData = vDD + "\/" + vMonth + "\/" + vY2;
545                         break;
546                 case "DD-MM-YYYY" :
547                         vData = vDD + "-" + vMonth + "-" + vY4;
548                         break;
549                 case "DD-MM-YY" :
550                         vData = vDD + "-" + vMonth + "-" + vY2;
551                         break;
552
553                 default :
554                         vData = vMonth + "\/" + vDD + "\/" + vY4;
555         }
556
557         return vData;
558 }
559
560 function Build(p_item, p_month, p_year, p_format) {
561         var p_WinCal = ggWinCal;
562         gCal = new Calendar(p_item, p_WinCal, p_month, p_year, p_format);
563
564         // Customize your Calendar here..
565         gCal.gBGColor="white";
566         gCal.gBackGroundColor="white";
567         gCal.gLinkColor="black";
568         gCal.gTextColor="black";
569         gCal.gHeaderColor="#FFFFFF";
570
571         // Choose appropriate show function
572         if (gCal.gYearly)       gCal.showY();
573         else    gCal.show();
574 }
575
576 function show_calendar() {
577         /* 
578                 p_month : 0-11 for Jan-Dec; 12 for All Months.
579                 p_year  : 4-digit year
580                 p_format: Date format (mm/dd/yyyy, dd/mm/yy, ...)
581                 p_item  : Return Item.
582         */
583
584         p_item = arguments[0];
585         if (arguments[1] == null)
586                 p_month = new String(gNow.getMonth());
587         else
588                 p_month = arguments[1];
589         if (arguments[2] == "" || arguments[2] == null)
590                 p_year = new String(gNow.getFullYear().toString());
591         else
592                 p_year = arguments[2];
593         if (arguments[3] == null)
594                 p_format = "DD/MM/YYYY";
595         else
596                 p_format = arguments[3];
597
598         vWinCal = window.open("", "Calendar", 
599                 "width=250,height=250,status=no,resizable=no,top=200,left=200");
600         vWinCal.opener = self;
601         ggWinCal = vWinCal;
602
603         Build(p_item, p_month, p_year, p_format);
604 }
605 /*
606 Yearly Calendar Code Starts here
607 */
608 function show_yearly_calendar(p_item, p_year, p_format) {
609         // Load the defaults..
610         if (p_year == null || p_year == "")
611                 p_year = new String(gNow.getFullYear().toString());
612         if (p_format == null || p_format == "")
613                 p_format = "MM/DD/YYYY";
614
615         var vWinCal = window.open("", "Calendar", "scrollbars=yes");
616         vWinCal.opener = self;
617         ggWinCal = vWinCal;
618
619         Build(p_item, null, p_year, p_format);
620 }
621