﻿function DoCallback(url, param, controlId, callbackControlId) {
    // url:    URL to invoke
    // params: string object to pass to the remote URL

    // Add some parameters to the query string
    var pageUrl = virtualDirectoryPath + url + "?CallBack=true" + param + "&ControlId=" + controlId + "&CallBackControlId=" + callbackControlId;

    var xmlRequest;
    // Initialize the XmlHttp object
    //var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
    try {
        xmlRequest = new XMLHttpRequest();
    }
    catch (e) {
        try {
            xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) {
        }
    }

    // Prepare for a POST statement and synchronous. (All this is 
    // arbitrary and can be changed in your own implementation.)
    xmlRequest.open("POST", pageUrl, false);
    xmlRequest.setRequestHeader("Content-Type",
           "application/x-www-form-urlencoded");
    xmlRequest.send(null);

    // Return the XmlHttp object
    return xmlRequest;
}
