<!--//
//	Name:		IsRegEx		
//	Author:		www.imagedesign.ch
//	Function:	Test a string with the regular expression
//	Input:		strString = string to test; strRegEx = regular expression
//	Output: 	nothing -- true or false
//	Return: 	true if the string and the regular expression match else false
//	Sample:		IsRegEx("Th",/^\w{1,2}$/) returns true;	IsRegEx("Th",/^\w{1,1}$/) return false

function IsRegEx(strString, strRegEx)
{
	if (strString.length != 0)
	{
		if(strRegEx.test(strString))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	else
	{
		return false;
	}
}

function IsStringLengthBetween(strString,minlength,maxlength)
{

	if (strString.length > maxlength)
	{
		return false;
	}
	else if (strString.length < minlength)
	{
		return false;
	}
	else
	{
		return true;
	}

}



function countCheckboxChecked(objCheckbox)
{
	var intCount = 0;
	for(i=0;i < objCheckbox.length; i++)
	{
		if(objCheckbox[i].checked)
		{
			intCount = intCount + 1;
		}
	}
	return intCount;

}

function isRadioChecked(aRadio)
{
	var bIsChecked = false;
	for(i=0;i < aRadio.length; i++)
	{
		if(aRadio[i].checked)
		{
			bIsChecked = true;
		}
	}
	return bIsChecked
}



function check115Form(objForm)
{
var strAlert = ""; // Initialisieren von Error-String
		
	with (objForm) { // Pruefen von Formular

	if(!(IsStringLengthBetween(nname.value,3,30))){strAlert = strAlert + "Bitte geben Sie Ihren Nachnamen (mind. 3 Zeichen) ein.\n";}
	else{if(IsRegEx(nname.value, /\d/)){strAlert = strAlert + "Der Nachname darf keine Zahlen enthalten.\n"}}


if (email.value=='') {strAlert = strAlert + "Bitte geben Sie eine Email-Adresse ein.\n";}

if (!(email.value=='')) {
	if(!(IsRegEx(email.value, /^.+@.+\..{2,4}$/))){strAlert = strAlert + "Bitte geben Sie eine gültige Emailadresse ein.\n";}
}

	if(strAlert.length != 0){alert(strAlert);} // Ausgeben von Error-String
	else{objForm.submit();} // Uebermitteln von Formular
	} // Ende Pruefen von Formular
} // Ende Funktion check115Form


function check230Form(objForm)
{
var strAlert = ""; // Initialisieren von Error-String
		
	with (objForm) { // Pruefen von Formular
	if(!(agb_ja.checked)){strAlert = strAlert + "AGB akzeptieren.\n";}
	

	if(strAlert.length != 0){alert(strAlert);} // Ausgeben von Error-String
	else{objForm.submit();} // Uebermitteln von Formular
	} // Ende Pruefen von Formular
} // Ende Funktion check230Form
//-->