<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs title="Children's Book of the Day" title_url="http://www.childrenslibrary.org" directory_title="Children's Book of the Day" description="A new book each day from the International Children's Digital Library's free collection of books" author="International Children's Digital Library" author_email="icdl-info@cs.umd.edu" author_affiliation="International Children's Digital Library Foundation" screenshot="http://www.childrenslibrary.org/library/basic/icdlbookofday.gif" 
thumbnail="http://www.childrenslibrary.org/library/basic/icdlbookofdaythumb.gif">
  <Require feature="analytics" /> 
</ModulePrefs>
<UserPref name="showlink" display_name="Show more books link?" datatype="bool" default_value="true"/>
<UserPref name="color" display_name="Background color" default_value="green" datatype="enum">
<EnumValue value="green"/>
<EnumValue value="white"/>
</UserPref>

<Content type="html">
<![CDATA[
   <script>
     // Track this gadget using Google Analytics.
     _IG_Analytics("UA-97669-3", "/test_analyticslib");
   </script>
<style type="text/css">
body {margin: 0px;
text-align:center; 
font-size: 80%; 
font-family: arial unicode ms, arial, helvetica, sans-serif;
padding: 10px; 
}
</style>
<script type="text/javascript">
function onLoadFunc__MODULE_ID__() {
  var prefs = new _IG_Prefs(__MODULE_ID__);
  var color = prefs.getString("color");
  var showlink = prefs.getBool("showlink");
  var rand=Math.round(Math.random()*1000000);

  // set bg color
  if (color=="green")
      document.body.style.backgroundColor="#CCDDAA";
  else
      document.body.style.backgroundColor="white";

  // get featured book
  
  var url="http://www.childrenslibrary.org/icdl/BookOfTheDayFeed?rand="+rand+"&showlink="+showlink;
  _IG_FetchContent(url, function (responseText) {
    var pic = _gel("pic" + __MODULE_ID__);
    pic.innerHTML=responseText;
  });
};

_IG_RegisterOnloadHandler(onLoadFunc__MODULE_ID__);


</script>
<div id=pic__MODULE_ID__></div>
]]>
</Content>
</Module>
