			var commentAjax = new Ajax();
/* build the comment uri and make the ajax request */
function initComment() {
// set the comment id dynamically
/* */
var commentURI = "/en_US/xml/lastComments.xml";
//var commentURI = "/eipatron/discussionThread.do?c=usgaff&n=5&order=DESC";
commentAjax.makeRequest('GET', commentURI, commentList, true);
}
function commentList()
{
var commentHTML = "";
if(commentAjax.checkReadyState() == "success") {
var xmlDoc = commentAjax.request.responseXML;
// get status
var statusNodes = xmlDoc.getElementsByTagName("status");
var status = statusNodes[0].childNodes[0].nodeValue;
// if status = success
if (status == "Success")
{					
// set the count
var countNode = xmlDoc.getElementsByTagName("count");
var count = 0;
if (countNode.length > 0)
{
count = countNode[0].childNodes[0].nodeValue;
}
if (count == 0)
{
// Set the comment count
// commentCount(count);
commentHTML += "<tr><td colspan='2'><h2>No commments available.</h2></td></tr>";
}
// get comment node
var commentNodes = xmlDoc.getElementsByTagName("comment");
// loop through and set the comments div comments
for (i=0;i<commentNodes.length;i++) {
commentData = commentNodes.item(i).childNodes;
commentCell = '';
date = '';
name = '';
body = '';
for (var j=0; j<commentData.length; j++){
switch(commentData.item(j).nodeName){
case "name": name = commentData.item(j).hasChildNodes() ? commentData.item(j).firstChild.nodeValue : ""; break;
case "date": date = commentData.item(j).hasChildNodes() ? commentData.item(j).firstChild.nodeValue : ""; break;
case "body": body = commentData.item(j).hasChildNodes() ? commentData.item(j).firstChild.nodeValue : ""; break;
default:break;
}
}
commentHTML += "<tr valign='top'><td>";
if (date != "")
{
// create a date object
var d = new Date();
// parse the xml date
d.setTime((eval(date) - (1000 * 60 * 60 * 7)));
// format the time
var hour = d.getUTCHours();
var hour_pad = "";
if (hour < 10)
{
hour_pad = "0";
}
var min = d.getUTCMinutes();
var min_pad = "";
if (min < 10)
{
min_pad = "0";
}
commentHTML += hour_pad + hour + ":" + min_pad + min;
}
commentHTML += "</td><td>";
if (body != "")
{
if (body.length > 80)
{
commentHTML += body.substring(0,80) + "...";
}
else 
{
commentHTML += body;
}
}
if (name != "")
{
commentHTML += " " + name;
}
commentHTML += "</td></tr>";
}
// alert(commentHTML);
commentsDiv = document.getElementById('hpcomments');
commentsDiv.innerHTML = "<table cellspacing='6px'>"+commentHTML+"</table>";
}
}
}
// addLoadEvent(initComment)
