var httpReq=false;
var element;


function createRequest() 
{

        if (window.XMLHttpRequest) 
        { // Mozilla, Safari, Opera, Konqueror...
            httpReq = new XMLHttpRequest();
        } 
        else if (window.ActiveXObject) 
        { // Internet Explorer
            try 
            {
              httpReq = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) 
            {
                try 
                {
                  httpReq = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch (e) {}
            }
        }

        if (!httpReq) 
        {
            alert('Giving up :( Nemohu vytvořit XMLHTTP instanci');
            return false;
        }
        return true;

    }
    
 /*
        httpReq.onreadystatechange = contentStatus;
        httpReq.open('POST', './ftpCore.php');
        httpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        params='action='+action+'&fileName='+fileName;
        httpReq.send(params);
  */

function sendReq(method,path,onStateChange,send)
{
	httpReq.open(method, path);
	if(method=='POST')
		httpReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	httpReq.onreadystatechange = function()
		{
			if (httpReq.readyState == 4) 
    		{
	    		if (httpReq.status == 200) 
        		{
					onStateChange();
				}
				else
					alert("Gone bad");
			}
		}
	httpReq.send(send);
}



