/*
	validation of the advice contact form
*/
var searchfor = new Array();
var searchfor = ['http:','<script','<img','href=','<a','/a>'];
var elmnt = document.contact;

function validate(){
	var msg = "";
	var	nm = elmnt.sendername.value;
	if (nm == "") {
		msg += "You didn't enter your first name or a nickname.\n";
	}
	nm = elmnt.sendermail.value;
	if (nm != "" && !validateEmail(nm)) {
			msg += "You did not enter a valid email address.\n";
	}
	nm = elmnt.question.value;
	if (nm == "") {
		msg += "You forgot to type in your question.\n";
	}
	else {
		msg += checkInput(nm);
	}
	if (msg.length == 0) {
		nm = elmnt.back.value;
		if (nm != "") {
			msg += checkInput(nm);
		}
	}
	nm = elmnt.usernumber.value;
	msg += checkAutoCode(nm);
	if (msg.length > 0) {
		err = "Please, note the following problems:\n\n" + msg;
		alert(err);
	} else {
		elmnt.submit();
	}
		return true;
}
////////////////////////////////////////////////
function checkInput(str) {
	str = str.toLowerCase();
	for (var j=0;j<searchfor.length;j++) {
		if (str.search(searchfor[j]) > -1) {
			return "It is prohibited to enter website links, pictures or other dynamic content.";
		}
	}
	return "";
}
////////////////////////////////////////////////