    function sendcommand(cmd, url)
    {
        var xmlHttp;
        try
        {
            // Firefox, Opera 8.0+, Safari
            xmlHttp=new XMLHttpRequest();
        }
        catch (e)
        {
            // Internet Explorer
            try
            {
                xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
            catch (e)
            {
                try
                {
                    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                catch (e)
                {
                    alert("Your browser does not support AJAX!");
                    return false;
                }
            }
        }
                                               
        xmlHttp.onreadystatechange=function()
        {                                     
            if(xmlHttp.readyState==4)
            {                                                
                if (xmlHttp.responseText == 'not valid'){  
                    document.getElementById('captcha').value = '';                                  
                    document.getElementById('captcha').className = 'required validate-captcha validation-failed';
                    document.getElementById('advice-required-captcha').style.visibility = 'visible';
                    document.getElementById('advice-required-captcha').style.display = 'block';                             
                }
                if (xmlHttp.responseText == 'valid'){                                                
                    document.getElementById('captcha').className = 'required validate-captcha';
                    document.getElementById('advice-required-captcha').style.visibility = 'hidden';
                    document.getElementById('advice-required-captcha').style.display = 'none';    
                }
                
                // Aici primesti raspunsul
                //document.getElementById("responsearea").value    = "";
                //alert("Response: \n"+xmlHttp.responseText);
                //document.getElementById("responsearea").innerHTML    = xmlHttp.responseText;
            }
        }
        
        sendvars    = "cmd="+cmd;   
        // Aici trimiti comanda
        xmlHttp.open("POST",url,true);
        xmlHttp.setRequestHeader("Method", "POST "+url+" HTTP/1.1");
        xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xmlHttp.send(sendvars);         
    }
    
    function pause(millisecondi)
{
    var now = new Date();
    var exitTime = now.getTime() + millisecondi;

    while(true)
    {
        now = new Date();
        if(now.getTime() > exitTime) return;
    }
}
