<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs 
  title="Kittens!" 
  scrolling="false" 
  height="305" 
  width="320" 
  author="Gordy F" 
  author_email="gordyf@gmail.com" 
  description="Everybody loves kittens." 
  thumbnail="http://www.google.com/ig/gadgets/file/113224972997380417953/kittens_120.png" 
  screenshot="http://www.google.com/ig/gadgets/file/113224972997380417953/kittens_280.jpg" 
  author_photo="http://www.google.com/ig/gadgets/file/113224972997380417953/gordy_thumbnail.png">
    <Require feature="analytics"/>
</ModulePrefs> 
<Content type="html"><![CDATA[

  <style type="text/css">
    div#content { width:100%; height:100%; text-align:center; vertical-align:center; }
    div#imageContainer { height:235px; width:340px; margin:0 auto; }
    div#imageContainer img { float:left; border:1px solid white; height:75px; width:75px; }
    div#imageContainer img:hover { border:1px solid #aaa; }
  </style>
  
  <div id="content">
    <div id="imageContainer"></div>
    <script type="text/javascript"><!--
        google_ad_client = "pub-5401964526826291";
        /* kittens, 234x60, created 1/23/09 */
        google_ad_slot = "5689142852";
        google_ad_width = 234;
        google_ad_height = 60;
        //-->
    </script>
    <script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
  </div>
  
  <script type="text/javascript">
    _IG_Analytics("UA-886172-3", "/kittens");
  </script>
  
  <script type="text/javascript">
    function parseFeed(resp) {
      var imageContainer = _gel('imageContainer');
      if (resp) {
        var itemList = resp.getElementsByTagName('item');
        if (itemList.length == 0) {
          imageContainer.innerHTML = 'No kitten images found. Please try again later.';
        } else {
          for (var i = 0; i < 12 ; i++) { 
            if (itemList.item(i)) {
              var nodeList = itemList.item(i).childNodes;
              for (var j = 0; j < nodeList.length ; j++) {
                var node = nodeList.item(j);
              
                if (node.nodeName == 'media:thumbnail') {
                  var thumbnail = node.getAttribute('url');
                } else if (node.nodeName == 'link') {
                  var link = node.firstChild.nodeValue;
                }
              }  
              if (thumbnail && link) {
                var tImg = _IG_GetImage(thumbnail);
          
                var tLink = document.createElement('a');
                tLink.href = link;
                tLink.target = '_blank';
                tLink.appendChild(tImg);
              
                imageContainer.appendChild(tLink);
              }
            }
          }
        }    
      } else {
        imageContainer.innerHTML = 'Unable to contact Flickr.  Please try again later.';
      }
    }
    
    function fetchFlickrFeed() {
      _IG_FetchXmlContent('http://api.flickr.com/services/feeds/photos_public.gne?tags=kitten&format=rss2', parseFeed, { refreshInterval: (60 * 10) });   
    }
    
    fetchFlickrFeed();
  </script>
]]>
</Content>
</Module>

