<?xml version="1.0" encoding="UTF-8" ?>
<Module>
  <ModulePrefs title="Gabeira 43 no Orkut!"
     description="Aplicativo da campanha de Fernando Gabeira à prefeitura do Rio de Janeiro."
	 thumbnail="http://gabeira.com/gabeira43/wp-content/uploads/2008/08/gabeira_botao02_quadradop.jpg"
  >
    <Require feature="opensocial-0.7"/>
  </ModulePrefs>
  <Content type="html">
  <![CDATA[
     <a href="http://www.gabeira43.com.br"><img src="http://www.gabeira.com.br/gabeira43/Logo_Gabeira_43_menor.jpg" border="0"></a> 
    <div id="youtube_div"></div>

    <script type="text/javascript">

    function makeDOMRequest() {    
      var params = {};  
      params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;  
      var url = "http://br.youtube.com/ut_rss?type=username&arg=gabeira43";  
      gadgets.io.makeRequest(url, response, params);
    };

    function response(obj) { 
      // obj.data contains a Document DOM element corresponding to the
      // page that was requested
      var domdata = obj.data;
      var title = "<a href=http://br.youtube/gabeira43><img src=http://youtube.com/img/pic_youtubelogo_123x63.gif border=0 /></a>";
      var html = "<h2>" + title + "</h2>";
      
      // Get a list of the <item> element nodes in the file
      var itemList = domdata.getElementsByTagName("item");
 
      // Loop through all <item> nodes
      for (var i = 0; i < 3 ; i++) { 
        // For each <food> node, get child nodes.
        var nodeList = itemList.item(i).childNodes;

        // Loop through child nodes. Extract data from the text nodes that are
        // the children of the associated name, price, and calories element nodes.
        for (var j = 0; j < nodeList.length ; j++) {
          var node = nodeList.item(j);
          if (node.nodeName == "title") {
            var name = node.firstChild.nodeValue;
          }
          if (node.nodeName == "guid") {
            var vlink = node.firstChild.nodeValue;
          }

        }
        html += "<br /><b>" + name + "</b> - ";        
		html += "<a href=" + vlink + ">Assista</a><br />";
      }
      html += "</div>";
      document.getElementById('youtube_div').innerHTML = html;
    };
    makeDOMRequest();
    </script>
  ]]>
  </Content>
</Module>
