var Unit=new Array();
var WidthNum=32;
var WidthPlace=57;
var WidthMonth=33;
var HeightHeader=24;
var HeightBase=46;
var Gap=1;
var HeightRow=LodgeRow;
var WidthHeader=WidthNum+WidthName+WidthPlace+((WidthMonth+Gap+4)*ActiveMonths)-2;
var WidthBox=921-WidthHeader;
var WidthBoxHdr=WidthBox+6;
var HeightBox=((HeightRow+4+Gap)*(LodgeCount+2))-16-6-Gap;
var HeightYearBar=343-HeightBox;
var StartLeft=0;
var StartTop=80;
var ButtonPos=10;
var ButtonGap=71;
var ButtonWidth=50;
var ButtonHeight=17;
var ButtonPadding=6;

function CreateMeetingsArray()
{
   var ArrayLeft=StartLeft;
   var ArrayTop=StartTop;
   document.write("<div class=\"calendarhead\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthHeader + "px;height:" + HeightHeader + "px;background-color:#00003b;\">Calendar " + ThisYear + "</div>");
   ArrayLeft=ArrayLeft+WidthHeader+17;
   document.write("<div class=\"calendarhead\" id=\"namenum\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthBoxHdr + "px;height:" + HeightHeader+ "px;background-color:#00003b;\"></div>");
   ArrayTop=ArrayTop+HeightHeader+Gap+16;
   document.write("<div class=\"calendarhead\" id=\"details\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthBox + "px;height:" + HeightBox + "px;border-style:solid;border-width:3px;border-color:#00003b;background-color:#dedede;\">",
   "<div style=\"position:relative;top:8px;left:0px;height:80px;width:" + WidthBox + "px;margin-left:auto;margin-right:auto;\"><img src=\"images/blank1.png\" id=\"detailsimage\" style=\"width:80px;height:80px;;\" /></div>",
   "<div id=\"detailstext\" style=\"position:absolute;left:0px;top:86px;border-style:none;padding:15px;font-family:arial;font-size:12px;font-weight:normal;color:#000000;text-align:justify;z-index:3;\"><br /><br /><br />This box is for an introduction to your lodge, chapter, etc. including its crest and contact email link.  It can also be used for announcements related to the current year.  Secretaries please email Phil with relevant information (a couple of paragraphs only).</div>",
   "</div>");

   ArrayLeft=StartLeft;
   document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthNum + "px;height:" + HeightRow + "px;color:#ffffff;background-color:#000030;\">No.</div>");
   ArrayLeft=ArrayLeft+WidthNum+Gap+4;
   document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthName + "px;height:" + HeightRow + "px;color:#ffffff;background-color:#000030;\">Lodge</div>");
   ArrayLeft=ArrayLeft+WidthName+Gap+4;
   document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthPlace + "px;height:" + HeightRow + "px;color:#ffffff;background-color:#000030;\">Place</div>");
   ArrayLeft=ArrayLeft+WidthPlace+Gap+4;
   for(j = 3; j <= 14; j++)
      {
         if (j!=8 && j!=9 && j!=10)
            {
               document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthMonth + "px;height:" + HeightRow + "px;color:#ffffff;background-color:#000030;\">" + Months[j] + "</div>");
               ArrayLeft=ArrayLeft+WidthMonth+Gap+4;
            }
      }
   ArrayTop=ArrayTop+HeightRow+Gap+4;
   for(i = 0; i <= LodgeCount; i++)
   {
      Unit=Lodges[i].split(Delimiter);
      ArrayLeft=StartLeft;
      document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthNum + "px;height:" + HeightRow + "px;\"><a class=\"SelectStyle1\" onclick='ShowDetails(\"" + Lodges[i] + "\")'>" + Unit[0] + "</a></div>");
      ArrayLeft=ArrayLeft+WidthNum+Gap+4;
      document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthName + "px;text-align:left;height:" + HeightRow + "px;\"><a class=\"SelectStyle1\" onclick='ShowDetails(\"" + Lodges[i] + "\")'>" + Unit[1] + "</a></div>");
      ArrayLeft=ArrayLeft+WidthName+Gap+4;
      document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthPlace + "px;height:" + HeightRow + "px;\">" + Unit[2] + "</div>");
      ArrayLeft=ArrayLeft+WidthPlace+Gap+4;
      for(j = 3; j <= 14; j++)
         {
            if (j!=8 && j!=9 && j!=10)
               {
                  if (Unit[j]!= "")
                     {
                        if (j == Unit[15])
                           {
                              document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthMonth + "px;height:" + HeightRow + "px;color:#dd0000;\">" + Unit[j] + "</div>");
                           }
                        else
                           {
                              document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthMonth + "px;height:" + HeightRow + "px;\">" + Unit[j] + "</div>");
                           }
                     }
                  else
                     {
                        document.write("<div class=\"divcelllodge\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:" + WidthMonth + "px;height:" + HeightRow + "px;\">-</div>");

                     }
                  ArrayLeft=ArrayLeft+WidthMonth+Gap+4;

               }
         }
      ArrayTop=ArrayTop+HeightRow+Gap+4;
   }
   ArrayLeft=StartLeft;
   document.write("<div class=\"calendarhead\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:944px;height:" + HeightYearBar + "px;background-color:#00003b;\"></div>");
   for(i = FromYear; i <= ToYear; i++)
      {
         document.write("<div style=\"position:absolute;left:" + ButtonPos + "px;top:" + (ArrayTop+ButtonTopAdj) + "px;width:" + ButtonWidth + "px;height:" + ButtonHeight + "px;border:0;background-color:#000030;padding:" + ButtonPadding + "px;border-style:solid;border-width:1px;border-color:#555555;text-align:center;z-index:5\">");
         if (i==SelectedYear)
         {
            document.write("<span class=\"CalendarYearSelected\">" + SelectedYear + "</span>");
         }
         else
         {
            document.write("<a class=\"CalendarYear\" href=\"lodges.htm?SelectedYear=" + i + "\" >" + i + "</a>");
         }
         document.write("</div>");
         ButtonPos = ButtonPos + ButtonGap;
      }
   ArrayTop=550-HeightBase;
   document.write("<div class=\"calendarhead\" style=\"left:" + ArrayLeft + "px;top:" + ArrayTop + "px;width:944px;height:" + HeightBase + "px;background-color:#00003b;\"></div>");
}

CreateMeetingsArray();