// read a file from the server
function process2(idkom)
{

  // only continue if xmlHttp isn't void
  if (xmlHttp)
  {
    // try to connect to the server
    try
    {
		id = idkom;
      // get the two values entered by the user
      //var error_text = selected; 
		//idkom=document.getElementById('com_zal_el').value;		
	//  alert(divstroka);
	  /*divstroka.innerHTML = "" + responseText;*/
      // create the params string
      var params = "error_text=" + idkom;
      // initiate the asynchronous HTTP request
     // alert('nach1');
	  xmlHttp.open("GET", "report.php?" + params, true);
      xmlHttp.onreadystatechange = handleRequestStateChange3;
      xmlHttp.send(null);
	  
    }
    // display the error in case of failure
    catch (e)
    {
      //alert("Can't connect to server:\n" + e.toString());
    }
  }
}

// function called when the state of the HTTP request changes
function handleRequestStateChange3() 
{
var divstroka="com_zalElement" + id;
var com_zal = document.getElementById(divstroka);
  //alert(divstroka);
  /*alert(xmlHttp.readyState);
//  alert(xmlHttp.status);
  //alert(xmlHttp.statusText);
  alert('kon');
*/
  if (xmlHttp.readyState != 4)
  {
    com_zal.innerHTML = "<img src='images/loader.gif' width='15' height='15' alt='' />";
  }else
  
 if (xmlHttp.readyState == 4)
  {
   // when readyState is 4, we are ready to read the server response
   // continue only if HTTP status is "OK"
    if (xmlHttp.status == 200) 
    {
      try
      {
        // do something with the response from the server
        handleServerResponse3();
      }
      catch(e)
      {
        // display error message
        alert("Error reading the response: " + e.toString());
      }
    } 
    else
    {
      // display status message
      alert("There was a problem retrieving the data:\n" + xmlHttp.statusText);
    }
  }
}

// handles the response received from the server
function handleServerResponse3()
{
 divstroka="com_zalElement" + id;
 com_zal = document.getElementById(divstroka);
 // retrieve the server's response packaged as an XML DOM object
  var xmlResponse = xmlHttp.responseXML;
  // catching potential errors with IE and Opera
  if (!xmlResponse || !xmlResponse.documentElement)
    throw("Invalid XML structure:\n" + xmlHttp.responseText);
 
  // catching potential errors with Firefox
  var rootNodeName = xmlResponse.documentElement.nodeName;
  if (rootNodeName == "parsererror") 
    throw("Invalid XML structure:\n" + xmlHttp.responseText);
  // getting the root element (the document element)
  xmlRoot = xmlResponse.documentElement;
  // testing that we received the XML document we expect
  if (rootNodeName != "response" || !xmlRoot.firstChild)
    throw("Invalid XML structure:\n" + xmlHttp.responseText);
  // the value we need to display is the child of the root <response> element
  responseText = xmlRoot.firstChild.data;
	// display the user message
 var divstroka="com_zalElement" + id;
var com_zal = document.getElementById(divstroka);
	//alert(com_zal);
 com_zal.innerHTML = "" + responseText;
}