function contentUpdate(ajax_url, chElement, meth)
{
	if(!meth)
	  meth = 'get';
  
	req = new Ajax.Request(ajax_url, 
	  {
		  method: meth,
			onCreate: function()
			{
				wait = $('WAIT');
				if(wait)
				{
					wait = wait.innerHTML;
				}
				else(wait)
				{
					wait = 'Bitte warten ...';
				}
				$(chElement).update(wait);
			}, // create()
			onSuccess: function(transport)
			{
				var write_in = $(chElement);
				write_in.update(transport.responseText);
			} // success
	  } // ajax obj.
	); // new Ajax
} // contentUpdate()

function minilogin()
{
	var setvis = 'none';
	var vis = $('minilogin').style.display;
	if(vis == 'none')
	{
		setvis = 'block';
	}
	$('minilogin').style.display = setvis;
}

function user_pay(stat, id_invoice)
{
	var setval = 0;
	var img = '/bilder/unpayed.png';
	var on_click = function onclick(event) {
	    user_pay(true, id_invoice);
	};
	var quest = 'Soll die Rechnung als unbezahlt markiert werden?';
	if(stat == true)
	{
		setval = 1;
		img = '/bilder/payed.png';
		on_click = function onclick(event) {
		    user_pay(false, id_invoice);
		};
		quest = 'Soll die Rechnung als bezahlt markiert werden?';
	}
	ask = confirm(quest);
	if(!ask)
	{
		return false;
	}
	var req = new Ajax.Request('/index.php?page=invoice_set&frame=ajax&ID_INVOICE='+id_invoice+'&SET='+setval, 
			{
				method: 'get',
				onSuccess: function(transport)
				{
					//alert(transport.responseText);
				}
			});
	$('user_pay_'+id_invoice).src=img;
	$('user_pay_act_'+id_invoice).onclick = on_click;
}

function ad_top(stat, id_ad, fk_kat, adtable)
{
	var setval = 0;
	var img = '/admin/gfx/top0.png';
	var on_click = function onclick(event) {
	    ad_top(true, id_ad, fk_kat, adtable);
	};
	var quest = 'Soll die Anzeige NICHT mehr als TOP markiert werden?';
	if(stat == true)
	{
		setval = 1;
		img = '/admin/gfx/top1.png';
		on_click = function onclick(event) {
		    ad_top(false, id_ad, fk_kat, adtable);
		};
		quest = 'Soll die Anzeige als TOP markiert werden?';
	}
	ask = confirm(quest);
	if(!ask)
	{
		return false;
	}
	var req = new Ajax.Request('/admin/index.php?page=set_topanzeige&frame=ajax&ID_AD='+id_ad+'&TABLE='+adtable+'&FK_KAT='+fk_kat+'&SET='+setval, 
			{
				method: 'get',
				onSuccess: function(transport)
				{
					//alert(transport.responseText);
				}
			});
	$('top_i_'+id_ad+'_'+fk_kat).src=img;
	$('top_a_'+id_ad+'_'+fk_kat).onclick = on_click;
}
