var CurrentYear;

function CurrentMonthName(MonthNumber)
{
  var MonthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  
 return MonthNames[MonthNumber - 1];
}

function GetCurrentFileName()
{
  var PathName = location.pathname.replace(/\\/gi, "/");
  var PathNameParts = PathName.split("/");
  
 return PathNameParts[PathNameParts.length - 1];
}

function BuildDrillLink(ItemNumber)
{
//year, month, title, link
  var BoilerPlate;
  var DrillItem;
  var Target = "";
  var RowBackgroundColor;
  
  DrillItem = DrillLinks[ItemNumber].split("|");

  YearBreak = "";
  
  if (CurrentYear != DrillItem[0])
  {
	YearBreak = "<td  class='DomArchYear' align='left'>" + "<span class='newstitle'>" + DrillItem[0] + "</span>" + "</td>";

	if (CurrentYear != "1996")
	{
	  YearBreak = "<tr><td class='DomArchList'>&nbsp;</td><td class='DomArchList'>&nbsp;</td></tr><tr>" + YearBreak + "<td class='DomArchList'>&nbsp;</td></tr>";
    }
	else
	{	
	  YearBreak = "<tr>" + YearBreak + "<td class='DomArchList'>&nbsp;</td></tr>";
	}
	
    CurrentYear = DrillItem[0];
  }
  
  
  if (ItemNumber % 2 == 0)
  {
    RowBackgroundColor = "#e0e0e0";
  }
  else
  {
    RowBackgroundColor = "#eeeeee";
  }

  BoilerPlate = YearBreak + "<tr valign='top' style='background-color=" + RowBackgroundColor + ";'>" + "<td class='DomArchList'>" + '<a class="DomArchList" href="' + DrillItem[3] + '" title="Click to View ' + DrillItem[2] + '" style="background-color=' + RowBackgroundColor + ';">' + CurrentMonthName(DrillItem[1]) + '&nbsp;</a>' + "</td>" + "<td class='DomArchList'>" + '<a class="DomArchList" href="' + DrillItem[3] + '" title="Click to View ' + DrillItem[2] + '" style="background-color=' + RowBackgroundColor + ';">' + DrillItem[2] + '</a>' + "</td>" + "</tr>";
    
//  BoilerPlate = TableFrame + '<a class="Headlinelink" ' + 
//	Target +
//	'href="' +
//    DrillItem[3] +
//    '" title="Click to View ' +   
//    DrillItem[2] +
//    '">' +
//	'<td>' +
//    CurrentMonthName(DrillItem[1]) +
//	'</td>' +
//    '<td>' +
//    DrillItem[2] +
//    '</td>' +
//	'</a>';
  
  //BoilerPlate = BoilerPlate + "</tr>";
  
  return BoilerPlate; 
}

function WriteDrillList()
{
  //CurrentFileName is the name of the current file which is calling the function.
  //DrillList is a an array which contains pairs of entries for each menu option.  
  //DrillList[i] is the link
  //DrillList[i+1] is the label
  
  var i;
  var DrillItemString;
  //var CurrentFileName = GetCurrentFileName();
  
  CurrentYear = "1996";

  document.write("<br><br>");
  
  document.write('<table width="90%" border="0" cellspacing="0" cellpadding="0" style="padding-left=2em;">');
  
  
  for (i=0; i < DrillLinks.length; i++)
  {
	DrillItemString = BuildDrillLink(i);
    document.write(DrillItemString);
    //document.write("<br>");
	//if ((MenuItemString != "") && (i + 1 < DrillLinks.length))
    //  document.write("<br><hr width='60%'><br>");
  }

  document.write("<tr><td>&nbsp;</td><td>&nbsp;</td></tr>");
  document.write('</table>');

  
}


