function addquestion() {

	comment = encodeURIComponent(document.getElementById("comment-form").value);
    author = encodeURIComponent(document.getElementById("author-form").value);
	
	email = encodeURIComponent(document.getElementById("email-form").value);
	city = encodeURIComponent(document.getElementById("city-form").value);
	code = encodeURIComponent(document.getElementById("codefromimg").value);
	
	
	document.getElementById("butLoad").innerHTML = '<i>Подождите...</i>';
    
	document.getElementById("add-comment").style.opacity = "0.7";
	document.getElementById("add-comment").style.filter = "alpha(opacity=70)";
	
    // execute the quickstart.php page from the server
    
      var url = "/xml/question.php";
var params = "id=" + dataId + "&comment=" + comment + "&author=" + author + "&email=" + email + "&code=" + code  + "&city=" + city;
xmlHttp.open("POST", url, true);

//Send the proper header information along with the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");


    // define the method to handle server responses
    xmlHttp.onreadystatechange = handleServerResponseAddQuestion;
    // make the server request
    xmlHttp.send(params);
}
function handleServerResponseAddQuestion() 
{
  // move forward only if the transaction has completed
  if (xmlHttp.readyState == 4) 
  {
    // status of 200 indicates the transaction completed successfully
    if (xmlHttp.status == 200) 
    {
      // extract the XML retrieved from the server
      xmlResponse = xmlHttp.responseXML;
      // obtain the document element (the root element) of the XML structure
      xmlDocumentElement = xmlResponse.documentElement;
      // get the text message, which is in the first child of
      // the the document element
      statuss = xmlDocumentElement.firstChild.data;
      
      document.getElementById("add-comment").style.opacity = "1";	
 if(statuss == 0) { 

	 document.getElementById("comment-form").value = '';
	
	 
	 
	 document.getElementById("butLoad").innerHTML = '<div class="success">Ваш вопрос добавлен</span>';
	  
	 }
	 else {
	
      document.getElementById("butLoad").innerHTML = '<ul>' + statuss + '</ul>';
	  
	 }
	 
	  
      
      // restart sequence
    } 
    // a HTTP status different than 200 signals an error
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}

