window.onresize = calc_position;
window.onscroll = function test() {
document.getElementById('ajax_cover').style.top  = document.documentElement.scrollTop + "px";
}
function create_request()
{
	try {
		var request = new XMLHttpRequest();
	} catch (trymicrosoft) {
		try {
			request = new ActiveXObject("Msxml12.XMLHTTP");
		} catch (othermicrosoft) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = '';
			}
		}
	}
	return request;
}
function bilderbuch(path, id) {
	document.getElementById('bilderbuch').innerHTML="<tr valign=\"top\"><td><img src=\"/ajax_load.gif\" width=\"40\" height=\"40\">Bilder werden geladen...</td></tr>";
	document.getElementById('bilderbuch_anchor').setAttribute('name', id);
	location.hash = id+"|"+path;
	var req = create_request();
	req.open("GET", "/wissen/standorte/standorte/bilder.php?name=" + id, false);
	req.send(null);
	var response = req.responseText;
	document.getElementById('info').innerHTML=response;
	var req = create_request();
	req.open("GET", "/wissen/standorte/standorte/bilder.php?link=" + path, false);
	req.send(null);
	var response = req.responseText;
	document.getElementById('bilderbuch').innerHTML=response;
}
function toggle()
{
	location.hash = "#";
	document.body.focus();
	if (document.getElementById('ajax_cover').style.display == "block" && document.getElementById('ajax_box').style.display == "block") {
		document.getElementById('ajax_cover').style.display   = "none";
		document.getElementById('ajax_box').style.display = "none";
		document.getElementById('close_button').style.display = "none";
		if (document.getElementById('ajax_load')!=null) document.getElementById('ajax_load').style.display = "none";
	} else {
		document.getElementById('ajax_box').style.display = "block";
		document.getElementById('ajax_cover').style.display   = "block";
	}
}
function calc_position()
{
	if (navigator.appName=="Microsoft Internet Explorer") {
		document.getElementById('ajax_box').style.left = document.body.offsetWidth/2-document.getElementById('ajax_box').offsetWidth/2+document.documentElement.scrollLeft + "px";
		document.getElementById('ajax_box').style.top  = document.body.offsetHeight/2-document.getElementById('ajax_box').offsetHeight/2+document.documentElement.scrollTop + "px";
	} else {
		document.getElementById('ajax_box').style.left = window.innerWidth/2-document.getElementById('ajax_box').offsetWidth/2 + "px";
		document.getElementById('ajax_box').style.top  = window.innerHeight/2-document.getElementById('ajax_box').offsetHeight/2 + "px";
		document.getElementById('ajax_cover').style.height = document.height + "px";
	document.getElementById('ajax_cover').style.width = document.width + "px";
	}
}
function edit(id)
{
	//alert("Noch in Arbeit");
	//return;
	// Clear former Content & Insert Load Animation //
	document.getElementById('ajax_content').innerHTML = '<center id="ajax_load"><img src="/ajax_load.gif"></img></center>';
	// Make stuff visible //
	document.getElementById('ajax_box').style.display = "block";
	document.getElementById('ajax_cover').style.display   = "block";
	document.getElementById('ajax_load').style.display   = "block";
	// Pre-Calculate Position //
	calc_position();
	// Create Request & Load Content //
	var req = create_request();
	req.open("GET", "/admin/admin_news2.php?newsid=" + id + "&item=update", false);
	req.send("");
	var response = req.responseText;
	// Wirte Response into 'ajax_content' //
	document.getElementById('ajax_content').innerHTML=response;
	// Re-Calculate Position //
	calc_position();
	// Resize Cover //
	document.getElementById('ajax_cover').style.height = document.height + "px";
	document.getElementById('ajax_cover').style.height = window.scrollHeight + "px";
	document.getElementById('ajax_cover').style.width = document.documentElement.scrollWidth + "px";
}
function visible(id)
{
	document.getElementById(id).style.display = "block";
}
function hidden(id)
{
	document.getElementById(id).style.display   = "none";
}