var xmlDoc;
  var detail;
  var articleID;
  var title;
  var commenter;
  
    if (window.ActiveXObject)
    {
        xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async=false;
        xmlDoc.load("/profiles/CommentXML/LatestComment.xml");
    }
    // code for Mozilla, Firefox, Opera, etc.
    else if (document.implementation && document.implementation.createDocument)
    {
        xmlDoc=document.implementation.createDocument("","",null);
         xmlDoc.async=false;
        xmlDoc.load("/Profiles/CommentXML/LatestComment.xml");
    }
    else
    {
    alert('Your browser cannot handle this script');
    }
    
    xmlObj=xmlDoc.documentElement;
    var detail =    xmlObj.getElementsByTagName("commentDetail")[0].firstChild.nodeValue;
    var title =     xmlObj.getElementsByTagName("title")[0].firstChild.nodeValue;
    var commenter = xmlObj.getElementsByTagName("CommenterName")[0].firstChild.nodeValue;
    var articleID = xmlObj.getElementsByTagName("articleID")[0].firstChild.nodeValue;
   
    if (detail.length > 250)
    {
        detail = detail.substring(0, 250);
        if (detail.lastIndexOf(" ") != -1)
        {
          detail = detail.substring(0,  detail.lastIndexOf(" ")) + "..."; 
        } 
        else
        {
           detail = detail +  "...";
        }
    }

    if (detail.lastIndexOf("http") !=-1 ) 
    { 
    tempstr = detail.substring(detail.lastIndexOf("http")); 
    tempstr = tempstr.substring(0, tempstr.indexOf(" ")); 
     
    if (tempstr.length >0) 
    { 
    var temp1 = detail.substring(0, detail.lastIndexOf("http")); 
    var temp2 = detail.substring(detail.lastIndexOf("http")+ tempstr.length); 
     
    tempstr = tempstr.substring(0, 15) + "..."; 
    detail = temp1 + tempstr + " " + temp2; 
     
    }  
    }


document.write('<div class="clear"></div>');
document.write('<div class="module-right">');
//document.write('<div class="module-right" style=" width:280px; float:left; ">');
document.write('<div class="label-module">LATEST COMMENT</div>');
document.write('<div class="latest-comment-txt" id="detail"></div>');
document.write('<div class="latest-comment-by" id="latestcomment"></div>');
document.write('<div class="latest-comment-article" id="commenttitle"></div>');

document.getElementById("detail").innerHTML = "<a href=\'/Content/"+ articleID +".asp#comment\'><em>" +  detail + "</em></a>"; 
document.getElementById("latestcomment").innerHTML = commenter + " on:";
document.getElementById("commenttitle").innerHTML = "<a href=\'/Content/" + articleID + ".asp\'>" + title + "</a>";
 
document.write('</div>');
