<?xml version="1.0" encoding="UTF-8" ?> 
<Module>

  <ModulePrefs 
     title="Sun Today" 
     title_url="http://www.spaceweather.com/"
     height="165"
     author="Dave Pearson" 
     author_location="South Lincolnshire, UK" /> 

  <!-- 
    TODO: Check if there is an image for today. If there isn't, work
          backwards until one can be found.
  -->

  <Content type="html">
    <![CDATA[ 

      <p style="text-align: center; background: black; color: white; margin-top: 0px; margin-bottom: 0px;">
      
      <script type="text/javascript"><!--

        // Convert a month number into a three-letter month name.
        function monthName( month )
        {
          var months = new Array( "jan", "feb", "mar", "apr", "may", "jun",
                                  "jul", "aug", "sep", "oct", "nov", "dec" );
          return( months[ month ] );
        }

        // Build the name of the solar image file.
        function sunImageName()
        {
          var today = new Date();

          return "http://www.spaceweather.com/images"          +
                 today.getFullYear()                           +
                 "/"                                           +
                 ( today.getDate() < 10 ? "0" : "" )           +
                 today.getDate()                               +
                 monthName( today.getMonth() )                 +
                 today.getFullYear().toString().substring( 2 ) +
                 "/midi163.gif";
        }

        // Emit the HTML for showing an image for today.
        document.write( "<img src=\"" + sunImageName() + "\" alt=\"No image of the Sun available at the moment.\" />\n" );

      --></script>

      </p>

    ]]>
  </Content> 

</Module>
