var xmlHttp

var idx
var oldidx

function GetXmlHttpObject()
{
  xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

function showComment(pidx,idxParent)
{
//alert('showComment'+idxParent)
oldidx = idx;
idx = pidx;
if (idx.length==0)
  { 
  document.getElementById("komentarz").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
  {
  alert ("Twoja przeglądarka nie obsługuje AJAXa!");
  return;
  } 
var url="showComment.do";
url=url+"?idx="+idx+'&idxParent='+idxParent;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
//alert("odpowiedz="+xmlHttp.responseText);	
document.getElementById("komentarz").innerHTML=xmlHttp.responseText;

if(oldidx!=null)
	document.getElementById(oldidx).style.color='#000000';
if(idx!=null)
	document.getElementById(idx).style.color='#ff0000';
//border: solid;" 

//document.getElementById("answerForm").idxParent.value=idx;
//document.getElementById("odpowiedz").innerHTML=
//		"<input type=\"submit\" name=\"answer\" value=\"Odpowiedz\"/>"
//
//document.getElementById("answerForm").answer.visibility='visible';
}
}

