// [ startDay, startMonth, endDay, endMonth, event ]
var events = [
  [  1,  1,  1,  1, 'Kwanzaa &amp; New Year\'s Day' ],
  [  9,  1, 24,  1, 'National Western Stock Show' ],
  [  9,  1,  9,  1,
    'Holiday Decorations Come Down &amp; National Western Stock Show' ],
  [ 18,  1, 18,  1,
    'Martin Luther King, Jr. Day &amp; National Western Stock Show' ],
  [ 21,  1, 21,  1,
    'Board of Directors Meeting &amp; National Western Stock Show' ],
  [  2,  2,  2,  2, 'Groundhog Day' ],
  [  7,  2,  7,  2, 'Super Bowl Sunday' ],
  [ 12,  2, 12,  2, 'Lincoln\'s Birthday' ],
  [ 14,  2, 14,  2, 'Valentine\'s Day' ],
  [ 15,  2, 15,  2, 'Presidents Day' ],
  [ 16,  2, 16,  2, 'Mardi Gras' ],
  [ 17,  2, 17,  2, 'Ash Wednesday' ],
  [ 18,  2, 18,  2, 'Board of Directors Meeting' ],
  [ 22,  2, 22,  2, 'Washington\'s Birthday' ],
  [ 14,  3, 14,  3, 'Daylight Savings Time Begins' ],
  [ 15,  3, 15,  3, 'Ides of March' ],
  [ 17,  3, 17,  3, 'St. Patrick\'s Day' ],
  [ 18,  3, 18,  3, 'Board of Directors Meeting' ],
  [ 20,  3, 20,  3, 'First Day of Spring' ],
  [ 28,  3, 28,  3, 'Palm Sunday' ],
  [ 29,  3,  6,  4, 'Passover' ],
  [  1,  4,  1,  4, 'April Fool\'s Day &amp; Passover' ],
  [  2,  4,  2,  4, 'Good Friday &amp; Passover' ],
  [  4,  4,  4,  4, 'Easter &amp; Passover' ],
  [ 15,  4, 15,  4, 'Board of Directors Meeting &amp; Tax Day' ],
  [ 16,  4, 16,  4, 'Arbor Day' ],
  [ 21,  4, 21,  4, 'Administrative Professional\'s Day' ],
  [ 22,  4, 22,  4, 'Earth Day' ],
  [  4,  5,  4,  5, 'Teacher\'s Day' ],
  [  5,  5,  5,  5, 'Cinco De Mayo' ],
  [  9,  5,  9,  5, 'Mother\'s Day' ],
  [ 15,  5, 15,  5, 'Armed Forces Day' ],
  [ 20,  5, 20,  5, 'Board of Directors Meeting' ],
  [ 21,  5, 23,  5, 'Community Garage Sale' ],
  [ 25,  5, 26,  5, 'Dumpster Days' ],
  [ 29,  5, 29,  5, 'Pool Opens' ],
  [ 31,  5, 31,  5, 'Memorial Day' ],
  [ 14,  6, 14,  6, 'Flag Day' ],
  [ 17,  6, 17,  6, 'Board of Directors Meeting' ],
  [ 20,  6, 20,  6, 'Father\'s Day' ],
  [ 21,  6, 21,  6, 'First Day of Summer' ],
  [  4,  7,  4,  7, 'Independence Day' ],
  [ 15,  7, 15,  7, 'Board of Directors Meeting' ],
  [ 30,  7, 30,  7, 'Sys Admin Day' ],
  [  3,  8,  3,  8, 'National Night Out' ],
  [ 19,  8, 19,  8, 'Board of Directors Meeting' ],
  [  6,  9,  6,  9, 'Labor Day &amp; Pool Closes' ],
  [  8,  9, 10,  9, 'Rosh Hashanah' ],
  [ 11,  9, 11,  9, 'Household Chemical Roundup &amp; Patriot Day' ],
  [ 12,  9, 12,  9, 'Grandparent\'s Day' ],
  [ 16,  9, 16,  9, 'Annual Meeting &amp; Board of Directors Meeting' ],
  [ 17,  9, 18,  9, 'Yom Kippur' ],
  [ 23,  9, 23,  9, 'First Day of Autumn' ],
  [ 11, 10, 11, 10, 'Columbus Day' ],
  [ 16, 10, 16, 10, 'Boss\'s Day' ],
  [ 21, 10, 21, 10, 'Board of Directors Meeting' ],
  [ 24, 10, 24, 10, 'United Nations Day' ],
  [ 31, 10, 31, 10, 'Halloween' ],
  [  1, 11,  1, 11, 'All Saint\'s Day' ],
  [  2, 11,  2, 11, 'Election Day' ],
  [  7, 11,  7, 11, 'Daylight Savings Time Ends' ],
  [ 11, 11, 11, 11, 'Veterans Day' ],
  [ 18, 11, 18, 11, 'Board of Directors Meeting' ],
  [ 25, 11, 25, 11, 'Thanksgiving' ],
  [  1, 12,  9, 12, 'Hanukkah' ],
  [  4, 12,  4, 12, 'Hanukkah &amp; Holiday Decorations Go Up' ],
  [  7, 12,  7, 12, 'Hanukkah &amp; Pearl Harbor Day' ],
  [ 16, 12, 16, 12, 'Board of Directors Meeting' ],
  [ 21, 12, 21, 12, 'First Day of Winter' ],
  [ 24, 12, 24, 12, 'Christmas Eve' ],
  [ 25, 12, 25, 12, 'Christmas' ],
  [ 26, 12, 31, 12, 'Kwanzaa' ],
  [ 31, 12, 31, 12, 'Kwanzaa &amp; New Year\'s Eve' ]
];

var firstDaysMonth = [ 5, 1, 1, 4, 6, 2, 4, 0, 3, 5, 1, 3 ];

// Set Feb to 29 if it's a leap year.
var nbrDaysMonth = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
var monthAbbrs = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
  'Sep', 'Oct', 'Nov', 'Dec' ];
var year = '2010';

function getMtgDate() {

  var currDate = new Date();
  var currDay = currDate.getDate();
  var mtgDate = new Date( currDate.getFullYear(), currDate.getMonth(), 1, 0, 0,
    0, 0 );
  var mtgDay = mtgDate.getDate();
  var mtgDayWeek = mtgDate.getDay();

  do {

    if ( mtgDayWeek == 4 ) {

      // Check if today's date occurs after the third Thu of the month.
      if ( mtgDay + 14 < currDay ) {

        // Reset the date to first of next month and resume.
        mtgDate.setMonth( currDate.getMonth() + 1 );
        mtgDate.setDate( 1 );
        currDay = mtgDate.getDate();
        mtgDayWeek = mtgDate.getDay();
        mtgDay = mtgDate.getDate();

      }

    } else {

      mtgDay++;
      mtgDate.setDate( mtgDay );
      mtgDayWeek = mtgDate.getDay();

    }

  } while (( mtgDayWeek != 4 ) ||
    (( mtgDayWeek == 4 ) && ( mtgDay + 14 < currDay )));

  mtgDate.setDate( mtgDay + 14 );

  document.write( '<div style="position: absolute; top: 10px; right: 5px; width: 275px;"><a class="mtgDate" href="/board.html">The next Board of Directors meeting is on '+mtgDate.getDate()+' '+monthAbbrs[ mtgDate.getMonth() ]+' '+mtgDate.getFullYear()+'.</a></div>' );

}

function getNewsDate() {

  var newsURL = 'http://'+self.location.hostname+'/newsBlog/index.html';
  var regExp = /    [0-9]{2} [A-Z][a-z]+ [0-9]{4}/;
  var req = new XMLHttpRequest();

  req.open( 'GET', newsURL, false );
  req.setRequestHeader( 'User-Agent', navigator.userAgent );
  req.send( null );

  var newsDate = regExp.exec( req.responseText );

  if ( /Macintosh.*Firefox/.test( navigator.userAgent )) {

    document.write( '<div style="position: absolute; top: 199px; right: 18px;"><a class="newsDate" href="/newsBlog/index.html">News was updated on '+newsDate+'.</a></div></div>' );

  } else {

    document.write( '<div style="position: absolute; top: 199px; right: 10px;"><a class="newsDate" href="/newsBlog/index.html">News was updated on '+newsDate+'.</a></div></div>' );

  }
}

function getRandImage() {

  var currDate = new Date();

  // [ image, width, height ]
  var lsImages = [
    [ '/images/home/2005_1122Image0001.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0002.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0003.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0004.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0005.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0006.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0007.jpg', 448, 336 ],
    [ '/images/home/2005_1122Image0008.jpg', 448, 336 ]
  ];

  if ( currDate.getMonth() >= 2 && currDate.getMonth() <= 7 ) {

    var springImages = [
      [ '/images/home/springBird.jpg', 572, 429 ],
      [ '/images/home/springPelicans1.jpg', 572, 429 ],
      [ '/images/home/springPelicans2.jpg', 572, 429 ],
      [ '/images/home/summerDayLillies.jpg', 640, 480 ],
      [ '/images/home/summerGazebo.jpg', 640, 480 ],
      [ '/images/home/summerGeese.jpg', 640, 480 ]
    ];

    lsImages = lsImages.concat( springImages );

  } else {

    var fallImages = [
      [ '/images/home/fallGazebo.jpg', 745, 496 ],
      [ '/images/home/fallSunsetGazebo.jpg', 512, 384 ],
      [ '/images/home/fallSunsetPines.jpg', 512, 384 ],
      [ '/images/home/winterE_HarvardPl.jpg', 640, 480 ],
      [ '/images/home/winterE_WesleyPl.jpg', 640, 480 ],
      [ '/images/home/winterGazebo1.jpg', 640, 480 ],
      [ '/images/home/winterGazebo2.jpg', 640, 480 ],
      [ '/images/home/winterGeese1.jpg', 512, 384 ],
      [ '/images/home/winterGeese2.jpg', 640, 480 ],
      [ '/images/home/winterLake.jpg', 640, 480 ],
      [ '/images/home/winterMoon1.jpg', 640, 480 ],
      [ '/images/home/winterMoon2.jpg', 480, 640 ],
      [ '/images/home/winterMoon3.jpg', 640, 480 ],
      [ '/images/home/winterPines.jpg', 640, 480 ],
      [ '/images/home/winterPoolHouse1.jpg', 640, 480 ],
      [ '/images/home/winterPoolHouse2.jpg', 640, 480 ],
      [ '/images/home/xmasEntrance.jpg', 640, 480 ]
    ];

    lsImages = lsImages.concat( fallImages );

  }

  var randNbr = Math.floor( Math.random() * lsImages.length );

  document.write( '<center><img src="'+lsImages[ randNbr ][ 0 ]+'" width="'+lsImages[ randNbr ][ 1 ]+'" height="'+lsImages[ randNbr ][ 2 ]+'" border="0"></center>' );

}

function getBrowser() {

  var body = ( 'Hello\n\nMy browser is '+navigator.userAgent+'.\n\nI am experiencing difficulty...' );

  body = escape( body );
  document.write( '<a href="mailto:ebradsha&#64;ix.netcom.com?subject=Experiencing%20Difficulty%20Navigating%20the%20Website&body='+body+'">Experiencing Difficulty Navigating the Website</a>' );

}

function sortTable( table, row, col ) {

  var i, j, k;
  var order = 'asc';
  var regExp = /\/images\/asc.gif/;
  var tr = table.insertRow( table.rows.length );

  for ( k = 0; k < table.cols; k++ ) {

    if ( k == col ) {

      if ( document.getElementById ) {

        if ( regExp.test( document.getElementById( 'img' + k ).src )) {

          document.getElementById( 'img' + k ).alt = 'des';
          document.getElementById( 'img' + k ).src =
            '/images/des.gif';
          order = 'des';

        } else {

          document.getElementById( 'img' + k ).alt = 'asc';
          document.getElementById( 'img' + k ).src =
            '/images/asc.gif';
          order = 'asc';

        }

      } else if ( document.all ) {

        if ( regExp.test( document.all( 'img' + k ).src )) {

          document.all( 'img' + k ).alt = 'des';
          document.all( 'img' + k ).src =
            '/images/des.gif';
          order = 'des';

        } else {

          document.all( 'img' + k ).alt = 'asc';
          document.all( 'img' + k ).src =
            '/images/asc.gif';
          order = 'asc';

        }

      } else if ( document.layers ) {

        if ( regExp.test(
          document.layers[ divID ].document.images[ 'img' + k ].src )) {

          document.layers[ divID ].document.images[ 'img' + k ].alt = 'des';
          document.layers[ divID ].document.images[ 'img' + k ].src =
            '/images/des.gif';
          order = 'des';

        } else {

          document.layers[ divID ].document.images[ 'img' + k ].alt = 'asc';
          document.layers[ divID ].document.images[ 'img' + k ].src =
            '/images/asc.gif';
          order = 'asc';

        }
      }

    } else {

      if ( document.getElementById ) {

        document.getElementById( 'img' + k ).alt = 'none';
        document.getElementById( 'img' + k ).src =
          '/images/none.gif';

      } else if ( document.all ) {

        document.all( 'img' + k ).alt = 'none';
        document.all( 'img' + k ).src =
          '/images/none.gif';

      } else if ( document.layers ) {

        document.layers[ divID ].document.images[ 'img' + k ].alt = 'none';
        document.layers[ divID ].document.images[ 'img' + k ].src =
          '/images/none.gif';

      }
    }
  }

  for ( i = row; i < table.rows.length; i++ ) {

    for ( j = row; j < table.rows.length - 1; j++ ) {

      if ((( order == 'asc' ) && ( table.rows( j ).cells( col ).innerText >
        table.rows( j + 1 ).cells( col ).innerText )) ||
        (( order == 'des' ) && ( table.rows( j ).cells( col ).innerText <
        table.rows( j + 1 ).cells( col ).innerText ))) {

        for ( k = 0; k < table.cols; k++ ) {

          tr.insertCell( tr.cells.length );
          tr.cells( k ).innerHTML = table.rows( j ).cells( k ).innerHTML;
          table.rows( j ).cells( k ).innerHTML =
            table.rows( j + 1 ).cells( k ).innerHTML;
          table.rows( j + 1 ).cells( k ).innerHTML = tr.cells( k ).innerHTML;

        }
      }
    }
  }

  table.deleteRow( table.rows.length - 1 );

}

function getLoc() {

  var divID = ( document.getElementById ) ? document.getElementById( 'toc' ) :
    eval( "document.all[ 'toc' ]" );

  divID.style.top = eval( document.body.scrollTop );
  setTimeout( 'getLoc()', 10 );

}

function toggleElem( pt ) {

  var divID = 'toc';
  var elem = document.getElementById( 'elem' + pt ).style;
  var img = ( 'img' + pt );

  elem.display = ( elem.display == 'block' ) ? 'none' : 'block';

  if ( elem.display == 'block' ) {

    if ( document.getElementById ) {

      document.getElementById( img ).alt = 'open';
      document.getElementById( img ).src =
        '/images/open.gif';

    } else if ( document.all ) {

      document.all( img ).alt = 'open';
      document.all( img ).src =
        '/images/open.gif';

    } else if ( document.layers ) {

      document.layers[ divID ].document.images[ img ].alt = 'open';
      document.layers[ divID ].document.images[ img ].src =
        '/images/open.gif';

    }

  } else {

    if ( document.getElementById ) {

      document.getElementById( img ).alt = 'close';
      document.getElementById( img ).src =
        '/images/close.gif';

    } else if ( document.all ) {

      document.all( img ).alt = 'close';
      document.all( img ).src =
        '/images/close.gif';

    } else if ( document.layers ) {

      document.layers[ divID ].document.images[ img ].alt = 'close';
      document.layers[ divID ].document.images[ img ].src =
        '/images/close.gif';

    }
  }
}

function checkForm( form ) {

  if (( form.formHid.value == 'accCompl' ) ||
    ( form.formHid.value == 'accReq' ) ||
    ( form.formHid.value == 'gazeboResv' ) ||
    ( form.formHid.value == 'poolResv' ) ||
    ( form.formHid.value == 'dirUpdate' ) ||
    ( form.formHid.value == 'oldDirUpdate' )) {

    if ( ! checkName( form )) {

      return false;

    } else if ( ! checkAddr( form )) {

      return false;

    } else if ( ! checkPhone( form )) {

      return false;

    } else if ( ! checkEMail( form )) {

      return false;

    }
  }

  if (( form.formHid.value == 'accCompl' ) ||
    ( form.formHid.value == 'accReq' )) {

    if ( ! checkProjTypes( form )) {

      return false;

    }
  }

  if ( form.formHid.value == 'accReq' ) {

    if ( form.descrArea.value.length === 0 ) {

      alert( 'Please enter an improvement description.' );
      form.descrArea.focus();
      return false;

    } else if ( form.complTxt.value.length === 0 ) {

      alert( 'Please enter a planned completion date.' );
      form.complTxt.focus();
      return false;

    }
  }

  if (( form.formHid.value == 'gazeboResv' ) ||
    ( form.formHid.value == 'poolResv' )) {

    if ( ! checkDate( form )) {

      return false;

    } else if ( ! checkStart( form )) {

      return false;

    } else if ( ! checkEnd( form )) {

      return false;

    } else if ( ! checkGuests( form )) {

      return false;

    }
  }

  if (( form.formHid.value == 'poolPass' ) ||
    ( form.formHid.value == 'oldPoolPass' )) {

    if ( ! checkAddr( form )) {

      return false;

    } else if ( ! checkPhone( form )) {

      return false;

    } else if ( ! checkEMail( form )) {

      return false;

    }
  }

  if ( form.formHid.value == 'poolPass' ) {

    if ( ! getRows( form, 'yes' )) {

      return false;

    } else if ( ! checkNames( form, 'yes' )) {

      return false;

    }
  }

  if (( form.formHid.value == 'poolPass' ) ||
    ( form.formHid.value == 'dirUpdate' )) {

    if ( ! getRows( form, 'no' )) {

      return false;

    } else if ( ! checkNames( form, 'no' )) {

      return false;

    }
  }

  if ( form.formHid.value == 'oldPoolPass' ) {

    if (( form.adultsTxt.value.length === 0 ) ||
      ( isNaN( form.adultsTxt.value )) || ( form.adultsTxt.value < 1 ) ||
      ( form.adultsTxt.value > 12 )) {

      alert( 'Please enter the number of adults in the household.' );
      form.adultsTxt.focus();
      return false;

    } else if ( ! checkNames( form, 'yes' )) {

      return false;

    } else if (( form.childrenTxt.value.length === 0 ) ||
      ( isNaN( form.childrenTxt.value )) || ( form.childrenTxt.value < 0 ) ||
      ( form.childrenTxt.value > 12 )) {

      alert( 'Please enter the number of children in the household.' );
      form.childrenTxt.focus();
      return false;

    } else if ( ! checkNames( form, 'no' )) {

      return false;

    }
  }

  if ( form.formHid.value == 'oldDirUpdate' ) {

    if (( form.childrenTxt.value.length === 0 ) ||
      ( isNaN( form.childrenTxt.value )) || ( form.childrenTxt.value < 0 ) ||
      ( form.childrenTxt.value > 12 )) {

      alert( 'Please enter the number of children in the household (interested in doing odd jobs).' );
      form.childrenTxt.focus();
      return false;

    } else if ( ! checkNames( form, 'no' )) {

      return false;

    }
  }

  return true;

}

function checkName( form ) {

  if ( form.nameTxt.value.length === 0 ) {

    alert( 'Please enter your name.' );
    form.nameTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkAddr( form ) {

  if ( form.addrTxt.value.length === 0 ) {

    alert( 'Please enter your address.' );
    form.addrTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkPhone( form ) {

  if ( form.phoneTxt.value.length === 0 ) {

    alert( 'Please enter your phone number.' );
    form.phoneTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkEMail( form ) {

  if ( form.eMailTxt.value.length === 0 ) {

    alert( 'Please enter your e-mail address.' );
    form.eMailTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkProjTypes( form ) {

  var counter;
  var selects = 0;

  for ( counter = 0; counter < form.projChk.length; counter++ ) {

    if ( form.projChk[ counter ].checked ) {

      selects++;

    }
  }

  if ( selects < 1 ) {

    alert( 'Please select an improvement type.' );
    return false;

  } else {

    if ( form.projChk[ counter - 1 ].checked ) {

      if ( form.otherTxt.value.length === 0 ) {

        alert( 'Please enter the improvement type.' );
        form.otherTxt.focus();
        return false;

      }
    }

    return true;

  }
}

function checkDate( form ) {

  if ( form.dateTxt.value.length === 0 ) {

    alert( 'Please enter the event date.' );
    form.dateTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkStart( form ) {

  if ( form.startTxt.value.length === 0 ) {

    alert( 'Please enter the start time.' );
    form.startTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkEnd( form ) {

  if ( form.endTxt.value.length === 0 ) {

    alert( 'Please enter the end time.' );
    form.endTxt.focus();
    return false;

  } else {

    return true;

  }
}

function checkGuests( form ) {

  if ( form.guestsTxt.value.length === 0 ) {

    alert( 'Please enter the number of guests.' );
    form.guestsTxt.focus();
    return false;

  } else {

    return true;

  }
}

function getRows( form, adults ) {

  var alertMsg, rows, table, td, tr, txtField;

  if ( adults == 'yes' ) {

    alertMsg = 'Please enter the number of adults in the household.';
    table = document.getElementById( 'adultsTbl' );
    rows = ( table.rows.length - 1 ) / 2;
    txtField = form.adultsTxt;

  } else {

    table = document.getElementById( 'childrenTbl' );
    txtField = form.childrenTxt;

    if ( form.formHid.value == 'poolPass' ) {

      alertMsg = 'Please enter the number of children in the household.';
      rows = ( table.rows.length - 1 ) / 2;

    } else {

      alertMsg = 'Please enter the number of children in the household (interested in doing odd jobs).';
      rows = ( table.rows.length - 1 ) / 3;

    }
  }

  if (( txtField.value.length === 0 ) || ( isNaN( txtField.value )) ||
    ( txtField.value < 0 ) || ( txtField.value > 12 )) {

    alert( alertMsg );
    txtField.focus();
    return false;

  } else {

    if ( rows < txtField.value ) {

      while ( rows < txtField.value ) {

        tr = table.insertRow( table.rows.length );
        td = tr.insertCell( tr.cells.length ).innerHTML = 'Name';

        if ( adults == 'yes' ) {

          td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="text" name="adultNameTxt" size="60" maxlength="80">';
          tr = table.insertRow( table.rows.length );
          td = tr.insertCell( tr.cells.length ).innerHTML;

          if ( rows === 0 ) {

            td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="radio" checked name="headRadio" value="'+rows+'">Head of the household';

          } else {

            td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="radio" name="headRadio" value="'+rows+'">Head of the household';

          }

        } else {

          td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="text" name="childNameTxt" size="60" maxlength="80">';
          tr = table.insertRow( table.rows.length );

          if ( form.formHid.value == 'poolPass' ) {

            td = tr.insertCell( tr.cells.length ).innerHTML = 'Birth date (age 13 and under)';
            td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="text" name="dobTxt" size="60" maxlength="80">';

          } else {

            td = tr.insertCell( tr.cells.length ).innerHTML = 'Age';
            td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="text" name="ageTxt" size="60" maxlength="80">';
            tr = table.insertRow( table.rows.length );
            td = tr.insertCell( tr.cells.length ).innerHTML = 'Areas of interest';
            td = tr.insertCell( tr.cells.length ).innerHTML = '<input type="text" name="intTxt" size="60" maxlength="80">';

          }
        }

        rows++;

      }

    } else if ( rows > txtField.value ) {

      while ( rows > txtField.value ) {

        tr = table.deleteRow();
        tr = table.deleteRow();

        if ( form.formHid.value == 'dirUpdate' ) {

          tr = table.deleteRow();

        }

        rows--;

      }
    }

    return true;

  }
}

function checkNames( form, adults ) {

  var counter, nameTxtField, txtField;

  if ( adults == 'yes' ) {

    nameTxtField = form.adultNameTxt;
    txtField = form.adultsTxt;

  } else {

    nameTxtField = form.childNameTxt;
    txtField = form.childrenTxt;

  }

  if ( txtField.value == 1 ) {

    if ( nameTxtField.value.length === 0 ) {

      alert( 'Please enter a name.' );
      nameTxtField.focus();
      return false;

    }

  } else {

    for ( counter = 0; counter < txtField.value; counter++ ) {

      if ( nameTxtField[ counter ].value.length === 0 ) {

        alert( 'Please enter a name.' );
        nameTxtField[ counter ].focus();
        return false;

      }
    }
  }

  return true;

}

function popupInstr( url ) {

  var features = 'directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, toolbar=yes, width=500, height=500';

  window.open( url, 'instr', features, false );

}

function printMonth( monthNbr ) {

  var counter = 0;
  var dayNbr = 0;

  document.write( '<table width="100%" class="calInner"><caption>'+monthAbbrs[ monthNbr ]+' '+year+'</caption>' );
  document.write( '<tr height="12.5%"><td align="center">Sun</td><td align="center">Mon</td><td align="center">Tue</td><td align="center">Wed</td><td align="center">Thu</td><td align="center">Fri</td><td align="center">Sat</td></tr>' );

  while ( dayNbr <= firstDaysMonth[ monthNbr ] + nbrDaysMonth[ monthNbr ] ) {

    document.write( '<tr height="12.5%">' );
    printWeek( monthNbr, dayNbr );
    document.write( '</tr>' );
    dayNbr = dayNbr + 7;
    counter++;

  }

  while ( counter < 6 ) {

    document.write( '<tr height="12.5%"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>' );
    counter++;

  }

  document.write( '</table>' );

}

function printWeek( monthNbr, dayNbr ) {

  var cmpDayNbr, counter;
  var firstDay = firstDaysMonth[ monthNbr ];

  for ( counter = 0; counter < 7; counter++ ) {

    document.write( '<td align="center">' );
    cmpDayNbr = dayNbr + counter;

    if ( cmpDayNbr >= firstDay &&
      cmpDayNbr < firstDay + nbrDaysMonth[ monthNbr ] ) {

      document.write( printDay( monthNbr, cmpDayNbr - firstDay + 1 ));

    }

    document.write( '</td>' );

  }
}

function printDay( monthNbr, cmpDayNbr ) {

  var event;
  var rtnStr = new String( cmpDayNbr );

  for ( event = 0; event < events.length; event++ ) {

    if ( monthNbr + 1 == events[ event ][ 1 ] ) {

      if ( events[ event ][ 3 ] - events[ event ][ 1 ] > 0 ) {

        if ( cmpDayNbr >= events[ event ][ 0 ] ) {

          rtnStr = '<a class="calOver" href="javascript:void( 0 )" title="'+events[ event ][ 4 ]+'">'+cmpDayNbr+'</a>';

        }

      } else {

        if ( cmpDayNbr >= events[ event ][ 0 ] &&
          cmpDayNbr <= events[ event ][ 2 ] ) {

          rtnStr = '<a class="calOver" href="javascript:void( 0 )" title="'+events[ event ][ 4 ]+'">'+cmpDayNbr+'</a>';

        }
      }

    } else if ( monthNbr + 1 == events[ event ][ 3 ] ) {

      if ( cmpDayNbr <= events[ event ][ 2 ] ) {

        rtnStr = '<a class="calOver" href="javascript:void( 0 )" title="'+events[ event ][ 4 ]+'">'+cmpDayNbr+'</a>';

      }

    } else if ( monthNbr + 1 > events[ event ][ 1 ] &&
      monthNbr + 1 < events[ event ][ 3 ] ) {

      rtnStr = '<a class="calOver" href="javascript:void( 0 )" title="'+events[ event ][ 4 ]+'">'+cmpDayNbr+'</a>';

    }
  }

  return rtnStr;

}

function printEvents() {

  var event;

  document.write( '<center><table cellspacing="10">' );

  for ( event = 0; event < events.length; event++ ) {

    if (( events[ event ][ 0 ] == events[ event ][ 2 ] ) &&
      ( events[ event ][ 1 ] == events[ event ][ 3 ] )) {

      document.write( '<tr><td align="right">'+events[ event ][ 0 ]+' '+monthAbbrs[ events[ event ][ 1 ] - 1 ]+' '+year+'</td><td>'+events[ event ][ 4 ]+'</td></tr>' );

    } else if ( events[ event ][ 1 ] == events[ event ][ 3 ] ) {

      document.write( '<tr><td align="right">'+events[ event ][ 0 ]+' to '+events[ event ][ 2 ]+' '+monthAbbrs[ events[ event ][ 1 ] - 1 ]+' '+year+'</td><td>'+events[ event ][ 4 ]+'</td></tr>' );

    } else {

      document.write( '<tr><td align="right">'+events[ event ][ 0 ]+' '+monthAbbrs[ events[ event ][ 1 ] - 1 ]+' to '+events[ event ][ 2 ]+' '+monthAbbrs[ events[ event ][ 3 ] - 1 ]+' '+year+'</td><td>'+events[ event ][ 4 ]+'</td></tr>' );

    }
  }

  document.write( '</table></center>' );

}

