var xmlHttpObjects=new Array();var xmlHttp;String.prototype.trim=function()
{return this.replace(/^\s+|\s+$/g,"");}
function GetXmlHttpObject()
{var xmlHttp=null;try
{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{try
{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{xmlHttp=new XMLHttpRequest();}}
return xmlHttp;}
function callPHP(url,index,id)
{if(url==""){return;}
xmlHttp=GetXmlHttpObject();if(xmlHttp==null)
{alert("Browser does not support HTTP Request");return;}
xmlHttpObjects[index]=xmlHttp;xmlHttpObjects[index].onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{var count=0;var response=xmlHttpObjects[index].responseText;var split=response.split("|");if(split.length>1)
{count=split[1];response=split[0];var divcount=document.getElementsByTagName('div');var countname=id.replace("COMMENT","COUNT");for(var i=0;i<divcount.length;i++)
{if(divcount[i].id==countname)
{divcount[i].innerHTML="<p>Comments ("+count.trim()+")</p>";}}}
var divs=document.getElementsByTagName('div');for(var i=0;i<divs.length;i++)
{if(divs[i].id==id)
{divs[i].innerHTML=response;}}}}
xmlHttpObjects[index].open("GET",url,true);xmlHttpObjects[index].send(null);}
function expandComments(id,path,articleId)
{var url=path+"&task=default&articleId="+articleId;callPHP(url,xmlHttpObjects.length,id);}
function hideComments(id,path,articleId)
{var divs=document.getElementsByTagName('div');for(var i=0;i<divs.length;i++)
{if(divs[i].id==id)
{divs[i].innerHTML="";}}}
function addComments(id,path,articleId)
{var url=path+"&task=add&articleId="+articleId;callPHP(url,xmlHttpObjects.length,id);}
function saveComment(id,path,articleId)
{var url=path+"&task=save&articleId="+articleId;var append="";var form=document.getElementById('ADD'+id);append+="&web="+encodeURIComponent(form.web.value);append+="&email="+encodeURIComponent(form.email.value);append+="&user="+encodeURIComponent(form.user.value);append+="&comments="+encodeURIComponent(form.comments.value);append+="&captcha_code="+encodeURIComponent(form.captcha_code.value);url+=append;callPHP(url,xmlHttpObjects.length,id);}
function toHand()
{document.body.style.cursor='pointer';}
function toDefault()
{document.body.style.cursor='default';}
