    
    function VoxPop(value, id) {
        var req = new JsHttpRequest();
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
            	//document.getElementById('result').innerHTML = req.responseJS.q;      
            	//document.getElementById('debug').innerHTML = req.responseText;
            	afterVoxPop(req.responseJS.q, req.responseJS.maxindex, id);
            }
        }
        req.open(null, path_web + '/modules/lenta/vox.loader.php', true);

        req.send( { q: value, 'question': id} );
    
    }
    
    function afterVoxPop( value, maxindex, id ) {
        if (value != 0 ) {            
			//document.getElementById('voxpop').innerHTML = 'Спасибо, вы проголосвали!';
			var d = document.getElementById('voxbox');
			d.innerHTML = '';
            var table = document.createElement("TABLE");
  			var tbody = document.createElement("TBODY");   
            table.appendChild(tbody);
            for(var i=0;i<value.length;i++) {
	            
	            var row = document.createElement("TR");
	            addTD(row, value[i].name, '');/*.style.width = '140px';*/
	            
	            var block = '<strong>' + value[i].procent1 + '%</strong> (' + value[i].numanswers + ')'; 
	            //addTD(row, block, '');/*.style.width = '70px';   */

	            if (i == maxindex) {
                	var cls = 'highlight';
				} else {
	            	var cls = 'progress';  
				}
				
				var width = parseInt(value[i].procent0) + 1;		            
	            var block2 = '<div class="' + cls + '" style="width:' + width + 'px"></div>';     				
				addTD(row, block+block2, 'progressbar');/*.style.width = '400px';  */  	                 

	            tbody.appendChild(row);	    
			}
			d.appendChild(table);	 	
            d.appendChild(document.createElement("HR"));
            var p = document.createElement("P"); 
            p.className = 'thanx'; 
            p.innerHTML = 'Спасибо за ответ!';
            d.appendChild(p);	
			d.innerHTML += '<div class="clear"></div>';
			
			
        }	
    }
    
    function QuickVoxPop(value, id) {
        var req = new JsHttpRequest();
        req.onreadystatechange = function() {
            if (req.readyState == 4) {
            	//document.getElementById('result').innerHTML = req.responseJS.q;      
            	//document.getElementById('debug').innerHTML = req.responseText;
            	afterQuickVoxPop(req.responseJS.q, req.responseJS.maxindex, id);
            }
        }
        req.open(null, path_web + '/modules/lenta/vox.loader.php', true);
        req.send( { q: value, 'question': id} );   
    }
    
    function afterQuickVoxPop( value, maxindex, id ) {

        if (value != 0 ) {            

			var d = document.getElementById('quickvoxbox');
			d.innerHTML = '';
            var table = document.createElement("TABLE");
			var tbody = document.createElement("TBODY");
            table.appendChild(tbody);	 
            for(var i=0;i<value.length;i++) {
            
	            var row = document.createElement("TR");
	            addTD(row, value[i].name, '')/*.style.width = '140px';*/
	            
	            var block = '<strong>' + value[i].procent1 + '%</strong> (' + value[i].numanswers + ')'; 
	            //addTD(row, block, '')/*.style.width = '70px';   */

	            if (i == maxindex) {
                	var cls = 'highlight';
				} else {
	            	var cls = 'progress';  
				}
				 var row2 = document.createElement("TR");
				var width = parseInt(value[i].procent0) + 1;	            
	            var block2 = '<div class="' + cls + '" style="width:' + width + 'px">&nbsp;</div>';     				
				addTD(row2, block+block2, 'progressbar');/*.style.width = '100px';    */	                 
				tbody.appendChild(row);	
	            tbody.appendChild(row2);	
			}
			d.appendChild(table);	
            d.appendChild(document.createElement("HR"));
            var p = document.createElement("P"); 
            p.className = 'thanx'; 
            p.innerHTML = 'Спасибо за ответ!';
            d.appendChild(p);	
			d.innerHTML += '<div class="clear"></div>';
			
			
        }	
    }
    
    function addTD( row, value, classname ) {
        var td = document.createElement("TD");
        if (classname != '') {
            td.className = classname;
        }
        row.appendChild(td);
        td.innerHTML = value;   
        return td;
    }
