function gid(id) {
    return document.getElementById(id);
}

var xmlhttp = null;
    // Mozilla
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
function getdata(url, id) {
    xmlhttp.open("post", url, true);
	if(xmlhttp.readyState != 4) {
            if(id!='') {
				gid(id).style.padding="50px 0px";
				gid(id).innerHTML = '<div style="text-align:center;"><img src="lytebox/images/loading.gif" /><p>Bitte warten</p></div>';
			}
    }
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			gid(id).style.padding="";
            gid(id).innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
} 

function senddata(url, param, id) {
		xmlhttp.open("post", url, true);
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", param.length);
		xmlhttp.setRequestHeader("Connection", "close");
		if(xmlhttp.readyState != 4) {
            if(id!='') {gid(id).innerHTML = 'Bitte warten';}
        }
		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				if(id!='') {gid(id).innerHTML = xmlhttp.responseText;}
			}
		}
    xmlhttp.send(param);
}

function sendform(target) {
var param = "kp="+gid('kp').value+"&fin="+gid('fin').value+"&lz="+gid('lz').value;
senddata(target, param, 'ausgabe');
return false;
}
function loadContent(eFiredBy) {
		var url=eFiredBy.href;
		url+="&ajax=1";
		getdata(url, 'content');
	}