/* Modifications */
/* 09/23/09 New JavaScript to calculate next meeting date (LK) */
/* 11/23/09 Keyed in 2010 meeting dates (LK) */

function calcdate(passedType)
{
  var nextdate = new Array(12);
  var nd = new Date();
  var currentYear = nd.getFullYear() + "";
  var currentMonth = (nd.getMonth()+1) + "";
  var currentDay = nd.getDate() + "";

  if (currentMonth.length == 1)
     {
       currentMonth = "0" + (nd.getMonth()+1)
     }
  if (currentDay.length == 1)
     {
       currentDay = "0" + nd.getDate()
     }
  var currdate = currentYear + currentMonth + currentDay;
  var x = nd.getMonth();

  switch(passedType)
  {
/* First Sunday dates for 2010 - Houston */
    case 'ph1':
      nextdate[0] = "20100110";
      nextdate[1] = "20100207";
      nextdate[2] = "20100307";
      nextdate[3] = "20100411";
      nextdate[4] = "20100502";
      nextdate[5] = "20100606";
      nextdate[6] = "20100711";
      nextdate[7] = "20100801";
      nextdate[8] = "20100912";
      nextdate[9] = "20101003";
      nextdate[10] = "20101107";
      nextdate[11] = "20101205";
      break;
/* Third Thursday dates for 2010 - Houston */
    case 'ph2':
      nextdate[0] = "20100121";
      nextdate[1] = "20100218";
      nextdate[2] = "20100318";
      nextdate[3] = "20100415";
      nextdate[4] = "20100520";
      nextdate[5] = "20100617";
      nextdate[6] = "20100715";
      nextdate[7] = "20100819";
      nextdate[8] = "20100916";
      nextdate[9] = "20101021";
      nextdate[10] = "20101118";
      nextdate[11] = "20101216";
      break;
/* Fourth Sunday dates for 2010 - Clear Lake */
    case 'cl1':
      nextdate[0] = "20100124";
      nextdate[1] = "20100228";
      nextdate[2] = "20100328";
      nextdate[3] = "20100425";
      nextdate[4] = "20100523";
      nextdate[5] = "20100627";
      nextdate[6] = "20100725";
      nextdate[7] = "20100822";
      nextdate[8] = "20100926";
      nextdate[9] = "20101024";
      nextdate[10] = "20101128Tenative";
      nextdate[11] = "20101226Tenative";
      break;
/* Second Friday dates for 2010 - Hatch/Pflag Houston */
    case 'pp1':
      nextdate[0] = "20100108";
      nextdate[1] = "20100212";
      nextdate[2] = "20100312";
      nextdate[3] = "20100409";
      nextdate[4] = "20100514";
      nextdate[5] = "20100611";
      nextdate[6] = "20100709";
      nextdate[7] = "20100813";
      nextdate[8] = "20100910";
      nextdate[9] = "20101008";
      nextdate[10] = "20101112";
      nextdate[11] = "20101210";
      break;
/* Fourth Friday dates for 2010 - Hatch/Pflag HoustonHouston */
    case 'pp2':
      nextdate[0] = "20100122";
      nextdate[1] = "20100226";
      nextdate[2] = "20100326";
      nextdate[3] = "20100423";
      nextdate[4] = "20100528";
      nextdate[5] = "20100625";
      nextdate[6] = "20100723";
      nextdate[7] = "20100828";
      nextdate[8] = "20100924";
      nextdate[9] = "20101022";
      nextdate[10] = "20101126 - Canceled<br>Thanksgiving Holiday";
      nextdate[11] = "20101224 - Canceled<br>Christmas Holiday";
      break;
    default:
      var meetingdate = "";
      return meetingdate;
  }
  if (currdate > nextdate[x].substring(0,8))
     {
       x++;
       if (x == 12)
          {
           x = 0;
          }
     }
  var meetingyear = nextdate[x].substring(0,4);
  var meetingmonth = nextdate[x].substring(4,6);
  if (nextdate[x].length > 8)
     {
       var meetingday = nextdate[x].substring(6,8);
       var msg = nextdate[x].substring(8);
       var meetingdate = meetingmonth + "/" + meetingday + "/" + meetingyear + " " + msg;
     }
  else
     {
       var meetingday = nextdate[x].substring(6);
       var meetingdate = meetingmonth + "/" + meetingday + "/" + meetingyear;
     }
  return meetingdate;
}  

