﻿function xmlRequest(url, myMethod, postdata, parameter) {

    if (!myMethod) myMethod = 'GET';
    if (!parameter) parameter = '';

    if (postdata == undefined) postdata = null;

    xmlhttpReturnParam = parameter;

    //Objekt initiieren
    try {
        xmlhttp = new XMLHttpRequest();
    } catch (error) {
        try {
            xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
        } catch (error) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
    }

    //Handler setzen, damit der downloadstatus überwacht wird
    xmlhttp.onreadystatechange = handleHttpState;

    //Anfrage starten
    // 	alert(myMethod + postdata);
    xmlhttp.open(myMethod, url);
    if (myMethod == "POST") {
        xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
    }
    xmlhttp.send(postdata);
}

function handleHttpState() {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
           
        }
    }
}



var toolTipImg;

function WaitLoadTip(url) {
    toolTipImg = new Image();
    toolTipImg.src = url;

    //alert(toolTipImg.width);

    ShowTop();


    //alert('1' + img.complete);

    //img.onload = function() { alert(img.complete); Tip('<img src=&quot;' + img.url + '&quot; />', BORDERCOLOR, '#000000'); };
    //img.onerror = function() { alert('error'); };
    //alert(img.complete); Tip('<img src=\"" + largeImage + "\" />', BORDERCOLOR, '#000000');
}

function WaitUnTip() {
    toolTipImg = null;
    UnTip();
}

function ShowTop() {
    if (toolTipImg == null)
        return;

    if (toolTipImg.complete) {
        Tip('<img src="' + toolTipImg.src + '" />', BORDERCOLOR, '#000000', WIDTH, toolTipImg.width);
    }
    else {
        window.setTimeout("ShowTop();", 250);
    }
}

function __rinit() {
    // für den IE
    if (document.attachEvent) document.attachEvent("onselectstart", function() { return false; });

    document.onkeyup =
	function() {
	    if (window.getSelection) {
	        var sel = window.getSelection();
	        sel.removeAllRanges();
	    }
	};

    document.onkeydown =
	function() {
	    if (window.getSelection) {
	        var sel = window.getSelection();
	        sel.removeAllRanges();
	    }
	};

    document.onmousemove =
	function() {
	    if (window.getSelection) {
	        var sel = window.getSelection();
	        sel.removeAllRanges();
	    }
	};
}


function writeToLayer(id, content) {
    if (document.getElementById) {
        document.getElementById(id).innerHTML = content;
    } else if (document.layers) {
        document.layers[id].document.write(content);
    } else if (document.all) {
        document.all[id].innerHTML = content;
    }
}
