var blockArray = new Array("[url","<a href");

function submitFormData(theAction,theForm,lang) {
	document.forms[0].Nachname.style.backgroundColor = "#ffffff";
	document.forms[0].Vorname.style.backgroundColor = "#ffffff";
	document.forms[0].StrasseHausnr.style.backgroundColor = "#ffffff";
	document.forms[0].PlzOrt.style.backgroundColor = "#ffffff";
	document.forms[0].Land.style.backgroundColor = "#ffffff";
	document.forms[0].Uhrzeit.style.backgroundColor = "#ffffff";
	document.forms[0].EMail.style.backgroundColor = "#ffffff";
	document.forms[0].Telefon.style.backgroundColor = "#ffffff";
	document.forms[0].Fax.style.backgroundColor = "#ffffff";	
	document.forms[0].Wuensche.style.backgroundColor = "#ffffff";
	document.forms[0].Anlass.style.backgroundColor = "#ffffff";
	
	formError = 0;	


	if(document.forms[0].Vorname.value.search(reg_name)) {
		document.forms[0].Vorname.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].Nachname.value.search(reg_name)) {
		document.forms[0].Nachname.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].Telefon.value && document.forms[0].Telefon.value.search(reg_telvw)) {
		document.forms[0].Telefon.style.backgroundColor = "#f33";
		formError++;
	}

	if(document.forms[0].Fax.value && document.forms[0].Fax.value.search(reg_telvw)) {
		document.forms[0].Fax.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].StrasseHausnr.value.search(reg_name2)) {
		document.forms[0].StrasseHausnr.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].Land.value && document.forms[0].Land.value.search(reg_name2)) {
		document.forms[0].Land.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].PlzOrt.value.search(reg_name2)) {
		document.forms[0].PlzOrt.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].EMail.value.search(reg_email)) {
		document.forms[0].EMail.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[0].Anlass.value && document.forms[0].Anlass.value.search(reg_name2)) {
		document.forms[0].Anlass.style.backgroundColor = "#f33";
		formError++;
	}

	if(document.forms[0].Uhrzeit.value && document.forms[0].Uhrzeit.value.search(reg_name2)) {
		document.forms[0].Uhrzeit.style.backgroundColor = "#f33";
		formError++;
	}
	
	AnfText = document.forms[0].Wuensche.value;
	
	if(AnfText.indexOf(blockArray[0])>-1||AnfText.indexOf(blockArray[1])>-1&&(AnfText!="")) {
		document.forms[0].Wuensche.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(lang == "e") {
		errorMsg = "Please fill out the fields marked in red correctly.";
	}
	else {
		errorMsg = unescape("Bitte f%FCllen Sie die rot hinterlegten Felder korrekt aus.");
	}
	
	if(formError > 0) {
		alert(errorMsg);
	}
	else {
		updatePage(theAction,theForm);
	}		
}

function updatePage(theAction,theForm) {
	document.forms[theForm].action = theAction;
	document.forms[theForm].submit();
}

function submitVeranstData(lang) {
	document.forms[1].Veranstalter.style.backgroundColor = "#ffffff";
	document.forms[1].Ansprechpartner.style.backgroundColor = "#ffffff";
	document.forms[1].Strasse_Hausnr.style.backgroundColor = "#ffffff";
	document.forms[1].Plz_Ort.style.backgroundColor = "#ffffff";
	document.forms[1].Land.style.backgroundColor = "#ffffff";
	document.forms[1].email.style.backgroundColor = "#ffffff";
	document.forms[1].Telefon.style.backgroundColor = "#ffffff";	
	
	formError = 0;	

	if(document.forms[1].Veranstalter.value.search(reg_name)) {
		document.forms[1].Veranstalter.style.backgroundColor = "#f33";
		formError++;
	}
	
	if(document.forms[1].Strasse_Hausnr.value && document.forms[1].Strasse_Hausnr.value.search(reg_name2)) {
		document.forms[1].Strasse_Hausnr.style.backgroundColor = "#f33";
		formError++;
	}

	if(document.forms[1].Plz_Ort.value && document.forms[1].Plz_Ort.value.search(reg_name2)) {
		document.forms[1].Plz_Ort.style.backgroundColor = "#f33";
		formError++;
	}

	if(document.forms[1].Land.value.search(reg_name2)) {
		document.forms[1].Land.style.backgroundColor = "#f33";
		formError++;
	}

	if(document.forms[1].Ansprechpartner.value.search(reg_name)) {
		document.forms[1].Ansprechpartner.style.backgroundColor = "#f33";
		formError++;
	}
		
	if(document.forms[1].Telefon.value.search(reg_telvw)) {
		document.forms[1].Telefon.style.backgroundColor = "#f33";
		formError++;
	}
		
	if(document.forms[1].email.value.search(reg_email)) {
		document.forms[1].email.style.backgroundColor = "#f33";
		formError++;
	}
		
	if(lang == "e") {
		errorMsg = "Please fill out the fields marked in red correctly.";
	}
	else {
		errorMsg = unescape("Bitte f%FCllen Sie die rot hinterlegten Felder korrekt aus.");
	}
	
	if(formError > 0) {
		alert(errorMsg);
	}
	else {
		document.forms[1].submit();
	}		
}