// JScript File
var obj;
var emp;
function GetEmployeeInfo(empl, ErrorretrievingdatafromAuthority) {
    emp = empl;
    if (window.ActiveXObject) {
        try {
            obj = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                obj = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e1) {
                obj = null;
            }
        }
    }
    else if (window.XMLHttpRequest) {
        try {
            obj = new XMLHttpRequest("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                obj = new XMLHttpRequest("Microsoft.XMLHTTP");
            }
            catch (e1) {
                obj = null;
            }
        }
    }
    if (obj != null) {
        var url
        var item
        if (emp == '1') {
            item = document.getElementById("ctl00_BodyContentPH_ddl_Designation").value
            url = "AuthorityRemote.aspx?emp=1&ID=" + item
            if (item != "-Select-") {
                if (document.getElementById("ctl00_BodyContentPH_hidEmpDesg") != null) {
                    document.getElementById("ctl00_BodyContentPH_hidEmpDesg").value = document.getElementById("ctl00_BodyContentPH_ddl_Designation").value
                }
                if (window.ActiveXObject) {
                    obj.onreadystatechange = ProcessResponse;
                    obj.open("POST", url, true);
                    obj.send(null);
                }
                else if (window.XMLHttpRequest) {
                    obj.open("POST", url, false);
                    obj.send(null);
                    obj.onreadystatechange = ProcessResponse();
                }
            }
        }
        if (emp == '2') {
            item = document.getElementById("ctl00_BodyContentPH_ddl_ReportingTo").value
            url = "AuthorityRemote.aspx?emp=2&ID=" + item
            if (item != "-Select-") {
                obj.open("POST", url, true);
                obj.send(null);
            }
        }
        if (emp == '3') {
            item = document.getElementById("ctl00_BodyContentPH_ddl_LeaveSancAuthority").value
            url = "AuthorityRemote.aspx?emp=3&ID=" + item
            if (item != "-Select-") {
                obj.open("POST", url, true);
                obj.send(null);
            }
        }
    }
    return false;
}
function getTag_Name1() {
    if (obj.responseXML == null) {
        return false;
    }
    var dsRoot = obj.responseXML.documentElement;
    if (dsRoot != null) {
        return dsRoot.getElementsByTagName('Employee_FirstName');
    }
    else {
        return false
    }
}
function getTag_Name2() {
    if (obj.responseXML == null) {
        return false;
    }
    var dsRoot1 = obj.responseXML.documentElement;
    if (dsRoot1 != null) {
        return dsRoot1.getElementsByTagName('Employee_Id');
    }
    else {
        return false;
    }
}
function ProcessResponse() {
    if (obj.readyState == 4) {
        if (obj.status == 200) {
            var orders = getTag_Name1()
            var orders1 = getTag_Name2()
            var ddlOrders = document.getElementById("ctl00_BodyContentPH_ddl_ReportingTo");
            var ddlOrders1 = document.getElementById("ctl00_BodyContentPH_ddl_LeaveSancAuthority");
            ddlOrders.innerHTML = "";
            ddlOrders.innerText = "";
            ddlOrders1.innerHTML = "";
            ddlOrders1.innerText = "";
            var value1, value2;
            var text, text1;
            var listItem, listItem1;
            for (var count = 0 ; count < orders.length ; count++) {
                value1 = (orders1[count].textContent ||
				orders1[count].innerText || orders1[count].text);
                text = (orders[count].textContent ||
				orders[count].innerText || orders[count].text);
                listItem = new Option(text, value1, false, false);
                ddlOrders.options[ddlOrders.length] = listItem;
            }
            for (var count = 0 ; count < orders.length ; count++) {
                value2 = (orders1[count].textContent ||
				orders1[count].innerText || orders1[count].text);
                text1 = (orders[count].textContent ||
				orders[count].innerText || orders[count].text);
                listItem1 = new Option(text1, value2, false, false);
                ddlOrders1.options[ddlOrders1.length] = listItem1;
            }
        }
        else {
            alert(ErrorretrievingdatafromAuthority);
        }
    }
}
