//	hier sind nur JS-Effekte enthalten

//Aufziehen einer Box (height)
function Box_aufziehen (DIV_BOX, height_von, height_bis, Dauer, Warte)
{
	var Pause = 100; //Millisekunden
	var Differenz = parseInt(height_bis) - parseInt(height_von);
	
	
	var Schritte = Math.round((Dauer * 1000) / Pause);
	Differenz = Math.round(Differenz / Schritte);
	//alert(Differenz);
	
	for (var i = 1; i <= Schritte; i++ )
	{
		alert(Differenz*i);
		window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.height= "'+ (Differenz * i) +'px";', (i * Pause + Warte*1000));
	}
}

//Box verschieben (vertikal)
function BOX_verschieben (DIV_BOX, height_von, height_bis, Dauer, Warte)
{
	var Pause = 1; //Millisekunden
	var Differenz = parseInt(height_bis) - parseInt(height_von);
	
	
	var Schritte = Math.round((Dauer * 1000) / Pause);
	Differenz = Differenz / Schritte;
	//alert(Differenz);
	
	for (var i = 1; i <= Schritte; i++ )
	{
		window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.marginTop= "'+ (height_von + Differenz * i) +'px";', (i * Pause + Warte*1000));
	}
}

//Transparenz-Effekt: FADE(DIV_BOX, Start_Opacity, Stopp_Opacity, Dauer_in_Sek, Warte_in_Sek);
function fade(DIV_BOX, Start_Opacity, Stopp_Opacity, Dauer, Warte)
{
	var fadeDIV = document.getElementById(DIV_BOX);
	
	Start_Opacity = Start_Opacity * 100;
	Stopp_Opacity = Stopp_Opacity * 100;
	
	Warte = Warte *1000;
	
	var opacity_steps = (Start_Opacity-Stopp_Opacity);	
		if (opacity_steps < 0 ) { opacity_steps = opacity_steps * (-1); }
	
	var Pause = Math.round((Dauer * 1000) / opacity_steps); 
	
	if (Start_Opacity < Stopp_Opacity)
	{
		
		//fade_in
		for (i = 0; i <= opacity_steps; i++)
		{
			window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.filter = "Alpha (opacity='+ (Start_Opacity+i) +')";' +
							  'document.getElementById("'+ DIV_BOX +'").style.MozOpacity = '+ (Start_Opacity + i)/100 +';' +
							  'document.getElementById("'+ DIV_BOX +'").style.opacity = '+ (Start_Opacity + i)/100 +';',
								 (i * Pause + Warte));
			
			if (i == 0 && Start_Opacity == 0)
			{
				//setze DIV auf sichtbar
				document.getElementById(DIV_BOX).style.filter = "Alpha (opacity= 0)";
				document.getElementById(DIV_BOX).style.MozOpacity = "0";
				document.getElementById(DIV_BOX).style.opacity = "0";
				//document.getElementById(DIV_BOX).style.display = "block";
				//nicht sofort 'block', sonst wird ggf. voriger fade abgebrochen
				window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.display = "block";', Warte);
			}
		}
	}
	else
	{
		// fade_out
		for (i = 0; i <= opacity_steps; i++)
		{			
			window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.filter = "Alpha (opacity='+ (Start_Opacity-i) +')";' +
							  'document.getElementById("'+ DIV_BOX +'").style.MozOpacity = '+ (Start_Opacity-i)/100 +';' +
							  'document.getElementById("'+ DIV_BOX +'").style.opacity = '+ (Start_Opacity-i)/100 +';',
								 (i * Pause + Warte));
		}
		
		//setze DIV auf unsichtbar
		if (Stopp_Opacity == 0)
		{
			window.setTimeout('document.getElementById("'+ DIV_BOX +'").style.display = "none";', (i * Pause + Warte));
		}
	}
}

//////////// INPUT CHECK // INPUT CHECK ////////////////////////////////
//nur ganze Zahlen
function nurGanzeZahlen(el)
{
	var val = el.value.replace(/[^\d]/g, '');
  	
  	el.value = val;
}

//und das Pluszeichen (TelNrCheck-Spezial
function nurGanzeZahlen_und_Plus(el)
{
	var val = el.value.replace(/[^\d+]/g, '');
  	
  	el.value = val;
}

//Telefonnummern-Check
function TelNrCheck(el)
{
	var val = el.value.replace(/[^\d()+/ ]/g, '');
  	
  	el.value = val;
}

//nur Buchstaben (nicht numerische Werte)
function nichtNumerisch(el)
{
	var val = el.value.replace(/[^A-Za-z öäüÖÄÜß.-´`]/g, '');
  	
  	el.value = val;
}
			
//Check eMail-Format
function emailcheck(el)
{
	var val = el.value.replace(/[^A-Za-zöäüÖÄÜß@.-_]/g, '');
  	
  	el.value = val;
}
