var xmlHttp=null;

function getsubdirs(e) {
    getdirlist(document.form_ftp.ftp_in_ftp_home.value);
}

function getsubdirs_in(dir) {
    getdirlist(dir);
}

function getdirlist(dir) {
    var url="/modules/dirlist.php";
    url=url+"?dir="+dir;

    xmlHttp=GetXmlHttpObject();
    if (xmlHttp==null) {
        alert("AJAX not supported.");
        return;
    }

    xmlHttp.onreadystatechange=stateChanged;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function stateChanged() {
    if (xmlHttp.readyState==4) {
        document.getElementById("lista").innerHTML=xmlHttp.responseText;
    }
}

function GetXmlHttpObject() {
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}

