var spendentoolAction = true;
var introCount = 0;
var noDach = false;


function goFormular()
{
	if (ac!="")
	{
		top.location.href="/spenden/online-spenden/?betrag="+$("inputfield").value+"&ac="+ac;
	}
	else{
		top.location.href="/spenden/online-spenden/?betrag="+$("inputfield").value;
	}
	
}


function initSpendentool()
{
	showIntro();
}

function showIntro()
{
	if (introCount==0) {target="spendentool_2"; duration=2000}
	if (introCount==1) {target="spendentool_3a"; duration=6000}
	introCount++;
	element = $(target);
	element.setStyle('display','block');
	element.set('opacity','0.0');
	fadein = new Fx.Tween(element, {duration:duration, transition:"sine:in:out", fps:50});
	fadein.addEvent('complete', function(e){
		if (introCount<2) {
			if (noDach==true && introCount==2)
			{
				// Nothing
			}
			else
			{
				showIntro();
			}
		}
	});
	fadein.start("opacity", 0, 1);
	if (introCount==3) $('spendentool_2').setStyle('display','none');
	if (introCount==2) showIntroDach();
}

function showIntroDach()
{
	element = $("spendentool_3b");
	element.setStyle('display','block');
	element.set('opacity','0.0');
	fadein = new Fx.Tween(element, {duration:6000, transition:"sine:in:out", fps:50});
	fadein.start("opacity", 0, 1);
}

var spendeGoCount = 0;
var tempo = 1000;
function spendeGo()
{
	noDach = true;
	if (spendeGoCount==0) {target="spendentool_4";}
	if (spendeGoCount==1) {target="spendentool_5";}
	if (spendeGoCount==2) {target="spendentool_6";}
	if (spendeGoCount==3) {target="spendentool_7";}
	if (spendeGoCount==4) {target="spendentool_8";}
	spendeGoCount++;
	element = $(target);
	element.setStyle('display','block');
	element.set('opacity','0.0');
	fadein = new Fx.Tween(element, {duration:tempo, transition:"sine:in:out", fps:50});
	fadein.addEvent('complete', function(e){
		if (spendeGoCount<5) {
			spendeGo();
		}
		if (spendeGoCount==4)
		{
			hideDach();
		}
	});
	fadein.start("opacity", 0, 1);
}


function hideDach()
{
	element = $('spendentool_3b');
	fadein = new Fx.Tween(element, {duration:500, transition:"sine:in:out", fps:50});
	fadein.start("opacity", 1, 0);
	fadein.addEvent('complete', function(e){
		element.setStyle('display','none');
	});
}






