<?xml version="1.0" encoding="UTF-8" ?>  
<Module>  
  <ModulePrefs title="Scrolling List" title_url="http://www.apollojack.com"
    description="Provides a list of scrolling items" author="Rebecca Croft, Ensynch" 
    author_email="info@ensynch.com" height="100"/>   
  <UserPref name="myNumItems" display_name="Items to Show" /> 
  <UserPref name="myTimer" display_name="Time to Scroll" /> 
  <UserPref name="myStyle" display_name="Content Font Style" default_value="8pt Georgia" />
  <UserPref name="myList" display_name="List of Items" datatype="list" />
  <Content type="html">
    <![CDATA[ 

      <div id="content_div"></div> 

      <script type="text/javascript">
 
      // Get UserPrefs Options
      var prefs = new _IG_Prefs(); //new gadgets.Prefs();

      // Get Details of UserPrefs
      var items = prefs.getArray("myList"); 
      var style = prefs.getString("myStyle");
      var numToShow = 99999;
      var timer = 99999;

      //validate entries
      if (!isNaN(prefs.getString("myNumItems")))
      {
        numToShow = new Number(prefs.getString("myNumItems"));
      }

      if (numToShow > 99999)
      {
        numToShow = 99999
      }

      if (!isNaN(prefs.getString("myTimer")))
      {
        timer = new Number(prefs.getString("myTimer"));
      }

      if (timer > 99999)
      {
        timer = 99999;
      }

      // keep track of where we are in our loop
      var curIndex = 0;

      // load list once for initial display
      displayList();

      // reload list after delay
      setInterval("displayList()", timer * 1000);

      function displayList()
      {

        // Build HTML to show the user 
        var html = "<table id='content-table' cellPadding='1px' border='0'>";
         
        // Loop through and display items 
        if (items.length > 0)
        {

          var loopUntil = numToShow;
          var itemToShow = new Number(curIndex);

          // if user has set the number to show greater than the number of items we 
          // have in our list, only loop through the number in the list
          if (items.length < loopUntil)
          {
            loopUntil = items.length;
          } 

          //loop through our items, keeping track of where we are and what needs to be shown
          for (var i = 0; i < loopUntil; i++) 
          { 
            
            //if we have moved past the end of the list start back at the beginning
            if (itemToShow >= items.length)
            {
              itemToShow = 0;
            }   

            html += "<tr><td>" + items[itemToShow] + "</td></tr>"; 

            itemToShow++;

          } 

          // Start loop at the next one in the list
         curIndex++;

          if (curIndex >= items.length)
          {
            curIndex = 0;
          }
  
        } 

        html += "</table>"

        document.getElementById("content_div").innerHTML = html;

        //load in our style element
        var cells=document.getElementsByTagName("td");
        for (var i=0; i < cells.length; i++)
        {
          cells[i].style.font = style;
        }

      }

      </script>

   ]]>  

  </Content> 
</Module>



























































































































