    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 (strstr(xmlHttp.responseText, "not")){                
                    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;
    }
}


function strstr( haystack, needle, bool ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // *     example 1: strstr('Kevin van Zonneveld', 'van');
    // *     returns 1: 'van Zonneveld'
    // *     example 2: strstr('Kevin van Zonneveld', 'van', true);
    // *     returns 2: 'Kevin '

    var pos = 0;

    haystack += '';
    pos = haystack.indexOf( needle );
    if( pos == -1 ){
        return 0;
    } else{
        return 1;
    }
}
