function sucheAnbieter()
{
	var such = $F('suchbegriff');
	
	if ( such.length > 2 )
	{
		new Ajax.Updater('treffer', '/admin/ajax/sucheAnbieter.ajax.php',
		{
		method        : 'get',
		parameters    : 'such=' + such,

		onFailure     : function(resp)
						{
						  alert('Fehler (/admin/ajax/sucheAnbieter.php): ' + resp.statusText);
						},
		onException   : function(resp, exception)
						{
						  alert('Ausnahme (/admin/ajax/sucheAnbieter.php): ' + exception);
						}
		}
		);
  
	} else
	{
		$('treffer').update('');
	}
  
}

function calculate()
{
	if ( $('gesamt') == undefined )
	{
		return true;
	}
	var anz = $F('Anzahl');
	
	if ( anz.length > 0 && anz > 0 )
	{
		new Ajax.Request('/shop/calculate.ajax.php',
		{
		method        : 'get',
		parameters    : 'anz=' + anz,

		onFailure     : function(resp)
						{
						  alert('Fehler (/shop/calculate.ajax.php): ' + resp.statusText);
						},
		onException   : function(resp, exception)
						{
						  alert('Ausnahme (/shop/calculate.ajax.php): ' + exception);
						},
		onSuccess	  : function(resp)
						{
						  eval(resp.responseText);
						
							//$('total').update('€ ' + $F('einzelpreis') * anz + $F('versandkosten'));
							$('gesamt').update(data.summe);
							$('total').update(data.versand);
							
						}
		}
		);
		
		
		if ( anz > 1 )
		{
			nurVorkasse(true);
		} else
		{
			nurVorkasse(false);
		}
  
	} else
	{
		$('gesamt').update('€ 0,00');
		$('total').update('€ 0,00');
	}
  
}

function nurVorkasse(ja)
{
	if ( ja )
	{
		$('Zahl_Vor').checked = true;
		$('Zahl_Rech').checked = false;
		$('Zahl_Rech').disable();
	} else
	{
		$('Zahl_Rech').enable();
	}
}


function toggleField(welches, anker)
{
	elem = $(welches);
	anker = $(anker);
	
	if ( elem.visible() )
	{
		eff = Effect.BlindUp(elem, {duration:0.5});
		anker.innerHTML = "Zusätzliche Mitteilung einfügen";
	} else
	{
		eff = Effect.BlindDown(elem, {duration:0.5});
		elem.innerHTML = "";
		anker.innerHTML = "Zusätzliche Mitteilung entfernen";
	}
}
