// JavaScript Document
function get_http(){   
    var xmlhttp;   
    /*@cc_on  
    @if (@_jscript_version >= 5)  
        try {  
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");  
        } catch (e) {  
            try {  
                xmlhttp = new   
                ActiveXObject("Microsoft.XMLHTTP");  
            } catch (E) {  
                xmlhttp = false;  
            }  
        }  
    @else  
        xmlhttp = false;  
    @end @*/   
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {   
        try {   
            xmlhttp = new XMLHttpRequest();   
        } catch (e) {   
            xmlhttp = false;   
        }   
    }   
    return xmlhttp;   
}   

function answer(url) {   
		if(!this.http){   
            this.http = get_http();   
            this.working = false;   
        }   
		if (!this.working && this.http) {   
            var http = this.http;   
			this.http.open("POST", url, true);   
			this.http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
			this.http.onreadystatechange = function() {   
                if (http.readyState == 4) {   
					document.getElementById('questions').className = 'hidden';							
					document.getElementById('working').className = 'hidden'; 
				if (http.responseText=="1") document.getElementById('succes').className = 'shown';else document.getElementById('succes').className = 'hidden';
				if (http.responseText=="-1") document.getElementById('error_2').className = 'shown';else document.getElementById('error_2').className = 'hidden';
				if (http.responseText=="0") document.getElementById('error').className = 'shown';else document.getElementById('error').className = 'hidden';
					this.working = false;   
                  }else{   
                     // данные в процессе получения   
					document.getElementById('questions').className = 'hidden';
		            document.getElementById('working').className = 'shown'; 
					}   
            }   
            this.working = false;   
          var sendstring = "golos=1&otv="+document.frm_vote.answer_id.value;
			this.http.send(sendstring);   
        }   
        if(!this.http){   
              alert('Ошибка при создании XMLHTTP объекта!')   
        }   
    }   
