﻿function GetXMLHTTPRequest() {
    xmlhttp = false;
    try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (E) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
        try {
            xmlhttp = new XMLHttpRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    if (!xmlhttp && window.createRequest) {
        try {
            xmlhttp = window.createRequest();
        } catch (e) {
            xmlhttp = false;
        }
    }
    return xmlhttp;
}

function LoadPopupAJAX(URL, callback) {
    XHR_LPL = GetXMLHTTPRequest();
    document.getElementById('DreamPopup').style.display = 'block';
    XHR_LPL.onreadystatechange = function() {
        if (XHR_LPL.readyState == 4) {
            document.getElementById("DreamPopupText").innerHTML = XHR_LPL.responseText;
            if (callback)
                callback();
        }
    }
    XHR_LPL.open("GET", URL, true);
    XHR_LPL.send(null);
}

