﻿var req = null;
var rootURL;

function Flyout(url) {
    rootURL = window.location.href;
    if (window.location.pathname.length > 0) {
        rootURL = rootURL.substring(0, rootURL.length - window.location.pathname.length);
    }
    rootURL += '/Flyout.aspx?path=';
     try{
        req = new XMLHttpRequest();
    }
    catch (e){
        try{
            req = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e){
            try{
                req = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (failed){
                req = null;
            }
        }  
    }

    if (req == null) {
        alert('Could not create request.');
        return;
    }
    
    req.open("GET", rootURL + url, true);

    req.onreadystatechange = FlyoutComplete;

    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.send(null);
}

function FlyoutComplete() {
    switch (req.readyState) {
        case 4:
            if (req.status != 200) {
                alert("Fehler:" + req.status);
            } else {
                document.forms[0].innerHTML += req.responseText;
            }
            break;

        default:
            return false;
            break;
    }
}

