// JavaScript Document

function addLoader(statuscontainer,text,id) {
	//alert("[ FUNCTION addLoader ]: statuscontainer="+statuscontainer+", text="+text+", id="+id);
	addLoader2(statuscontainer,text,id);
	/*
	var rootVZ = "";
	if(text==undefined) { text = ""; }
	if(id==undefined) { id = 0; }
	document.getElementById(statuscontainer).innerHTML = "";
	
	if(text.length>0) {
		var cont = createElem("div","","id","Loader"+id,"class","Loader");
		var loaderImg = createElem("img","","src",rootVZ+"images_standard/loader3.gif");
		var loaderText = createElem("p",text);
		cont.appendChild(loaderImg);
		cont.appendChild(loaderText);
		document.getElementById(statuscontainer).appendChild(cont);
	}
	else {
		var loader = createElem("img",text,"id","Loader"+id,"src",rootVZ+"images_standard/loader3.gif","class","Loader");
		document.getElementById(statuscontainer).appendChild(loader);
	}
	*/
}
function removeLoader(statuscontainer,id) {
	//testmodeecho("[ FUNCTION removeLoader ]");
	removeLoader2(statuscontainer,id);
	/*
	if(id==undefined) { id = 0; }
	var loader = document.getElementById("Loader"+id);
	document.getElementById(statuscontainer).removeChild(loader);
	*/
}


function addLoader2(statuscontainer,text,id) {
	$("#"+statuscontainer).html("");
	$("#"+statuscontainer).show();
	if(text==undefined) { text = ""; }
	if(id==undefined) { id = 0; }
	var ret = '<div id="Loader'+id+'" class="Loader"><img class="LoaderPic" src="'+backofficeroot+'images_standard/loader3.gif" alt="" border="0" />';
	if(text!=undefined && text.length>0) {
		ret+= '<p>'+text+'</p>';
	}
	ret+= '</div>';
	
	$("#"+statuscontainer).html(ret);
}

function removeLoader2(statuscontainer,id) {
	$("#"+statuscontainer).fadeOut("slow");
}

function addStatus(statuscontainer,text,id) {
	if(text==undefined) { text = ""; }
	if(id==undefined) { id = 0; }
	var ret = '<div id="Status'+id+'" class="Status">';
	if(text!=undefined && text.length>0) {
		ret+= '<p>'+text+'</p>';
	}
	ret+= '</div>';
	
	$("#"+statuscontainer).html(ret);
}
function removeStatus(statuscontainer,id) {
	$("#"+statuscontainer).html("");
}


addError = function(container,text) {
	var url = airroot+backofficeroot+"includes/messages.ajax.php";
	/*
	$.ajax({ url: "test.html", context: document.body, success: function(){
        $(this).addClass("done");
      }});
	*/
	$.ajax({
		url: url,
		type: "post",
		data: ({
			f: "AJAX_error",
			ue: "Leider: Fehler...",
			text: text,
			container: container
		}),
		success: function(data) {
			$("#"+container).html(data);
			$("#"+container).fadeIn("middle");
		}
	});
}

addInfo = function(container,text) {
	var url = airroot+backofficeroot+"includes/messages.ajax.php";

	$.ajax({
		url: url,
		type: "post",
		data: ({
			f: "AJAX_info",
			ue: "Zur Info:",
			text: text,
			container: container
		}),
		success: function(data) {
			$("#"+container).html(data);
			$("#"+container).fadeIn("middle");
		}
	});
}

alert2 = function(text) {
	var container = "LStatus2";
	var statuscontainer = "LStatus";
	var url = airroot+backofficeroot+"includes/messages.ajax.php";
	$.ajax({
		url: url,
		type: "post",
		data: ({
			f: "AJAX_alert",
			ue: "Achtung!",
			text: text,
			container: container
		}),
		success: function(data) {
			$("#"+container).html(data);
			$("#"+container).fadeIn("middle");
		},
		error: function() {
		}
	});
	
}


