var win = null;
function newWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}
var now = new Date();
var day = now.getDate();
var month = now.getMonth()+1; // numbered from 0
var year = now.getYear();
if (year < 1900) year += 1900; // or use getFullYear() in v4 browsers
/* comment the following line out to remove the display of date */
/*document.write(now.toString()+'<br>'+year+'/'+month+'/'+day); */

function setDrops(theForm) {
   // I assume Day and months are all there and start with "Select a Day and Select a month
   theForm.e_day.selectedIndex = day;
   theForm.e_month.selectedIndex = month;
   theForm.s_day.selectedIndex = 01;
   theForm.s_month.selectedIndex = month;   
  // now the year will be slightly different
   var found = 0;
   for(i=1;i<theForm.e_year.options.length;i++) {
      if (theForm.e_year.options[i].value == year) {
         found =i;
         break;
      }
   }
   theForm.e_year.selectedIndex =  found;
   
   var found = 0;
   for(i=1;i<theForm.s_year.options.length;i++) {
      if (theForm.s_year.options[i].value == year) {
         found =i;
         break;
      }
   }
   theForm.s_year.selectedIndex =  found;
}
function setSubDrops(theForm) {
   // I assume Day and months are all there and start with "Select a Day and Select a month
   theForm.sub_e_day.selectedIndex = day;
   theForm.sub_e_month.selectedIndex = month;
   theForm.sub_s_day.selectedIndex = 01;
   theForm.sub_s_month.selectedIndex = month;   
  // now the year will be slightly different
 
   var found = 0;
   for(i=1;i<theForm.sub_e_year.options.length;i++) {
      if (theForm.sub_e_year.options[i].value == year) {
         found =i;
         break;
      }
   }
   theForm.sub_e_year.selectedIndex =  found;   

   var found = 0;
   for(i=1;i<theForm.sub_s_year.options.length;i++) {
      if (theForm.sub_s_year.options[i].value == year) {
         found =i;
         break;
      }
   }
   theForm.sub_s_year.selectedIndex =  found;   
}
