﻿/*function chkFormExp() {
	var nameForm 	= arguments[0];
	var numArgs 	= arguments.length;
	var valid 		= true;

	for(var i = 1; i < numArgs; i++) {
		if(!chkField(nameForm[arguments[i]])) {
			nameForm[arguments[i]].style.border = '2px solid #de0000';
			nameForm[arguments[i]].focus();
			valid = false;
		}
	}
	
	if(!valid) {
		alert("Bitte füllen Sie noch die makierten Felder aus!");
	}
	return valid;
}
*/



function chkFormExp() {
	var nameForm 	= arguments[0];
	var numArgs 	= arguments.length;
	var valid 		= true;

	for(var i = 1; i < numArgs; i++) {
		if(!chkField(nameForm[arguments[i]])) {
			nameForm[arguments[i]].style.border = '2px solid #de0000';
			nameForm[arguments[i]].focus();
			valid = false;
		}
	}
	
	if(!valid) {
	
		if ((document.ExAnfrage.Sprache.value == 'DE') || (document.Anfrage.Sprache.value == 'DE'))  {
			alert("Bitte füllen Sie noch die makierten Felder aus!");
		}
		
		if ((document.ExAnfrage.Sprache.value == 'EN') || (document.Anfrage.Sprache.value == 'EN')) {
			alert("Please fill out the marked fields!");
		}
		
		if ((document.ExAnfrage.Sprache.value == 'IT') || (document.Anfrage.Sprache.value == 'IT')) {
			alert("Prego compila le caselle marcate!");
		}
	
	}
	return valid;
}

function chkField(field) {
	if(field.value != "") {
		if((field.name.toUpperCase().indexOf("EMAIL") != -1) 
		&& ((field.value.indexOf('@') == -1) 
		|| (field.value.indexOf('.') == -1))) {
			return false;
		} else {
			return true;
		}
	} else {
		return false;
	}
}