[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/includes/javascript/spiffyCal/ -> spiffyCal_v2_1.js (source)

   1  /*
   2   * Bazillyo's Spiffy DHTML Popup Calendar Control - version 2.1
   3   * 2001 S. Ousta 
   4   * see the included readme.htm file for license information and release notes.
   5   * 
   6   * For more information see:
   7   * http://www.geocities.com/bazillyo/spiffy/calendar/index.htm or
   8   * http://groups.yahoo.com/group/spiffyDHTML or
   9   * email me: [email protected]
  10   *
  11   */
  12  
  13  // GLOBAL variables
  14  var scImgPath = './includes/javascript/spiffyCal/images/';
  15  
  16  var scIE=((navigator.appName == "Microsoft Internet Explorer") || ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion)==5)));
  17  var scNN6=((navigator.appName == "Netscape") && (parseInt(navigator.appVersion)==5));
  18  var scNN=((navigator.appName == "Netscape")&&(document.layers));
  19  
  20  var img_Del=new Image();
  21  var img_Close=new Image();
  22  
  23  img_Del.src= scImgPath +"btn_del_small.gif";
  24  img_Close.src= scImgPath +"btn_close_small.gif";
  25  
  26  var scBTNMODE_DEFAULT=0;
  27  var scBTNMODE_CUSTOMBLUE=1;
  28  var scBTNMODE_CALBTN=2;
  29  
  30  var focusHack;
  31  
  32  /*================================================================================
  33   * Calendar Manager Object
  34   *
  35   *     the functions:
  36   *         isDate(), formatDate(), _isInteger(), _getInt(), and getDateFromFormat()
  37   *     are based on ones courtesy of Matt Kruse ([email protected]) http://www.mattkruse.com/javascript/
  38   *     with some modifications by myself and Michael Brydon
  39   *
  40   */
  41  
  42  function spiffyCalManager() {
  43  
  44      this.showHelpAlerts = false;
  45      this.defaultDateFormat='dd-MMM-yyyy';
  46      this.lastSelectedDate=new Date();
  47      this.calendars=new Array();
  48      this.matchedFormat="";
  49      this.DefBtnImgPath=scImgPath; //'./js/common/calendar/';
  50  
  51      // methods     ----------------------------------------------------------------------
  52      this.getCount= new Function("return this.calendars.length;");
  53  
  54  	function addCalendar(objWhatCal) {
  55          var intIndex = this.calendars.length;
  56          this.calendars[intIndex] = objWhatCal;
  57      }
  58      this.addCalendar=addCalendar;
  59  
  60  
  61  	function hideAllCalendars(objExceptThisOne) {
  62          var i=0;
  63          for (i=0;i<this.calendars.length;i++) {
  64              if (objExceptThisOne!=this.calendars[i]) {
  65                  this.calendars[i].hide();
  66              }
  67          }
  68  
  69      }
  70      this.hideAllCalendars=hideAllCalendars;
  71  
  72  	function swapImg(objWhatCal, strToWhat, blnStick) {
  73          if (document.images) {
  74              // this makes it so that the button sticks down when the cal is visible
  75              if ((!(objWhatCal.visible) || (blnStick))&& (objWhatCal.enabled)) {
  76                  document.images[objWhatCal.btnName].src = eval(objWhatCal.varName+strToWhat + ".src");
  77              }
  78          }
  79          window.status=' ';
  80      //    return true;
  81      }
  82      this.swapImg=swapImg;
  83  
  84      // *** HOLIDAYS ***************************
  85      
  86      this.Holidays = new Array("Dec-25","Jul-4", "Feb-14","Mar-17","Oct-31");
  87      this.HolidaysDesc = new Array("Christmas Day","Independance Day","Valentine's Day","St. Patrick's Day","Halloween");
  88  
  89      //*****************************************
  90      
  91      function isHoliday(whatDate) {
  92          var i=0;var found=-1;
  93          for (i=0;i<this.Holidays.length;i++) {
  94              if (whatDate==this.Holidays[i]) {
  95                  found=i;
  96                  break;
  97              }
  98          }
  99          return found;
 100      }
 101      this.isHoliday=isHoliday;
 102  
 103  
 104      this.AllowedFormats = new Array(
 105  // Days first list
 106  'd.M',
 107  'd-M',
 108  'd/M',
 109  
 110  'd.MMM',
 111  'd-MMM',
 112  'd/MMM',
 113  
 114  'd.M.yy',
 115  'd-M-yy',
 116  'd/M/yy',
 117  
 118  'd.M.yyyy',
 119  'd-M-yyyy',
 120  'd/M/yyyy',
 121  
 122  'd.MM.yyyy',
 123  'd-MM-yyyy',
 124  'd/MM/yyyy',
 125  
 126  'd.MMM.yy',
 127  'd-MMM-yy',
 128  'd/MMM/yy',
 129  
 130  'd.MMM.yyyy',
 131  'd-MMM-yyyy',
 132  'd/MMM/yyyy',
 133  
 134  'd.MM.yy',
 135  'd-MM-yy',
 136  'd/MM/yy',
 137  
 138  'dd.MM.yy',
 139  'dd-MM-yy',
 140  'dd/MM/yy',
 141  
 142  'dd.M.yy',
 143  'dd-M-yy',
 144  'dd/M/yy',
 145  
 146  'dd.MM.yyyy',
 147  'dd-MM-yyyy',
 148  'dd/MM/yyyy',
 149  
 150  'dd.MMM.yy',
 151  'dd-MMM-yy',
 152  'dd/MMM/yy',
 153  
 154  'dd.MMM.yyyy',
 155  'dd-MMM-yyyy',
 156  'dd/MMM/yyyy',
 157  
 158  'M.d',
 159  'M-d',
 160  'M/d',
 161  
 162  // Months first list
 163  
 164  'MMM.d',
 165  'MMM-d',
 166  'MMM/d',
 167  
 168  'M.d.yy',
 169  'M-d-yy',
 170  'M/d/yy',
 171  
 172  'MM.d.yyyy',
 173  'MM-d-yyyy',
 174  'MM/d/yyyy',
 175  
 176  'MMM.d.yy',
 177  'MMM-d-yy',
 178  'MMM/d/yy',
 179  
 180  'MMM.d.yyyy',
 181  'MMM-d-yyyy',
 182  'MMM/d/yyyy',
 183  
 184  'MM.d.yy',
 185  'MM-d-yy',
 186  'MM/d/yy',
 187  
 188  'MM.dd.yy',
 189  'MM-dd-yy',
 190  'MM/dd/yy',
 191  
 192  'M.dd.yy',
 193  'M-dd-yy',
 194  'M/dd/yy',
 195  
 196  'MM.dd.yyyy',
 197  'MM-dd-yyyy',
 198  'MM/dd/yyyy',
 199  
 200  'MMM.dd.yy',
 201  'MMM-dd-yy',
 202  'MMM/dd/yy',
 203  
 204  'MMM.dd.yyyy',
 205  'MMM-dd-yyyy',
 206  'MMM/dd/yyyy'
 207  
 208  );
 209      var MONTH_NAMES = new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
 210  
 211      this.lastBoxValidated=null;
 212  
 213  
 214      function validateDate(eInput, bRequired, dStartDate, dEndDate){
 215          var i = 0; var strTemp=''; var formatMatchCount=0; var firstMatchAt=0;var secondMatchAt=0;
 216          var bOK = false; var bIsEmpty=false;
 217          var strStart=MONTH_NAMES[dStartDate.getMonth()]+'-'+dStartDate.getDate()+'-'+dStartDate.getFullYear();
 218          var strEnd=MONTH_NAMES[dEndDate.getMonth()]+'-'+dEndDate.getDate()+'-'+dEndDate.getFullYear();
 219          var rangeMsg = 'This input box is set up to accept dates between:\n\n   '+
 220                      strStart+'\n\nand\n\n   '+strEnd+'\n\nPlease enter a date no ';
 221  
 222          this.lastBoxValidated=eInput;
 223          this.matchedFormat="";
 224          bIsEmpty=(eInput.value=='' || eInput.value==null);
 225          if (!(bRequired && bIsEmpty)) {
 226              for(i=0;i<this.AllowedFormats.length;i++){
 227  //alert('checking=eInput.value='+eInput.value+'  this.AllowedFormats[i]='+this.AllowedFormats[i]+'\nisDate='+isDate(eInput.value, this.AllowedFormats[i]));
 228                  if (isDate(eInput.value, this.AllowedFormats[i])==true){
 229                      bOK = true;
 230                      formatMatchCount+=1;
 231                      if (formatMatchCount==1) {firstMatchAt=i;}
 232                      if (formatMatchCount>1) {
 233  
 234                          if (this.AllowedFormats[i].substr(0,1)!=this.AllowedFormats[firstMatchAt].substr(0,1)) {
 235                              secondMatchAt=i; break;
 236                          }
 237                          else { // don't count same format with padded zeros as a different format
 238                              formatMatchCount=1;
 239                          }
 240                      }
 241                  }
 242              }
 243          }
 244  alert('formatMatchCount='+formatMatchCount);
 245          if (formatMatchCount>1) {
 246  
 247              if (this.showHelpAlerts) {
 248  
 249                  var date1=getDateFromFormat(eInput.value,this.AllowedFormats[firstMatchAt]);
 250                  var choice1 = MONTH_NAMES[date1.getMonth()]+'-'+date1.getDate()+'-'+date1.getFullYear();
 251                  var date2=getDateFromFormat(eInput.value,this.AllowedFormats[secondMatchAt]);
 252                  var choice2 = MONTH_NAMES[date2.getMonth()]+'-'+date2.getDate()+'-'+date2.getFullYear();
 253                  if (date1.getTime()!=date2.getTime()) {
 254                      var Msg='You have entered an ambiguous date.\n\n Click OK for:\n'+ choice1 +'\n\nor Click Cancel for:\n'+choice2;
 255                      if (confirm(Msg)) {
 256                          bOK=true;
 257                      }
 258                      else {
 259                          firstMatchAt=secondMatchAt;
 260                          bOK=true;
 261                          //return false;
 262                      }
 263                      eInput.focus();
 264                      eInput.select();
 265                  }
 266              }
 267              else {
 268                  // continue and take first match in list
 269                  bOK=true;
 270              }
 271          }
 272  alert('TEST    '+dThis.getDate()+"-"+dThis.getMonth());
 273  
 274          if (bOK==true) {
 275              eInput.className = "cal-TextBox";
 276              //Check for Start/End Dates
 277  
 278              if (dStartDate!=null) {
 279                  var dThis = getDateFromFormat(eInput.value,this.AllowedFormats[i]);
 280                  if (dStartDate>dThis){
 281                      eInput.className = "cal-TextBoxInvalid";
 282                      if (this.showHelpAlerts) { alert(rangeMsg + 'earlier than  '+ strStart + '.');}
 283                      eInput.focus();
 284                      eInput.select();
 285                      return false;
 286                  }
 287              }
 288              if (dEndDate!=null) {
 289                  var dThis = getDateFromFormat(eInput.value,this.AllowedFormats[i]);
 290                  if (dEndDate<dThis) {
 291                      eInput.className = "cal-TextBoxInvalid";
 292                      if (this.showHelpAlerts) {  alert(rangeMsg +'later than  '+ strEnd + '.');}
 293                      eInput.focus();
 294                      eInput.select();
 295                      return false;
 296                  }
 297              }
 298              this.matchedFormat=this.AllowedFormats[firstMatchAt];
 299  
 300              this.lastBoxValidated = null;
 301          }
 302          else {
 303  
 304              if (bRequired && bIsEmpty) {
 305                  eInput.className = "cal-TextBoxInvalid";
 306                  if (this.showHelpAlerts) {
 307                      alert('This date field is required.\n\nPlease enter a valid date before proceeding.');
 308                  }
 309              }
 310              else {
 311                  if (!bRequired && bIsEmpty) {
 312                      eInput.className = "cal-TextBox";
 313                  }
 314                  else {
 315                      eInput.className = "cal-TextBoxInvalid";
 316                      if (this.showHelpAlerts) {
 317                          for(i=0;i<this.AllowedFormats.length;i++){
 318                              strTemp+=this.AllowedFormats[i]+'\t';
 319                          }
 320                          alert('Please enter a valid date.\n\nExample 01-Jan-2002\n\nValid formats are:\n\n'+strTemp);
 321                      }
 322                  }
 323              }
 324              eInput.focus();
 325              eInput.select();
 326              focusHack=eInput;
 327  
 328              setTimeout('focusHack.focus();focusHack.select();');
 329              return false;
 330          }
 331      }
 332      this.validateDate=validateDate;
 333  
 334  
 335      function formatDate(eInput, strFormat) {
 336          //Always called directly following validateDate  - put validate in onchange and format in onblur.
 337          if(this.matchedFormat!="") {
 338              var d = getDateFromFormat(eInput.value,this.matchedFormat);
 339              if(d!=0){
 340                  eInput.value = scFormatDate(d, strFormat);
 341              }
 342          }
 343      }
 344      this.formatDate=formatDate;
 345  
 346      function isDate(val,format) {
 347          var date = getDateFromFormat(val,format);
 348          if (date == 0) { return false; }
 349          return true;
 350      }
 351      this.isDate=isDate;
 352  
 353  
 354      function scFormatDate(date,format) {
 355          format = format+"";
 356          var result = "";
 357          var i_format = 0;
 358          var c = "";
 359          var token = "";
 360          var y = date.getFullYear()+"";
 361          var M = date.getMonth()+1;
 362          var d = date.getDate();
 363          var h = date.getHours();
 364          var m = date.getMinutes();
 365          var s = date.getSeconds();
 366          var yyyy,yy,MMM,MM,dd;
 367          // Convert real date parts into formatted versions
 368          // Year
 369          if (y.length < 4) {
 370              y = y-0+1900;
 371              }
 372          y = ""+y;
 373          yyyy = y;
 374          yy = y.substring(2,4);
 375          // Month
 376          if (M < 10) { MM = "0"+M; }
 377              else { MM = M; }
 378          MMM = MONTH_NAMES[M-1+12];
 379          // Date
 380          if (d < 10) { dd = "0"+d; }
 381              else { dd = d; }
 382          // Now put them all into an object!
 383          var value = new Object();
 384          value["yyyy"] = yyyy;
 385          value["yy"] = yy;
 386          value["y"] = y;
 387          value["MMM"] = MMM;
 388          value["MM"] = MM;
 389          value["M"] = M;
 390          value["dd"] = dd;
 391          value["d"] = d;
 392  
 393          while (i_format < format.length) {
 394              // Get next token from format string
 395              c = format.charAt(i_format);
 396              token = "";
 397              while ((format.charAt(i_format) == c) && (i_format < format.length)) {
 398                  token += format.charAt(i_format);
 399                  i_format++;
 400                  }
 401              if (value[token] != null) {
 402                  result = result + value[token];
 403                  }
 404              else {
 405                  result = result + token;
 406                  }
 407              }
 408          return result;
 409      }
 410      this.scFormatDate=scFormatDate;
 411  
 412      function _isInteger(val) {
 413          var digits = "1234567890";
 414          for (var i=0; i < val.length; i++) {
 415              if (digits.indexOf(val.charAt(i)) == -1) { return false; }
 416              }
 417          return true;
 418      }
 419  
 420      function _getInt(str,i,minlength,maxlength) {
 421          for (x=maxlength; x>=minlength; x--) {
 422              var token = str.substring(i,i+x);
 423              if (_isInteger(token)) {
 424                  return token;
 425                  }
 426              }
 427          return null;
 428      }
 429  
 430      function getDateFromFormat(val,format) {
 431          val = val+"";
 432          format = format+"";
 433          var i_val = 0;
 434          var i_format = 0;
 435          var c = "";
 436          var token = "";
 437          var token2= "";
 438          var x,y;
 439          var year  = 0;
 440          var month = 0;
 441          var date  = 0;
 442          var bYearProvided = false;
 443          while (i_format < format.length) {
 444              // Get next token from format string
 445              c = format.charAt(i_format);
 446              token = "";
 447  
 448              while ((format.charAt(i_format) == c) && (i_format < format.length)) {
 449                  token += format.charAt(i_format);
 450                  i_format++;
 451              }
 452  
 453              // Extract contents of value based on format token
 454              if (token=="yyyy" || token=="yy" || token=="y") {
 455                  if (token=="yyyy") { x=4;y=4; }// 4-digit year
 456                  if (token=="yy")   { x=2;y=2; }// 2-digit year
 457                  if (token=="y")    { x=2;y=4; }// 2-or-4-digit year
 458                  year = _getInt(val,i_val,x,y);
 459                  bYearProvided = true;
 460                  if (year == null) {
 461                      return 0;
 462                      //Default to current year
 463                  }
 464                  if (year.length != token.length){
 465                      return 0;
 466                  }
 467  
 468                  i_val += year.length;
 469              }
 470              else if (token=="MMM") { // Month name
 471                  month = 0;
 472                  for (var i=0; i<MONTH_NAMES.length; i++) {
 473                      var month_name = MONTH_NAMES[i];
 474                      if (val.substring(i_val,i_val+month_name.length).toLowerCase() == month_name.toLowerCase()) {
 475                          month = i+1;
 476                          if (month>12) { month -= 12; }
 477                          i_val += month_name.length;
 478                          break;
 479                      }
 480                  }
 481  
 482                  if (month == 0) { return 0; }
 483                  if ((month < 1) || (month>12)) {
 484                      return 0
 485                  }
 486              }
 487              else if (token=="MM" || token=="M") {
 488                  x=token.length; y=2;
 489                  month = _getInt(val,i_val,x,y);
 490                  if (month == null) { return 0; }
 491                  if ((month < 1) || (month > 12)) { return 0; }
 492                  i_val += month.length;
 493              }
 494              else if (token=="dd" || token=="d") {
 495                  x=token.length; y=2;
 496                  date = _getInt(val,i_val,x,y);
 497                  if (date == null) { return 0; }
 498                  if ((date < 1) || (date>31)) { return 0; }
 499                  i_val += date.length;
 500              }
 501              else {
 502                  if (val.substring(i_val,i_val+token.length) != token) {
 503                      return 0;
 504                  }
 505                  else {
 506                      i_val += token.length;
 507                  }
 508              }
 509          }
 510          // If there are any trailing characters left in the value, it doesn't match
 511          if (i_val != val.length) {
 512              return 0;
 513          }
 514          // Is date valid for month?
 515  
 516          if (month == 2) {
 517              // Check for leap year
 518              if ( ( (year%4 == 0)&&(year%100 != 0) ) || (year%400 == 0) ) { // leap year
 519                  if (date > 29){ return false; }
 520              }
 521              else {
 522                  if (date > 28) { return false; }
 523              }
 524          }
 525          if ((month==4)||(month==6)||(month==9)||(month==11)) {
 526              if (date > 30) { return false; }
 527          }
 528  
 529          //JS dates uses 0 based months.
 530          month = month - 1;
 531  
 532          if (bYearProvided==false) {
 533              //Default to current
 534              var dCurrent = new Date();
 535              year = dCurrent.getFullYear();
 536          }
 537  
 538          var lYear = parseInt(year);
 539          if (lYear<=20) {
 540              year = 2000 + lYear;
 541          }
 542          else if (lYear >=21 && lYear<=99) {
 543              year = 1900 + lYear;
 544          }
 545  
 546          var newdate = new Date(year,month,date,0,0,0);
 547  
 548          return newdate;
 549      }
 550      this.getDateFromFormat=getDateFromFormat;
 551  
 552  
 553  }
 554  
 555  
 556  
 557  var calMgr = new spiffyCalManager();
 558  
 559  
 560  
 561  //================================================================================
 562  // Calendar Object
 563  
 564  function ctlSpiffyCalendarBox(strVarName, strFormName, strTextBoxName, strBtnName, strDefaultValue, intBtnMode) {
 565  
 566      var msNames     = new makeArray0('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
 567      var msDays      = new makeArray0(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
 568      var msDOW       = new makeArray0('S','M','T','W','T','F','S');
 569  
 570  
 571      var blnInConstructor=true;
 572      var img_DateBtn_UP=new Image();
 573      var img_DateBtn_OVER=new Image();
 574      var img_DateBtn_DOWN=new Image();
 575      var img_DateBtn_DISABLED=new Image();
 576  
 577      var strBtnW;
 578      var strBtnH;
 579      var strBtnImg;
 580  
 581      var dteToday=new Date;
 582      var dteCur=new Date;
 583  
 584      var dteMin=new Date;
 585      var dteMax=new Date;
 586  
 587      var scX=4; // default where to display calendar
 588      var scY=4;
 589  
 590      // Defaults
 591      var strDefDateFmt='dd-MMM-yyyy';
 592  
 593      var intDefBtnMode=0;
 594      var strDefBtnImgPath=calMgr.DefBtnImgPath;
 595      /* PROPERTIES =============================================================
 596       *
 597       */
 598      // Generic Properties
 599      this.varName=strVarName;
 600      this.enabled=true;
 601      this.readonly=false;
 602      this.focusClick=false;
 603      this.hideButton=false;
 604      this.visible=false;
 605      this.displayLeft=false;
 606      this.displayTop=false;
 607      // Name Properties
 608      this.formName=strFormName;
 609      this.textBoxName=strTextBoxName;
 610      this.btnName=strBtnName;
 611      this.required=false;
 612      this.x=scX;
 613      this.y=scY;
 614  
 615      this.imgUp=img_DateBtn_UP;
 616      this.imgOver=img_DateBtn_OVER;
 617      this.imgDown=img_DateBtn_DOWN;
 618      this.imgDisabled=img_DateBtn_DISABLED;
 619  
 620      // look
 621      this.showWeekends=true;
 622      this.showHolidays=true;
 623      this.disableWeekends=false;
 624      this.disableHolidays=false;
 625  
 626      this.textBoxWidth=160;
 627      this.textBoxHeight=20;
 628      this.btnImgWidth=strBtnW;
 629      this.btnImgHeight=strBtnH;
 630      if ((intBtnMode==null)||(intBtnMode<0 && intBtnMode>2)) {
 631          intBtnMode=intDefBtnMode
 632      }
 633      switch (intBtnMode) {
 634          case 0 :
 635              strBtnImg=strDefBtnImgPath+'btn_date_up.gif';
 636              img_DateBtn_UP.src=strDefBtnImgPath+'btn_date_up.gif';
 637              img_DateBtn_OVER.src=strDefBtnImgPath+'btn_date_over.gif';
 638              img_DateBtn_DOWN.src=strDefBtnImgPath+'btn_date_down.gif';
 639              img_DateBtn_DISABLED.src=strDefBtnImgPath+'btn_date_disabled.gif';
 640              strBtnW = '18';
 641              strBtnH = '20';
 642              break;
 643          case 1 :
 644              strBtnImg=strDefBtnImgPath+'btn_date1_up.gif';
 645              img_DateBtn_UP.src=strDefBtnImgPath+'btn_date1_up.gif';
 646              img_DateBtn_OVER.src=strDefBtnImgPath+'btn_date1_over.gif';
 647              img_DateBtn_DOWN.src=strDefBtnImgPath+'btn_date1_down.gif';
 648              img_DateBtn_DISABLED.src=strDefBtnImgPath+'btn_date1_disabled.gif';
 649              strBtnW = '22';
 650              strBtnH = '17';
 651              break;
 652          case 2 :
 653              strBtnImg=strDefBtnImgPath+'btn_date2_up.gif';
 654              img_DateBtn_UP.src=strDefBtnImgPath+'btn_date2_up.gif';
 655              img_DateBtn_OVER.src=strDefBtnImgPath+'btn_date2_over.gif';
 656              img_DateBtn_DOWN.src=strDefBtnImgPath+'btn_date2_down.gif';
 657              img_DateBtn_DISABLED.src=strDefBtnImgPath+'btn_date2_disabled.gif';
 658              strBtnW = '34';
 659              strBtnH = '21';
 660              break;
 661      }
 662      // Date Properties
 663      this.dateFormat=strDefDateFmt;
 664      this.useDateRange=false;
 665  
 666      this.minDate=new Date;
 667      this.maxDate=new Date(dteToday.getFullYear()+1, dteToday.getMonth(), dteToday.getDate());
 668  
 669      this.minDay = function() {
 670          return this.minDate.getDate();
 671      }
 672      this.minMonth = function() {
 673          return this.minDate.getMonth();
 674      }
 675      this.minYear = function() {
 676          return this.minDate.getFullYear();
 677      }
 678  
 679      this.maxDay = function() {
 680          return this.maxDate.getDate();
 681      }
 682      this.maxMonth = function() {
 683          return this.maxDate.getMonth();
 684      }
 685      this.maxYear = function() {
 686          return this.maxYear.getFullYear();
 687      }
 688  
 689  	function setMinDate(intYear, intMonth, intDay) {
 690          this.minDate = new Date(intYear, intMonth-1, intDay);
 691      }
 692      this.setMinDate=setMinDate;
 693  
 694  
 695  	function setMaxDate(intYear, intMonth, intDay) {
 696          this.maxDate = new Date(intYear, intMonth-1, intDay);
 697      }
 698      this.setMaxDate=setMaxDate;
 699  
 700      this.minYearChoice=dteToday.getFullYear()-10;
 701      this.maxYearChoice=dteToday.getFullYear()+10;
 702      this.textBox= function() {
 703          if (!blnInConstructor) {
 704              return eval('document.'+this.formName+'.'+this.textBoxName);
 705          }
 706      }
 707  
 708      this.getSelectedDate = function () {
 709          var strTempVal=''; var objEle;
 710          if ((typeof this.formName !='undefined') && (typeof this.textBoxName!='undefined')) {
 711              objEle=eval('document.'+this.formName+'.'+this.textBoxName);
 712              if (objEle && !blnInConstructor) {
 713                  strTempVal=eval('document.'+this.formName+'.'+this.textBoxName+'.value');
 714              }
 715              else {
 716                  strTempVal=strDefaultValue;
 717              }
 718          }
 719          else {
 720              strTempVal=strDefaultValue;
 721          }
 722          return strTempVal;
 723      }
 724  
 725  	function setSelectedDate(strWhat) {
 726          var strTempVal=''; var objEle;
 727          eval('document.'+this.formName+'.'+this.textBoxName).value=strWhat;
 728  
 729          if (!calMgr.isDate(quote(strWhat),quote(this.dateFormat))) {
 730              eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBoxInvalid";
 731          }
 732          else {
 733              eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBox";
 734          }
 735      }
 736      this.setSelectedDate=setSelectedDate;
 737  
 738  
 739  	function disable() {
 740          this.hide();
 741          calMgr.swapImg(this,'.imgDisabled',false);
 742          this.enabled=false;
 743          eval('document.'+this.formName+'.'+this.textBoxName).disabled=true;
 744          eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBoxDisabled";
 745          if (scNN) {
 746              eval('document.'+this.formName+'.'+this.textBoxName).onFocus= function() {this.blur();};
 747          }
 748      }
 749      this.disable=disable;
 750  
 751  	function enable() {
 752          this.enabled=true;
 753          calMgr.swapImg(this,'.imgUp',false);
 754          eval('document.'+this.formName+'.'+this.textBoxName).disabled=false;
 755          eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBox";
 756          if (scNN) {
 757              eval('document.'+this.formName+'.'+this.textBoxName).onFocus= null;
 758          }
 759  
 760          if (!calMgr.isDate(quote(this.getSelectedDate()),quote(this.dateFormat))) {
 761              eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBoxInvalid";
 762          }
 763      }
 764      this.enable=enable;
 765  
 766  
 767  
 768      // behavior Properties
 769      this.JStoRunOnSelect='';
 770      this.JStoRunOnClear='';
 771      this.JStoRunOnCancel='';
 772      this.hideCombos=true;
 773  
 774  
 775      /* METHODS ===============================================================
 776       *
 777       */
 778  
 779  	function makeCalendar(intWhatMonth,intWhatYear,bViewOnly) {
 780          if (bViewOnly) {intWhatMonth-=1;}
 781          var strOutput = '';
 782          var intStartMonth=intWhatMonth;
 783          var intStartYear=intWhatYear;
 784          var intLoop;
 785          var strTemp='';
 786          var strDateColWidth;
 787          var isWE = false;
 788  
 789          dteCur.setMonth(intWhatMonth);
 790          dteCur.setFullYear(intWhatYear);
 791          dteCur.setDate(dteToday.getDate());
 792          dteCur.setHours(0);dteCur.setMinutes(0);dteCur.setSeconds(0);dteCur.setMilliseconds(0);
 793          if (!(bViewOnly)) {
 794              strTemp='<form name="spiffyCal">';
 795          }
 796          // special case for form not to be inside table in Netscape 6
 797          if (scNN6) {
 798              strOutput += strTemp +'<table width="185" border="3" class="cal-Table" cellspacing="0" cellpadding="0"><tr>';
 799          }
 800          else {
 801              strOutput += '<table width="185" border="3" class="cal-Table" cellspacing="0" cellpadding="0">'+strTemp+'<tr>';
 802          }
 803  
 804          if (!(bViewOnly)) {
 805              strOutput += '<td class="cal-HeadCell" align="center" width="100%"><a href="javascript:'+this.varName+'.clearDay();"><img name="calbtn1" src="'+strDefBtnImgPath+'btn_del_small.gif" border="0" width="12" height="10"></a>&nbsp;&nbsp;<a href="javascript:'+this.varName+'.scrollMonth(-1);" class="cal-DayLink">&lt;</a>&nbsp;<SELECT class="cal-ComboBox" NAME="cboMonth" onChange="'+this.varName+'.changeMonth();">';
 806  
 807  
 808              for (intLoop=0; intLoop<12; intLoop++) {
 809                  if (intLoop == intWhatMonth) strOutput += '<OPTION VALUE="' + intLoop + '" SELECTED>' + msNames[intLoop] + '<\/OPTION>';
 810                  else  strOutput += '<OPTION VALUE="' + intLoop + '">' + msNames[intLoop] + '<\/OPTION>';
 811              }
 812  
 813  
 814              strOutput += '<\/SELECT><SELECT class="cal-ComboBox" NAME="cboYear" onChange="'+this.varName+'.changeYear();">';
 815  
 816              for (intLoop=this.minYearChoice; intLoop<this.maxYearChoice; intLoop++) {
 817                  if (intLoop == intWhatYear) strOutput += '<OPTION VALUE="' + intLoop + '" SELECTED>' + intLoop + '<\/OPTION>';
 818                  else strOutput += '<OPTION VALUE="' + intLoop + '">' + intLoop + '<\/OPTION>';
 819              }
 820  
 821              strOutput += '<\/SELECT>&nbsp;<a href="javascript:'+this.varName+'.scrollMonth(1);" class="cal-DayLink">&gt;</a>&nbsp;&nbsp;<a href="javascript:'+this.varName+'.hide();"><img name="calbtn2" src="'+strDefBtnImgPath+'btn_close_small.gif" border="0" width="12" height="10"></a><\/td><\/tr><tr><td width="100%" align="center">';
 822          }
 823          else {
 824              strOutput += '<td class="cal-HeadCell" align="center" width="100%">'+msNames[intWhatMonth]+'-'+intWhatYear+'<\/td><\/tr><tr><td width="100%" align="center">';
 825          }
 826  
 827  
 828          firstDay = new Date(intWhatYear,intWhatMonth,1);
 829          startDay = firstDay.getDay();
 830  
 831          if (((intWhatYear % 4 == 0) && (intWhatYear % 100 != 0)) || (intWhatYear % 400 == 0))
 832              msDays[1] = 29;
 833          else
 834              msDays[1] = 28;
 835  
 836          strOutput += '<table width="185" cellspacing="1" cellpadding="2" border="0"><tr>';
 837          // Header ROW showing days of week here
 838          for (intLoop=0; intLoop<7; intLoop++) {
 839              if (intLoop==0 || intLoop==6) {
 840                  strDateColWidth="15%"
 841              }
 842              else
 843              {
 844                  strDateColWidth="14%"
 845              }
 846              strOutput += '<td class="cal-HeadCell" width="' + strDateColWidth + '" align="center" valign="middle">'+ msDOW[intLoop] +'<\/td>';
 847          }
 848  
 849          strOutput += '<\/tr><tr>';
 850  
 851          var intColumn = 0;
 852          var intLastMonth = intWhatMonth - 1;
 853          var intLastYear = intWhatYear;
 854  
 855          if (intLastMonth == -1) { intLastMonth = 11; intLastYear=intLastYear-1;}
 856          // Show last month's days in first row
 857          for (intLoop=0; intLoop<startDay; intLoop++, intColumn++) {
 858              strOutput += this.getDayLink(true,(msDays[intLastMonth]-startDay+intLoop+1),intLastMonth,intLastYear,bViewOnly,isWE);
 859          }
 860          // Show this month's days
 861          for (intLoop=1; intLoop<=msDays[intWhatMonth]; intLoop++, intColumn++) {
 862              if ((intColumn % 6)==0) {isWE=true } else {isWE=false}
 863              strOutput += this.getDayLink(false,intLoop,intWhatMonth,intWhatYear,bViewOnly,isWE);
 864              if (intColumn == 6) {
 865                  strOutput += '<\/tr><tr>';
 866                  intColumn = -1;
 867              }
 868          }
 869  
 870          var intNextMonth = intWhatMonth+1;
 871          var intNextYear = intWhatYear;
 872  
 873          if (intNextMonth==12) { intNextMonth=0; intNextYear=intNextYear+1;}
 874          // Show next month's days in last row
 875          if (intColumn > 0) {
 876              for (intLoop=1; intColumn<7; intLoop++, intColumn++) {
 877                  strOutput +=  this.getDayLink(true,intLoop,intNextMonth,intNextYear,bViewOnly);
 878              }
 879              strOutput += '<\/tr><\/table><\/td><\/tr>';
 880          }
 881          else {
 882              strOutput = strOutput.substr(0,strOutput.length-4); // remove the <tr> from the end if there's no last row
 883              strOutput += '<\/table><\/td><\/tr>';
 884          }
 885  
 886          if (scNN6) {
 887              strOutput += '<\/table><\/form>';
 888          }
 889          else {
 890              strOutput += '<\/form><\/table>';
 891          }
 892          dteCur.setDate(1);
 893          dteCur.setHours(0);dteCur.setMinutes(0);dteCur.setSeconds(0);dteCur.setMilliseconds(0);
 894  
 895          dteCur.setMonth(intStartMonth);
 896          dteCur.setFullYear(intStartYear);
 897  
 898          return strOutput;
 899      }
 900      this.makeCalendar=makeCalendar;
 901  
 902  
 903      // writeControl -------------------------------------
 904      //
 905  	function writeControl() {
 906          var strHold='';
 907          var strTemp='';
 908          var strTempMinDate='';
 909          var strTempMaxDate='';
 910  
 911          // specify whether you can type in the date box and validate them as well
 912          // or whether you must use the calendar only to select a date
 913          if (this.readonly) {
 914              strTemp=' onFocus="this.blur();" readonly ';
 915          }
 916          if (this.focusClick) {
 917              strTemp=' onFocus="'+this.varName+'.show();" ';
 918          }
 919  
 920          if (!(this.useDateRange)) {
 921              strTemp+=' onChange="calMgr.validateDate(document.'+this.formName+'.'+this.textBoxName+','+this.varName+'.required);" onBlur="calMgr.formatDate(document.'+this.formName+'.'+this.textBoxName+','+this.varName+'.dateFormat);" ';
 922          }
 923          else {
 924              strTempMinDate=this.minDate.getDate()+'-'+msNames[this.minDate.getMonth()]+'-'+this.minDate.getFullYear();
 925              strTempMaxDate=this.maxDate.getDate()+'-'+msNames[this.maxDate.getMonth()]+'-'+this.maxDate.getFullYear();
 926              strTemp+=' onChange="calMgr.validateDate('+'document.'+this.formName+'.'+this.textBoxName+','+this.varName+'.required,'+this.varName+'.minDate,'+this.varName+'.maxDate);" onBlur="calMgr.formatDate(document.'+this.formName+'.'+this.textBoxName+','+this.varName+'.dateFormat);" ';
 927          }
 928  
 929          strHold='<input class="cal-TextBox" type="text" name="' + this.textBoxName + '"' + strTemp + 'size="12" value="' + this.getSelectedDate() + '">';
 930          if (!scIE) {
 931              strTemp=' href="javascript:calClick();return false;" ';
 932          }
 933          else {
 934              strTemp='';
 935          }
 936          if ((this.focusClick==false) || (this.focusClick==true && this.hideButton==false))  {
 937              strHold+='<a class="so-BtnLink"'+strTemp;
 938  
 939              strHold+=' onmouseover="calMgr.swapImg(' + this.varName + ',\'.imgOver\',false);" ';
 940  
 941              strHold+='onmouseout="calMgr.swapImg(' + this.varName + ',\'.imgUp\',false);" ';
 942  
 943              strHold+='onclick="calMgr.swapImg(' + this.varName + ',\'.imgDown\',true);';
 944  
 945      //        strHold+=this.varName+'.show();return false;">';
 946              strHold+=this.varName+'.show();">';
 947  
 948              strHold+='<img align="absmiddle" border="0" name="' + this.btnName + '" src="' + strBtnImg +'" width="'+ strBtnW +'" height="'+ strBtnH +'"></a>';
 949          }
 950          document.write(strHold);
 951      }
 952      this.writeControl=writeControl;
 953  
 954  
 955      // show -------------------------------------
 956      //
 957  	function show() {
 958          var strCurSelDate = calMgr.lastSelectedDate;
 959  
 960          if (!this.enabled) { return }
 961          calMgr.hideAllCalendars(this);
 962          if (this.visible) {
 963              this.hide();
 964          }
 965          else {
 966  // put these next 2 lines in when the tiny cal btns seem to randomly disappear
 967               if (document.images['calbtn1']!=null ) document.images['calbtn1'].src=img_Del.src;
 968               if (document.images['calbtn2']!=null ) document.images['calbtn2'].src=img_Close.src;
 969  
 970              if (this.focusClick==true && this.hideButton==true) {
 971                  //if no dropdown button then use user-provided location for it
 972                  scX=this.x;
 973                  scY=this.y;
 974              }
 975              else {
 976                  // get correct position of date btn
 977                  if ( scIE ) {
 978                      if (this.displayLeft) {
 979                          scX = getOffsetLeft(document.images[this.btnName])-192+ document.images[this.btnName].width ;
 980                      }
 981                      else {
 982                          scX = getOffsetLeft(document.images[this.btnName]);
 983                      }
 984                      if (this.displayTop) {
 985                          scY = getOffsetTop(document.images[this.btnName]) -138 ;
 986                      }
 987                      else {
 988                          scY = getOffsetTop(document.images[this.btnName]) + document.images[this.btnName].height + 2;
 989                      }
 990                  }
 991                  else if (scNN){
 992                      if (this.displayLeft) {
 993                          scX = document.images[this.btnName].x - 192+  document.images[this.btnName].width;
 994                      }
 995                      else {
 996                          scX = document.images[this.btnName].x;
 997                      }
 998                      if (this.displayTop) {
 999                          scY = document.images[this.btnName].y -134;
1000                      }
1001                      else {
1002                          scY = document.images[this.btnName].y + document.images[this.btnName].height + 2;
1003                      }
1004                  }
1005              }
1006              // hide all combos underneath it
1007              if (this.hideCombos) {toggleCombos('hidden');}
1008  
1009              // pop calendar up to the correct month and year if there's a date there
1010              // otherwise pop it up using today's month and year
1011              if (this.getSelectedDate()==''){
1012                  if (!(dteCur)) {
1013                      domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteToday.getMonth(),dteToday.getFullYear()));
1014                  }
1015                  else {
1016                      domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1017                  }
1018              }
1019              else {
1020                  if (calMgr.isDate(quote(this.getSelectedDate()),quote(this.dateFormat))) {
1021                      dteCur = calMgr.getDateFromFormat(quote(this.getSelectedDate()),quote(this.dateFormat));
1022                      dteCur.setHours(0);dteCur.setMinutes(0);dteCur.setSeconds(0);dteCur.setMilliseconds(0);
1023  
1024                  }
1025                  else {
1026                      dteCur=calMgr.lastSelectedDate;
1027                  }
1028                  domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1029              }
1030  
1031              this.visible=true;
1032          }
1033  
1034      }
1035      this.show=show;
1036  
1037  
1038      // hide -------------------------------------
1039      //
1040  	function hide() {
1041  
1042          domlay('spiffycalendar',0,scX,scY);
1043          this.visible = false;
1044          calMgr.swapImg(this,'.imgUp',false);
1045          if (this.hideCombos) {toggleCombos('visible');}
1046      }
1047      this.hide=hide;
1048  
1049  
1050      // clearDay -------------------------------------
1051      //
1052  	function clearDay() {
1053          eval('document.' + this.formName + '.' + this.textBoxName + '.value = \'\'');
1054          this.hide();
1055          if (this.JStoRunOnClear!=null)
1056              eval(unescape(this.JStoRunOnClear));
1057  
1058          eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBox";
1059          if (this.required) {
1060              eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBoxInvalid";
1061          }
1062      }
1063      this.clearDay=clearDay;
1064  
1065  
1066      // changeDay -------------------------------------
1067      //
1068  	function changeDay(intWhatDay) {
1069          dteCur.setDate(intWhatDay);
1070          dteCur.setHours(0);dteCur.setMinutes(0);dteCur.setSeconds(0);dteCur.setMilliseconds(0);
1071  
1072          this.textBox().value=calMgr.scFormatDate(dteCur,this.dateFormat);
1073          this.hide();
1074          if (this.JStoRunOnSelect!=null)
1075              eval(unescape(this.JStoRunOnSelect));
1076  
1077          eval('document.'+this.formName+'.'+this.textBoxName).className = "cal-TextBox";
1078  
1079      }
1080      this.changeDay=changeDay;
1081  
1082      // scrollMonth -------------------------------------
1083      //
1084  	function scrollMonth(intAmount) {
1085          var intMonthCheck;
1086          var intYearCheck;
1087  
1088          if (scIE) {
1089              intMonthCheck = document.forms["spiffyCal"].cboMonth.selectedIndex + intAmount;
1090          }
1091          else if (scNN) {
1092              intMonthCheck = document.spiffycalendar.document.forms["spiffyCal"].cboMonth.selectedIndex + intAmount;
1093          }
1094          if (intMonthCheck < 0) {
1095              intYearCheck = dteCur.getFullYear() - 1;
1096              if ( intYearCheck < this.minYearChoice ) {
1097                  intYearCheck = this.minYearChoice;
1098                  intMonthCheck = 0;
1099              }
1100              else {
1101                  intMonthCheck = 11;
1102              }
1103              dteCur.setFullYear(intYearCheck);
1104          }
1105          else if (intMonthCheck >11) {
1106              intYearCheck = dteCur.getFullYear() + 1;
1107              if ( intYearCheck > this.maxYearChoice-1 ) {
1108                  intYearCheck = this.maxYearChoice-1;
1109                  intMonthCheck = 11;
1110              }
1111              else {
1112                  intMonthCheck = 0;
1113              }
1114              dteCur.setFullYear(intYearCheck);
1115          }
1116  
1117          if (scIE) {
1118              dteCur.setMonth(document.forms["spiffyCal"].cboMonth.options[intMonthCheck].value);
1119          }
1120          else if (scNN) {
1121              dteCur.setMonth(document.spiffycalendar.document.forms["spiffyCal"].cboMonth.options[intMonthCheck].value );
1122          }
1123          domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1124      }
1125      this.scrollMonth=scrollMonth;
1126  
1127  
1128      // changeMonth -------------------------------------
1129      //
1130  	function changeMonth() {
1131          if (scIE) {
1132              dteCur.setMonth(document.forms["spiffyCal"].cboMonth.options[document.forms["spiffyCal"].cboMonth.selectedIndex].value);
1133              domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1134          }
1135          else if (scNN) {
1136              dteCur.setMonth(document.spiffycalendar.document.forms["spiffyCal"].cboMonth.options[document.spiffycalendar.document.forms["spiffyCal"].cboMonth.selectedIndex].value);
1137              domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1138          }
1139      }
1140      this.changeMonth=changeMonth;
1141  
1142  
1143      // changeYear -------------------------------------
1144      //
1145  	function changeYear() {
1146          if (scIE) {
1147              dteCur.setFullYear(document.forms["spiffyCal"].cboYear.options[document.forms["spiffyCal"].cboYear.selectedIndex].value);
1148              domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1149          }
1150          else if (scNN) {
1151              dteCur.setFullYear(document.spiffycalendar.document.forms["spiffyCal"].cboYear.options[document.spiffycalendar.document.forms["spiffyCal"].cboYear.selectedIndex].value);
1152              domlay('spiffycalendar',1,scX,scY,this.makeCalendar(dteCur.getMonth(),dteCur.getFullYear()));
1153          }
1154      }
1155      this.changeYear=changeYear;
1156  
1157  	function getDayLink(blnIsGreyDate,intLinkDay,intLinkMonth,intLinkYear,bViewOnly,isWE) {
1158          var templink; var tempLinkClass='calDay-Link';
1159          var tempClass='cal-DayCell';
1160          var tempDt=''; var isHol=-1; var holTxt='';
1161          if (isWE==true && this.showWeekends==true) {tempClass='cal-WeekendCell';}
1162          tempDt=msNames[intLinkMonth]+'-'+intLinkDay;
1163          if (this.showHolidays) {isHol=calMgr.isHoliday(tempDt); if (isHol!=-1) {holTxt=' title="'+calMgr.HolidaysDesc[isHol]+'"'; tempClass='cal-HolidayCell';}}
1164          if (!(this.useDateRange)) {
1165              if (blnIsGreyDate) {
1166                  templink='<td align="center" class="cal-GreyDate">' + intLinkDay + '<\/td>';
1167              }
1168              else {
1169                  if (isDayToday(intLinkDay)) {
1170                      if (!(bViewOnly)) {
1171                          templink='<td align="center" class="'+tempClass+'">' + '<a class="cal-TodayLink" '+holTxt+' onmouseover="self.status=\' \';return true" href="javascript:'+this.varName+'.changeDay(' + intLinkDay + ');">' + intLinkDay + '<\/a><\/td>';
1172                      }
1173                      else {
1174                          templink='<td align="center" class="'+tempClass+'"><span class="cal-Today">' + intLinkDay +'<\/span><\/td>';
1175                      }
1176                  }
1177                  else {
1178                      if (!(bViewOnly)) {
1179                          templink='<td align="center" class="'+tempClass+'">' + '<a class="cal-DayLink" '+holTxt+' onmouseover="self.status=\' \';return true" href="javascript:'+this.varName+'.changeDay(' + intLinkDay + ');">' + intLinkDay + '<\/a>' +'<\/td>';
1180                      }
1181                      else {
1182                          templink='<td align="center" class="'+tempClass+'"><span class="cal-Day">' + intLinkDay + '<\/span><\/td>';
1183                      }
1184                  }
1185              }
1186          }
1187          else {
1188              if (this.isDayValid(intLinkDay,intLinkMonth,intLinkYear)) {
1189  
1190                  if (blnIsGreyDate){
1191                      templink='<td align="center" class="cal-GreyDate">' + intLinkDay + '<\/td>';
1192                  }
1193                  else {
1194                      if (isDayToday(intLinkDay)) {
1195                          if (!(bViewOnly)) {
1196                              templink='<td align="center" class="'+tempClass+'">' + '<a class="cal-TodayLink" '+holTxt+' onmouseover="self.status=\' \';return true" href="javascript:'+this.varName+'.changeDay(' + intLinkDay + ');">' + intLinkDay + '<\/a>' +'<\/td>';
1197                          }
1198                          else {
1199                              templink='<td align="center" class="'+tempClass+'"><span class="cal-Today">' + intLinkDay + '<\/span><\/td>';
1200                          }
1201                      }
1202                      else {
1203                          if (!(bViewOnly)) {
1204                              templink='<td align="center" class="'+tempClass+'">' + '<a class="cal-DayLink" '+holTxt+' onmouseover="self.status=\' \';return true" href="javascript:'+this.varName+'.changeDay(' + intLinkDay + ');">' + intLinkDay + '<\/a>' +'<\/td>';
1205                          }
1206                          else {
1207                              templink='<td align="center" class="'+tempClass+'"><span class="cal-Day">' +  intLinkDay  +'<\/span><\/td>';
1208                          }
1209                      }
1210                  }
1211              }
1212              else {
1213                  templink='<td align="center" class="cal-GreyInvalidDate">'+ intLinkDay + '<\/td>';
1214              }
1215          }
1216          return templink;
1217      }
1218      this.getDayLink=getDayLink;
1219  
1220  
1221      // EXTRA Private FUNCTIONS ===============================================================
1222  
1223  	function toggleCombos(showHow){
1224          var i; var j;
1225          var cboX; var cboY;
1226          for (i=0;i<document.forms.length;i++) {
1227              for (j=0;j<document.forms[i].elements.length;j++) {
1228                  if (document.forms[i].elements[j].tagName == "SELECT") {
1229                      if (document.forms[i].name != "spiffyCal") {
1230                          cboX = getOffsetLeft(document.forms[i].elements[j]);
1231                          cboY = getOffsetTop(document.forms[i].elements[j]);
1232                              if ( ((cboX>=scX-15) && (cboX<=scX+200)) && ((cboY>=scY-15) && (cboY<=scY+145)) )
1233                                  document.forms[i].elements[j].style.visibility=showHow;
1234                              //Check for right hand side overlapping.
1235                              cboX = cboX + parseInt(document.forms[i].elements[j].style.width);
1236                              cboY=cboY+15;//cbo height (default)
1237                              if ( ((cboX>=scX+15) && (cboX<=scX+200)) && ((cboY>=scY-15) && (cboY<=scY+145)) )
1238                                  document.forms[i].elements[j].style.visibility=showHow;
1239                      }
1240                  }
1241              }
1242          }
1243      }
1244  
1245  
1246  
1247  	function isDayToday(intWhatDay) {
1248          if ((dteCur.getFullYear() == dteToday.getFullYear()) && (dteCur.getMonth() == dteToday.getMonth()) && (intWhatDay == dteToday.getDate())) {
1249              return true;
1250          }
1251          else {
1252              return false;
1253          }
1254      }
1255  
1256  
1257  	function isDayValid(intWhatDay, intWhatMonth, intWhatYear){
1258          dteCur.setDate(intWhatDay);
1259          dteCur.setMonth(intWhatMonth);
1260          dteCur.setFullYear(intWhatYear);
1261          dteCur.setHours(0);dteCur.setMinutes(0);dteCur.setSeconds(0);dteCur.setMilliseconds(0);
1262          if ((dteCur>=this.minDate) && (dteCur<=this.maxDate)) {
1263              return true;
1264          }
1265          else {
1266              return false;
1267          }
1268      }
1269      this.isDayValid=isDayValid;
1270  
1271      calMgr.addCalendar(this);
1272  
1273      blnInConstructor=false;
1274  }
1275  
1276  
1277  
1278  // Utility functions----------------------------------
1279  
1280  
1281  function quote(sWhat) {
1282      return '\''+sWhat+'\'';
1283  }
1284  
1285  
1286  function getOffsetLeft (el) {
1287      var ol = el.offsetLeft;
1288      while ((el = el.offsetParent) != null)
1289          ol += el.offsetLeft;
1290      return ol;
1291  }
1292  
1293  
1294  function getOffsetTop (el) {
1295      var ot = el.offsetTop;
1296      while((el = el.offsetParent) != null)
1297          ot += el.offsetTop;
1298      return ot;
1299  }
1300  
1301  function calClick() {
1302      window.focus();
1303  }
1304  
1305  function domlay(id,trigger,lax,lay,content) {
1306      /*
1307       * Cross browser Layer visibility / Placement Routine
1308       * Done by Chris Heilmann ([email protected])
1309       * http://www.ichwill.net/mom/domlay/
1310       * Feel free to use with these lines included!
1311       * Created with help from Scott Andrews.
1312       * The marked part of the content change routine is taken
1313       * from a script by Reyn posted in the DHTML
1314       * Forum at Website Attraction and changed to work with
1315       * any layername. Cheers to that!
1316       * Welcome DOM-1, about time you got included... :)
1317       */
1318      // Layer visible
1319      if (trigger=="1"){
1320          if (document.layers) document.layers[''+id+''].visibility = "show"
1321          else if (document.all) document.all[''+id+''].style.visibility = "visible"
1322          else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "visible"
1323          }
1324      // Layer hidden
1325      else if (trigger=="0"){
1326          if (document.layers) document.layers[''+id+''].visibility = "hide"
1327          else if (document.all) document.all[''+id+''].style.visibility = "hidden"
1328          else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
1329          }
1330      // Set horizontal position
1331      if (lax){
1332          if (document.layers){document.layers[''+id+''].left = lax}
1333          else if (document.all){document.all[''+id+''].style.left=lax}
1334          else if (document.getElementById){document.getElementById(''+id+'').style.left=lax+"px"}
1335          }
1336      // Set vertical position
1337      if (lay){
1338          if (document.layers){document.layers[''+id+''].top = lay}
1339          else if (document.all){document.all[''+id+''].style.top=lay}
1340          else if (document.getElementById){document.getElementById(''+id+'').style.top=lay+"px"}
1341          }
1342      // change content
1343  
1344      if (content){
1345      if (document.layers){
1346          sprite=document.layers[''+id+''].document;
1347          // add father layers if needed! document.layers[''+father+'']...
1348          sprite.open();
1349          sprite.write(content);
1350          sprite.close();
1351          }
1352      else if (document.all) document.all[''+id+''].innerHTML = content;
1353      else if (document.getElementById){
1354          //Thanx Reyn!
1355          rng = document.createRange();
1356          el = document.getElementById(''+id+'');
1357          rng.setStartBefore(el);
1358          htmlFrag = rng.createContextualFragment(content)
1359          while(el.hasChildNodes()) el.removeChild(el.lastChild);
1360          el.appendChild(htmlFrag);
1361          // end of Reyn ;)
1362          }
1363      }
1364  }
1365  
1366  
1367  function makeArray0() {
1368      for (i = 0; i<makeArray0.arguments.length; i++)
1369          this[i] = makeArray0.arguments[i];
1370  }
1371  
1372  //---------------------------------------
1373  


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7