var activesmilie="";
var target='';
var ajaxblocker=0;
function setdatum(string)
{
	document.getElementById(activetab).value=string;
}
function SuchenUndErsetzen(QuellText, SuchText, ErsatzText)
{
	if ((QuellText == null) || (SuchText == null))           { return null; }
	if ((QuellText.length == 0) || (SuchText.length == 0))   { return QuellText; }
	if ((ErsatzText == null) || (ErsatzText.length == 0))    { ErsatzText = ""; }
	var LaengeSuchText = SuchText.length;
	var LaengeErsatzText = ErsatzText.length;
	var Pos = QuellText.indexOf(SuchText, 0);
	while (Pos >= 0)
	{
		QuellText = QuellText.substring(0, Pos) + ErsatzText + QuellText.substring(Pos + LaengeSuchText);
		Pos = QuellText.indexOf(SuchText, Pos + LaengeErsatzText);
	}
	return QuellText;
}
function loadurl(target) {
	if(ajaxblocker!="1")
	{
		document.getElementById('ajxload').style.display='block';
		ajaxblocker=1;
		try {
			//xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			target=SuchenUndErsetzen(target,"ajax","index");
			window.location.href=target;
		}
		xmlhttp.onreadystatechange = triggered;
		xmlhttp.open("GET", target);
		xmlhttp.send(null);
	}
}
function triggered() {
	var inhalt=new Array();
	if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
		if(target){
			document.getElementById(target).innerHTML = xmlhttp.responseText;
		}
		ajaxblocker=0;
		document.getElementById('ajxload').style.display='none';
	}
}
function ajx(content,zusatz)
{
	ajxnoajx(content,zusatz);
	return false;
	if(ajaxblocker=="1"){return false;}
	target='content';
	loadurl('ajax.php?page='+content+zusatz);	
	return false;
}
function ajxnoajx(content,zusatz)
{
	target='ajax.php?page='+content+zusatz;
	target=SuchenUndErsetzen(target,"ajax","index");
	window.location.href=target;
	return false;
}
function ajxnoreturn(content,zusatz)
{
	if(ajaxblocker=="1"){return false;}
	target=false;
	loadurl('ajax.php?page='+content+zusatz);	
	window.setTimeout("reloadac()",10000);
	return false;
}
function ajxdel(content,zusatz)
{
	if(ajaxblocker=="1"){return false;}
	if(confirm("Diesen Datensatz wirklich löschen?"))
	{
		ajx(content,zusatz);	
	}
	return false;
}
function ajxwithtarget(content,zusatz,ziel)
{
	if(ajaxblocker=="1"){return false;}
	target=ziel;
	loadurl('ajax.php?page='+content+zusatz);	
	return false;
}
function reloadac()
{
	window.setTimeout("reloadac()",15000);
	if(ajaxblocker=="1"){return false;}
	target="account";
	var jetzt = new Date();
	var Zeit = jetzt.getTime();
	loadurl('ajax.php?do=accinf&cache='+Zeit);
	return false;
}
function popup(target,width,height,typ)
{
	if(typ==1)
	{
		window.open(target, "popup", "width="+width+", height="+height+", menubar=NO, resizeable=NO,scrollbars=NO,locationbar=NO");
	}
	else
	{
		window.open(target, "popup", "width="+width+", height="+height);
	}
}
function showhelp(id)
{
	document.getElementById(id).style.display='inline';
}
function closehelp(id)
{
	document.getElementById(id).style.display='none';
}
function setsmilie(string)
{
	document.getElementById(activesmilie).value=document.getElementById(activesmilie).value+string;
}


