function validateInput() {
	var mustAccept='You must accept the rules for TrustedBlogging';
	fieldNamePrintList=['name','email','blog title','country','blog url'];
	fieldNameList=['name','email','blogTitle','country','blogUrl'];

	for(fieldIndex in fieldNameList) {
		var fieldName=fieldNameList[fieldIndex];
		var node=document.getElementById(fieldName);
		if(node.value=="") {
			var msg='The required field \'' + fieldNamePrintList[fieldIndex] + '\' is empty';
			alert(msg);
			return false;
		}

		// Implement extra rules.
		switch(fieldName) {
			case 'name':
				if(node.value.length<2) {
					var msg='The field \'' + fieldNamePrintList[fieldIndex] + '\' is to short';
					alert(msg);
					return false;
				}
				break;
			case 'email':
				var aPos=node.value.indexOf("@");
				if(aPos<=0 || node.value.indexOf(".") <aPos-1) {
					var msg='The field \'' + fieldNamePrintList[fieldIndex] + '\' does not contain a valid email address';
					alert(msg);
					return false;
				}
				break;
			case 'blogUrl':
				var dotPos=node.value.indexOf(".");
				if(dotPos<=0 || node.value.length<4) {
					var msg='The field \'' + fieldNamePrintList[fieldIndex] + '\' does not contain a valid url';
					alert(msg);
					return false;
				}
				break;
		}
	}

	// Chec accept checkbox
	if(document.getElementById('accept').checked==false) {
		alert(mustAccept);
		return  false;
	};
	return true;
}

