function drawGuideIndex(piSeason, psTitle, psAirDate, piRating, psURLPrefix, psQuote, psSeasonTitle, psSeasonYears, pDrawHeader)
{
   var i, iRate, iRateCount;

   iRate = 0; iRateCount = 0;
   for (i = 0; i < piRating.length; i++)
   {
       if (piRating[i] > 0)
       {
          iRateCount++;
          iRate += piRating[i];
       }
   }
   iRate = (iRateCount == 0 ? 0 : iRate / iRateCount);

   if (pDrawHeader)
   {
       document.write("<FONT SIZE=5><B>" + psSeasonTitle + "</B> (" + psSeasonYears + ")</FONT>\n");
        for (i = 0; i < iRate; i++)
           document.write("<IMG BORDER=0 WIDTH=10 HEIGHT=10 SRC=\"../images/star.gif\" ALT=\"*\">");

       document.write("<BLOCKQUOTE><SPAN CLASS=\"QUOTE\">\n");
       document.write(psQuote);
       document.write("</SPAN></BLOCKQUOTE><BR>\n");
   }

   document.write("<TABLE WIDTH=100% ALIGN=CENTER>\n");
   if (pDrawHeader)
   {
       document.write("<TR>\n");
       document.write("<TH ALIGN=LEFT VALIGN=BOTTOM>#</TH>\n");
       document.write("<TH ALIGN=LEFT VALIGN=BOTTOM>Title</TH>\n");
       document.write("<TH ALIGN=LEFT VALIGN=BOTTOM>Original Air Date</TH>\n");
       document.write("<TH ALIGN=LEFT VALIGN=BOTTOM>Rating (1-10)</TH>\n");
       document.write("</TR>\n");
   }

   if (psTitle.length > 0 && psTitle[0].length > 0)
   {
       for (i = 0; i < psTitle.length; i++)
       {
          document.write("<TR>\n");
          document.write("<TD WIDTH=64 VALIGN=TOP NOWRAP>" + piSeason);
          if (i < 9)
            document.write(".0" + (i + 1));
          else
            document.write("." + (i + 1));
          document.write("</TD>\n");
          document.write("<TD VALIGN=TOP NOWRAP><A HREF=\"" + psURLPrefix + (i + 1) + ".shtml\" onMouseOver=\"javascript:this.style.textDecoration='underline'\" onMouseOut=\"javascript:this.style.textDecoration='none'\"><FONT onMouseOver=\"javascript:this.style.color='#CCCCCC'\" onMouseOut=\"javascript:this.style.color='#B07000'\"><B>" + psTitle[i] + "</B></FONT></A></TD>\n");
          if (pDrawHeader)
          {
              document.write("<TD VALIGN=TOP NOWRAP>" + psAirDate[i] + "</TD>\n");
              document.write("<TD VALIGN=TOP NOWRAP>\n");
              for (iRate = 0; iRate < piRating[i]; iRate++)
                 document.write("<IMG BORDER=0 WIDTH=10 HEIGHT=10 SRC=\"../images/star.gif\" ALT=\"*\">");
              document.write("</TD>\n");
          }
          document.write("</TR>\n");
       }
    }

   document.write("</TABLE>\n");
   document.write("<BR>\n");
}

