var xmlHttpTemp;
function createXmlHttpObjects(){
if (window.XMLHttpRequest){     // Object of the current windows
    xmlHttpTemp=new XMLHttpRequest();
   } 
   else if (window.ActiveXObject){   // ActiveX version
    xmlHttpTemp=   new ActiveXObject("Microsoft.XMLHTTP");//cj month//viewer choice//dedate (skype)
    } 
 }

createXmlHttpObjects();
//view and comments
function displayViewsComments(myarticleid,num){
//alert
//myarticleid='15765058';
xmlHttpTemp.open("POST", "/mncArticleList.do?choice=articleViewsComments&articleID="+myarticleid+"&updateView=noupdate",  false);
//xmlHttpRecent.onreadystatechange =processStateChangecRecent;
//xmlHttpRecent.setRequestHeader("Connection", "close");
//alert("/mncArticleList.do?choice=articleViewsComments&articleID="+myarticleid+"&updateView=noupdate");
xmlHttpTemp.send(null); 

processStateChangeViews(num);

}
function processStateChangeViews(num){
//alert("processStateChangeViews"+num);
  var res=xmlHttpTemp.responseXML;
//alert("processStateChangeViews:"+res+":");  
  if (res!=null && res.getElementsByTagName("hits")[0]!=null){
    var objView=res.getElementsByTagName("hits");
    var objComment=res.getElementsByTagName("comments");
    //alert("sss:"+document.getElementById("totalrelevantnewnameidv"+num).innerHTML);
    //alert(document.getElementById("totalrelevantnewnameidv"+num));
    if (document.getElementById("totalrelevantnewnameidv"+num)!=null){
    document.getElementById("totalrelevantnewnameidv"+num).innerHTML=objView[0].childNodes[0].nodeValue;
    document.getElementById("totalrelevantnewnameidc"+num).innerHTML=objComment[0].childNodes[0].nodeValue;
    }
   }
}


function updateviewsOnpagerelevant(){

    var totalids=document.getElementById("totalrelevantnew").value;
    //alert(totalids);
    if (totalids!=-1){
    totalids=totalids-1;
    //alert(totalids);
      for(var tt=0;tt<=totalids;tt++){
      //alert(document.getElementById("totalrelevantnewname"+tt).value);
      displayViewsComments(document.getElementById("totalrelevantnewname"+tt).value,tt);
      }
    }
}

