<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="MMA Fighter of the Day" scrolling="true" author="Dave Hoover" author_email="dave@obtiva.com" description="UFC and other MMA fans! Do you want to learn more about the mixed martial arts fighters out there? This gadget delivers a new MMA fighter every day!" thumbnail="http://www.mmapredictions.com/images/gadgetthumbnail.jpg" screenshot="http://www.mmapredictions.com/images/mmap-gadget-screenshot.jpg">
<Require feature="analytics" /> 
</ModulePrefs>

<Content type="html">
<![CDATA[


<script>  _IG_Analytics("UA-357948-12", "/mygadget");</script>

<div id="content_div"></div>

<script type="text/javascript">
function displayFighter() {

var url = "http://www.mmapredictions.com/fighters/gadget.xml";

_IG_FetchXmlContent(url, function (response) {
if (response == null || typeof(response) != "object" || response.firstChild == null) {
_gel("content_div").innerHTML = "<i>Invalid data.</i>";
return;
}

var html = "<div>";

var title = response.getElementsByTagName("fighter").item(0).getAttribute("name");
var image = response.getElementsByTagName("image").item(0).firstChild.nodeValue;
var fighter_url = response.getElementsByTagName("url").item(0).firstChild.nodeValue;
var flag = response.getElementsByTagName("country-flag").item(0).firstChild.nodeValue;
var country = response.getElementsByTagName("country").item(0).firstChild.nodeValue;
var record = response.getElementsByTagName("record").item(0).firstChild.nodeValue;
var height = response.getElementsByTagName("height").item(0).firstChild.nodeValue;
var weight = response.getElementsByTagName("weight").item(0).firstChild.nodeValue;
var bio = response.getElementsByTagName("bio").item(0).firstChild.nodeValue;
var next_fight = response.getElementsByTagName("next-fight-name").item(0).firstChild.nodeValue;

html += '<div style="float:right"><img src="' + image + '" />' + "</div>";
html +="<div style='font-weight: 700;'>";
html += '<a style="color: red;" target="_blank" href="' + fighter_url + '">' + title + "</a></div>";
html += '<div style="font-size: 70%">';
html += '<div>Country: <img src="' + flag + '" /> ' + country + "</div>";
html += '<div>Record: ' + record + "</div>";
html += '<div>Height: ' + height + "</div>";
html += '<div>Weight: ' + weight + "</div>";
html += '<div>Bio: ' + bio + "</div>";
html += '<div><a href="http://mmapredictions.com" target="_blank"><img border="0" src="http://www.mmapredictions.com/images/MMAPlogo-90x42.jpg" /></a></div>';
html += '<div>Next fights on MMAPredictions.com: <a target="_blank" href="http://www.mmapredictions.com/events/next">' + next_fight + '</a>.</div>';
html += '</div>';
html += "</div>";

// Display HTML string in <div>
_gel('content_div').innerHTML = html;
});
}

_IG_RegisterOnloadHandler(displayFighter);
</script>

]]>
</Content>
</Module>

