<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Horror Quote of the Day" width="300" height="200" author="Scott Hopkins" author_email="scotthopkins234@gmail.com" 
 scrolling="true" description="Daily quotes from the world of horror brought to you by TheCabinet.com"
 thumbnail="http://www.thecabinet.com/images/google-cabinet.jpg"
 screenshot="http://www.thecabinet.com/images/google-quotegadget.png"
 author_affiliation="TheCabinet.com"/>
<UserPref name="quote" display_name="Quote Category" default_value="All" datatype="enum" >
  <EnumValue value="All" />
  <EnumValue value="General" />
  <EnumValue value="Literature" />
  <EnumValue value="Movie" />
  <EnumValue value="Music" />
  <EnumValue value="Radio" />
  <EnumValue value="Television" />
  <EnumValue value="Theater" />
 </UserPref>      
<Content type="html">
  <![CDATA[ 
    <style> 
      #quote {font-family:arial,sans-script; font-size:8pt; margin: 5px; background-color: #FFFFFF; scroll:auto;} 
      #content {font-family:arial,sans-script; font-size:8pt; background-color: #FFFFFF; scroll:auto;} 
      #title {font-family:arial,sans-script; font-size:8pt; font-weight:bold}
      #subtitle {font-family:arial,sans-script; font-size:8pt;}
      #image {float:left;}
      #rating {font-family:arial,sans-script; font-size:7pt;}
      .links td {font-family:arial,sans-script; font-size:8pt;}
      .ad td {font-family:arial,sans-script; font-size:8pt; text-align:center;}
    </style>
 
    <table width="100%">
      <tr>
        <td align="center" id="title"><span id="category"></span> - <a target="_blank" href="http://www.thecabinet.com">TheCabinet.com</a></td>
      </tr>
    </table>
    <table width="100%">
      <tr>
        <td id="quote"></td>
      </tr>
    </table>
    <table width="100%" border="0">
      <tr>
        <td width="55" height="75" id="image" valign="middle"/>
        <td width="5">&nbsp;</td>
        <td>
           <table width="100%">
             <tr>
               <td colspan="3" id="content" />
             </tr>
             <tr class="links">
               <td id="submit"/>
               <td>&nbsp;</td>
               <td id="seeAll" />
             </tr>
             <tr class="ad">
              <td colspan="3"><a target="_blank" href="http://www.thecabinet.com/darkdestinations/index.php?sub_id=dark_destinations">Take the Path Less Beaten</a></td>
             </tr>
           </table>
        </td>
      </tr>
    </table>
    <script type="text/javascript">
    var prefs = new _IG_Prefs();
    var image = _IG_GetImage("http://www.thecabinet.com/images/cabinetfb.jpg");
    _gel("image").appendChild(image);

    function parseResponse(response) 
    {
      _gel("category").innerHTML = response.getElementsByTagName("QuoteOfTheDay").item(0).getAttribute("Name");
      var node = response.getElementsByTagName("Quote").item(0);
      _gel("quote").innerHTML = node.firstChild.nodeValue;
      var html = "<div>"
      html += '<a target="_blank" href="' + node.getAttribute("Url") + '">';
      html += node.getAttribute("Source");
      html += "</a>";
      html += "</div>";
      html += '<div id=\"rating\">Average Rating: ' + node.getAttribute("AveRating");
      html += " (" + node.getAttribute("NumberRatings") + " ratings)</div>";
      _gel("content").innerHTML = html;
    }
    var pref = prefs.getString("quote");
    var category = "";
    if (pref == "Movie")
      category = "movie_quotes";
    else if (pref == "General")
      category = "general_quotes";
    else if (pref == "Literature")
      category = "literature_quotes";
    else if (pref == "Music")
      category = "music_quotes";
    else if (pref == "Radio")
      category = "radio_quotes";
    else if (pref == "Television")
      category = "television_quotes";
    else if (pref == "Theater")
      category = "theater_quotes";
    else
      category = "quote_of_the_day";
    if (category == "quote_of_the_day")
    {
      _gel("submit").innerHTML = '<a target="_blank" href="http://www.thecabinet.com/quotes/addquote.php?sub_id=general_quotes">Submit a Quote</a>';
      _gel("seeAll").innerHTML = '<a target="_blank" href="http://www.thecabinet.com/quotes/index.php?sub_id=general_quotes">See All Quotes</a>';
    }
    else
    {
      _gel("submit").innerHTML = '<a target="_blank" href="http://www.thecabinet.com/quotes/addquote.php?sub_id=' + category + '">Submit a Quote</a>';
      _gel("seeAll").innerHTML = '<a target="_blank" href="http://www.thecabinet.com/quotes/index.php?sub_id=' + category + '">See All Quotes</a>';
    }
    _IG_FetchXmlContent('http://www.thecabinet.com/quotes/quoteoftheday.php?sub_id=' + category, parseResponse);
  </script>

  ]]> 
  </Content>
</Module>
