var d=document;
function elementInner(id,text)
{
	if(d.getElementById(id))
		d.getElementById(id).innerHTML=text;
}		
function doLoad(div,act,value) {		

    var req = new JsHttpRequest();            
    req.onreadystatechange = function()     {       	    	
        if (req.readyState == 4) {                   		   		
        		switch (act)
        		{
        			
        			case "add_vote":        				
        				elementInner(div,req.responseText);								        					       			  		         			  		     									
        				elementInner(req.responseJS['div2'],'Îöåíêà: '+req.responseJS['ball']);
        					   			  		     									
       			break;	
       			case 'edit_comment':
       				  elementInner(div,req.responseText);								        					       			  		         			  		     									
       			     document.getElementById(req.responseJS['div2']).focus();              		            		       			     
       			break;     
       		
        			default:
	        			elementInner(div,req.responseText);								        					       			  		         			  		     									
        		}
        		
        }        
        
    }
    
    // Prepare request object (automatically choose GET or POST).    
    req.caching = true;	
    req.open(null, '/ajax.php', true);    
    rnd = Math.random(1);
    req.send({div:div,act:act,value:value,rnd:rnd});     	
}
function url_window(url,w,h)
{
	w=parseInt(w)+40;
	h=parseInt(h)+40;
	window.open(url,'Text','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width='+w+',height='+h+',left=32,top=16'); 
}