var READY_STATE_COMPLETE = 4;

function initXmlHttp()
{
	var xmlHttp;
	try {
	  	// Firefox, Opera 8.0+, Safari
  		xmlHttp = new XMLHttpRequest();
  	}
	catch (e) {
  		// Internet Explorer
  		try {
	    	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    	}
  		catch (e) {
    		try {
      			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	      	}
			// no-support for AJAX
	    	catch (e) {
      			return null;
			}
      	}
 	}
	return xmlHttp;
}

var xmlHttp = initXmlHttp();

function setExpandNode(topicId)
{
	if (xmlHttp != null) {
	    xmlHttp.open('get', 'expand.php?topic_id=' + topicId);
	    xmlHttp.onreadystatechange = onNodeExpanded;
    	xmlHttp.send(null);
	}
}

function onNodeExpanded()
{
    if(xmlHttp.readyState == READY_STATE_COMPLETE) {

		text = xmlHttp.responseText;

		objActive = document.getElementById('active_' + documentId);
		objActive.style.backgroundPosition = 'left bottom';
		objActive.href = 'javascript:setDocumentActive(' + documentId + ')';
	}
}
