 /*
  *  How to receive results in XML.
  */
google.load("feeds", "1");

// Our callback function, for when a feed is loaded.
function feedLoaded(result) 
{
	if (!result.error) 
	{
		// Get and clear our content div.
		var itemList = new Array();
		// Get all items returned.
		var items = result.xmlDocument.getElementsByTagName('item');
	
		// Loop through our items
		for (var i = 0; i < items.length; i++) 
		{
		  var item = items[i];
		  var itemData = new Array();
	
		  // Get the title from the element.  firstChild is the text node containing
		  // the title, and nodeValue returns the value of it.
		  
		  itemData[0] = item.getElementsByTagName('title')[0].firstChild.nodeValue;
		  if(item.getElementsByTagName('link')[0].firstChild != null)
		  {
			itemData[1] = item.getElementsByTagName('link')[0].firstChild.nodeValue;
		  }
		  else
		  {
			itemData[1] = "";
		  }
		  
		  itemData[2] = item.getElementsByTagName('pubDate')[0].firstChild.nodeValue;
		  
		  itemList[i] = itemData;
		}
		
		//LLAMADA AL SWF TICKER
		document["flash"].initTicker(itemList);
	}
}

function OnLoad() 
{
  // Create a feed instance that will grab Digg's feed.
  var feed = new google.feeds.Feed("http://rss.rctv.net/avances");

  // Request the results in XML
  feed.setResultFormat(google.feeds.Feed.XML_FORMAT);
  feed.setNumEntries(100);

  // Calling load sends the request off.  It requires a callback function.
  feed.load(feedLoaded);
}

google.setOnLoadCallback(OnLoad);