<?xml version="1.0" encoding="UTF-8" ?>
<Module>

<ModulePrefs
title="AI @ iGoogle"
scrolling="true" height="390"/>

<Content type="html">
<![CDATA[

<div id="content_div"></div>
<script type="text/javascript">
function displayData() {
// XML AI Links list data
var url = "http://www.ainq.com/igoogle/linklist.xml";

_IG_FetchXmlContent(url, function (response) {
if (response == null || typeof(response) != "object" ||
response.firstChild == null) {
_gel("content_div").innerHTML = "<i>Invalid data.</i>";
return;
}

// Start building HTML string that will be displayed in <div>.
// Set the style for the <div>.
var html = "<div style='padding: 5px;background-color: #FFFFFF;font-family:Arial, Helvetica;" +
"text-align:left;font-size:90%'>";

// Set style for title.
html +="<div style='text-align:center; font-size: 120%; color: #004A9A; " +
"font-weight: 700;'>";

// Display menu title. Use getElementsByTagName() to retrieve the <ailinkslist> element.
// Since there is only one menu element in the file,
// you can get to it by accessing the item at index "0".
// You can then use getAttribute to get the text associated with the
// menu "title" attribute.
var title = response.getElementsByTagName("ailinkslist").item(0).getAttribute("title");

// Alternatively, you could retrieve the title by getting the menu element node
// and calling the "attributes" function on it. This returns an array
// of the element node's attributes. In this case, there is only one
// attribute (title), so you could display the value for the attribute at
// index 0. For example:
//
// var title = response.getElementsByTagName("ailinkslist").item(0).attributes.item(0).nodeValue;

// Append the title to the HTML string.
html += title + "</div><br>";

// Get a list of the <linkid> element nodes in the file
var itemList = response.getElementsByTagName("linkid");

//set inserted elements to center
html += "<center>";

// Loop through all <linkid> nodes
for (var i = 0; i < itemList.length ; i++) {
// For each <linkid> 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 linktitle, linkurl, and imageurl element nodes.
for (var j = 0; j < nodeList.length ; j++) {
var node = nodeList.item(j);
if (node.nodeName == "linktitle") {
var iglinktitle = node.firstChild.nodeValue;
}
if (node.nodeName == "linkurl") {
var iglinkurl = node.firstChild.nodeValue;
}
if (node.nodeName == "imageurl") {
var igimageurl = node.firstChild.nodeValue;
}

}

//Build the HTML string
html += "<a target=\"_blank\" href=\"";
html += iglinkurl;
html += "\"><img border=\"0\" alt=\"";
html += iglinktitle;
html += "\" src=\"";
html += igimageurl;
html += "\"></a>";

}


//End set inserted elements to center
html += "</center>";

//Close up div
html += "</div>";
_gel('content_div').innerHTML = html;
});
}
_IG_RegisterOnloadHandler(displayData);
</script>

]]>
</Content>
</Module>