
<!-- Begin

var sMonth, sYear, sIndex;

function ShowCal (month, year, index) {

        sMonth = month;
        sYear  = year;  
        sIndex = index;

        SetBeginMonth (index);
        calendar(sMonth, sYear, index);

}

function SetBeginMonth (index) {

        var today = new Date();

        if  (index == 1) {

          if  (document.Form1.Month1.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month1.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month1.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month1.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month1.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month1.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month1.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month1.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month1.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month1.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month1.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month1.options[11].selected == 1) {
            sMonth = 12;
          }

         } else if (index == 2) {

          if  (document.Form1.Month2.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month2.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month2.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month2.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month2.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month2.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month2.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month2.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month2.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month2.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month2.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month2.options[11].selected == 1) {
            sMonth = 12;
          }

         } else if (index == 3) {

          if  (document.Form1.Month3.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month3.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month3.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month3.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month3.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month3.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month3.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month3.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month3.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month3.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month3.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month3.options[11].selected == 1) {
            sMonth = 12;
          }

         } else if (index == 4) {

          if  (document.Form1.Month4.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month4.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month4.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month4.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month4.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month4.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month4.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month4.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month4.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month4.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month4.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month4.options[11].selected == 1) {
            sMonth = 12;
          }

         } else if (index == 5) {

          if  (document.Form1.Month5.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month5.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month5.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month5.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month5.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month5.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month5.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month5.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month5.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month5.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month5.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month5.options[11].selected == 1) {
            sMonth = 12;
          }

         } else if (index == 6) {

          if  (document.Form1.Month6.options[0].selected == 1) {
            sMonth = 1;
           } else if (document.Form1.Month6.options[1].selected == 1) {
            sMonth = 2;
           } else if (document.Form1.Month6.options[2].selected == 1) {
            sMonth = 3;
           } else if (document.Form1.Month6.options[3].selected == 1) {
            sMonth = 4;
           } else if (document.Form1.Month6.options[4].selected == 1) {
            sMonth = 5;
           } else if (document.Form1.Month6.options[5].selected == 1) {
            sMonth = 6;
           } else if (document.Form1.Month6.options[6].selected == 1) {
            sMonth = 7;
           } else if (document.Form1.Month6.options[7].selected == 1) {
            sMonth = 8;
           } else if (document.Form1.Month6.options[8].selected == 1) {
            sMonth = 9;
           } else if (document.Form1.Month6.options[9].selected == 1) {
            sMonth = 10;
           } else if (document.Form1.Month6.options[10].selected == 1) {
            sMonth = 11;
           } else if (document.Form1.Month6.options[11].selected == 1) {
            sMonth = 12;
          }

        }

        if (sMonth < today.getMonth() + 1) {
          sYear = today.getYear() + 1;
        }


}


function winctrl(action) {

        if (action == 0) {
          popup.close();
        }

        if (action == -1) {
          if (sMonth == 1) {
            sYear--;
            sMonth = 12;
          } else sMonth--;
          ControlUpdate(1, sIndex, sMonth - 1);
          calendar(sMonth, sYear, sIndex);
        }

        if (action == 1) {
          if (sMonth == 12) {
            sYear++;
            sMonth = 1;
          } else sMonth++;
          ControlUpdate(1, sIndex, sMonth - 1);
          calendar(sMonth, sYear, sIndex);
        }
}

function ControlUpdate (type, index, value) {

        if (type == 1) {

          if     (index == 1)
            document.Form1.Month1.options[value].selected = 1;
          else if (index == 2)
            document.Form1.Month2.options[value].selected = 1;
          else if (index == 3)
            document.Form1.Month3.options[value].selected = 1;
          else if (index == 4)
            document.Form1.Month4.options[value].selected = 1;
          else if (index == 5)
            document.Form1.Month5.options[value].selected = 1;
          else if (index == 6)
            document.Form1.Month6.options[value].selected = 1;

        } else if (type == 2) {

          if     (index == 1) {
            document.Form1.Day1.options[value].selected = 1;
            document.Form1.Month1.options[sMonth - 1].selected = 1;
            // begin 02-18-2000 changes
            document.Form1.Day2.options[value+1].selected = 1;

            document.Form1.Month2.options[sMonth - 1].selected = 1;
            // end 02-18-2000 changes
          } else if (index == 2) {
            document.Form1.Day2.options[value].selected = 1;
            document.Form1.Month2.options[sMonth - 1].selected = 1;
          } else if (index == 3) {
            document.Form1.Day3.options[value].selected = 1;
            document.Form1.Month3.options[sMonth - 1].selected = 1;
          } else if (index == 4) {
            document.Form1.Day4.options[value].selected = 1;
            document.Form1.Month4.options[sMonth - 1].selected = 1;
          } else if (index == 5) {
            document.Form1.Day5.options[value].selected = 1;
            document.Form1.Month5.options[sMonth - 1].selected = 1;
          } else if (index == 6) {
            document.Form1.Day6.options[value].selected = 1;
            document.Form1.Month6.options[sMonth - 1].selected = 1;
          }

          //Explorer won't let us close the window automatically.

          if (navigator.appName == "Netscape") 
            popup.close();

        }
}

function calendar(month, year, index) {

   var monthNames = "January  February  March   April    May      June     July     August   SeptemberOctober  November December ";
   var today = new Date();
   var thisDay, startDay, nDays, RealMonth, RealYear, strn, iPtr;
   var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

   if (year == 0) {
        year  = today.getYear();
        sYear = today.getYear();
   }

   // 10.21.1999.001_003+
   if (year >= 2000) {
     year = year - 1900;
     sYear = sYear - 1900;
   }
   // 10.21.1999.001_003-

   if (month == 0) {
        month = today.getMonth() + 1;
        sMonth = month;
   }

   RealMonth = today.getMonth();
   RealYear =  today.getYear();

   thisDay = today.getDate();

   if (thisDay > monthDays[month-1])
     thisDay = monthDays[month-1];

   today = new Date(year, month - 1, thisDay);

   popup = window.open("", "PoPWin", "width=300,height=275,resizable=no");
   
   thisDay = today.getDate();

   if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
      monthDays[1] = 29;

   // 10.21.1999.002_003+
   if ((year == 100) && (month == 2)) monthDays[1] = 29;
   // 10.21.1999.002_003-

   nDays = monthDays[today.getMonth(month)];

   firstDay = today;

   firstDay.setDate(8);

   startDay = firstDay.getDay();

   // 10.21.1999.003_003+
    if (year == 100) {
     startDay++;
     if (month > 2) startDay++;
   }
   if (year == 101) {
     startDay = startDay + 2;
   }
   if (year == 102) {
     startDay = startDay + 2;
   }
   if (year == 103) {
     startDay = startDay + 2;
   }
   if (year == 104) {
     startDay = startDay + 2;
   }    
   if (year == 105) {
     startDay = startDay + 2;
   }    
   if (year == 106) {
        startDay = startDay + 2;
   }    
   if (year == 107) {
        startDay = startDay + 2;
   }    
   if (year == 108) {
        startDay = startDay + 2;
   }    

   if (startDay == 7) startDay = 0;
   if (startDay == 8) startDay = 1;
   // 10.21.1999.003_003-

   popup.document.open("text/html");
   popup.document.write("<title>Calendar</title><body text=\"#000000\"> " 
        + "<CENTER><TABLE border><TR><TH COLSPAN=7>"
        + monthNames.substring(today.getMonth() * 9, (today.getMonth() * 9) + 9) + " " + (year + 1900)  
        + "<TR><TH>Sun<TH>Mon<TH>Tue<TH>Wed<TH>Thu<TH>Fri<TH>Sat<TR>");
  
   output = "";
   column = 0;
   for (i=0; i<startDay; i++) {

      output = output + "<TD>";
      column++;
   }

   for (i=1; i<=nDays; i++) {

      output = output + "<TD align=center><FONT SIZE+=4>";

      if (i == thisDay && today.getMonth() == RealMonth)
        if (today.getYear() == RealYear)
          output = output + "<B>";

      //popup.document.write("<a href=window.opener.location.href='JavaScript:dayupdate(1)>");

      iPtr = i - 1;

      strn = "<a href=javascript:window.opener.ControlUpdate(2," + index + "," + iPtr + ")>";

      output = output + strn + i + "</a>";

      if (i == thisDay && today.getMonth() == RealMonth)
        if (today.getYear() == RealYear)
          output = output + "</B>";
 
      column++;

      if (column == 7) {
         output = output + "<TR>";
         column = 0;
      }

   }

   popup.document.write(output);
   
   popup.document.write("</FONT></TABLE></CENTER><form><center>"
        + "<INPUT onClick=window.opener.location.href='JavaScript:winctrl(-1)' type=button value='<<'> "
        + "<INPUT onClick=window.opener.location.href='JavaScript:winctrl(0)' type=button value=Close> "
        + "<INPUT onClick=window.opener.location.href='JavaScript:winctrl(1)' type=button value='>>'></form></center>");

   popup.document.close();

}

function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {

   this[0] = m0;
   this[1] = m1;
   this[2] = m2;
   this[3] = m3;
   this[4] = m4;
   this[5] = m5;
   this[6] = m6;
   this[7] = m7;
   this[8] = m8;
   this[9] = m9;
   this[10] = m10;
   this[11] = m11;
}
// begin 02-18-2000 changes
function DateSync(FromObject) {

  if (FromObject=='Month1') {
     document.Form1.Month2.selectedIndex=document.Form1.Month1.selectedIndex;
   } else if(FromObject=='Day1') {
     if (document.Form1.Day1.selectedIndex==30) {
        document.Form1.Day2.selectedIndex=0;
        document.Form1.Month2.selectedIndex=document.Form1.Month2.selectedIndex+1;
      } else { 
        document.Form1.Day2.selectedIndex=document.Form1.Day1.selectedIndex+1;
     }
   } 
}
// end 02-18-2000 changes
// End -->
