shabbatUpdatedDate = new Date("02/03/2012")

eruvStatus = "Up"

checkers = "Rachel Spiller,Amy Robert, and Yoni Appelbaum"
reasonLine =//"It is unfortunate to report that even before checking for damage inflicted by this week's storm, the eruv leadership has decided to declare the eruv DOWN for this Shabbat.  While our contractor has been working diligently to repair the damage from last week's blizzard, he has reported that those repairs will not be complete by Friday afternoon."  // for when the eruv is down

// and Rachel Goldberg, Brian Zuckerman, Jonathan Lipnick, Judy Herzberg, Zev Nagel
// Yehonatan Givati, Rebecca Kotlicky, Laura Held, Estye Ross Fenton, Jeremy Rothman-Shore
// Elisha Russ-Fishbane, Mike Frank, Judith Herzberg, Rabbi Robert Klapper, Josh Meyer
//  Yoni Appelbaum, Jonathan Lipnick, Nicky McCatty, and Steve Garland

curDate = new Date()
var oneMinute = 60 * 1000  // milliseconds in a minute
var oneHour = oneMinute * 60
var oneDay = oneHour * 24
var oneWeek = oneDay * 7

function getDisplayMonth(iMonth) {
    // pass in an month as an integer
    // return the month string
    var monthArray = new Array("January","Febuary","March","April","May","June","July","August","September","October","November","December");
    return monthArray[iMonth];
}

function getDisplayDate(passedDate){
    // uses getDisplayMonth()
    // returns passed Date formatted nicely
    // Month day, Year  mmmm dd, yyyy      
    theDate = new Date(passedDate);

    // split into day, month, year

    iDay = theDate.getDate();
    iMonth = theDate.getMonth();
    iYear = theDate.getFullYear();
    sDisplayDate = (iMonth + 1) + "/" + iDay + "/" + iYear;

    return sDisplayDate;
}

function addWeek(passedDate) {
  var theDate = new Date(passedDate);
  var newDate = theDate.getTime() + oneWeek

  return newDate;
}

function addDay(passedDate) {
  var theDate = new Date(passedDate); 
  var newDate = theDate.getTime() + oneDay

  return newDate;
}

if (curDate > addDay(addDay(shabbatUpdatedDate)))  {
   shabbatDate = addWeek(shabbatUpdatedDate)
   eruvStatus = "Unknown"
   statusLine = "The Eruv status has not yet been determined."
   extraLine = "<Span id='CheckBackLine'>Please check back closer to Shabbat.</span><p>"
} else  {
   shabbatDate = shabbatUpdatedDate
   if (eruvStatus == "Down")   {
       statusLine = "The Eruv is DOWN."
       extraLine = "<P><IMG hspace=10 src='http://www.nceruv.org/eruvDown_files/underConstruction.jpg' vspace=10><BR>"
       reasonLine = "<div id='CheckBackLine'>" + reasonLine + "</div><BR><BR>"

      if(checkers && checkers != "") {
           reasonLine += "<div id='CheckersLine'>Thanks to this week's volunteer eruv checkers: " + checkers + ". </div><BR><BR>"
      }
   }
   else{
      statusLine = "The Eruv is Up."
      extraLine = "<P><IMG hspace=10 src='http://www.nceruv.org/eruvUp_files/eruvUp.gif' vspace=10><br>"

      if(checkers && checkers != "") {
           reasonLine = "<div id='CheckersLine'>Thanks to this week's volunteer eruv checkers: " + checkers + ". </div><BR><BR>"
      } else {
           reasonLine = "<BR><BR>"
      }
   }
}

shabDateString = getDisplayDate(shabbatDate) + "-" + getDisplayDate(addDay(shabbatDate));


     document.writeln("<center>");
     document.writeln("<div id='StatusHeader'><strong>");
     document.writeln(statusLine);
     document.writeln("</strong></div><BR>");
     document.writeln(extraLine);
     document.writeln("<div id='DateLine'>Shabbat: " + shabDateString + "</div><BR><br>");
     document.writeln("</center>");
     document.writeln(reasonLine);
     document.writeln("<div id='SupportLine'>The North Charles Community Eruv (NCCE) is a community organization always in need of your financial and volunteer support.  You can get more information at <a href=http://www.nceruv.org target='eruvsite'>www.nceruv.org</a>.</div>");

