// JavaScript Document
function checkfield(theForm){ 
	standardMsg = null;
	switch(lang){
		case 'eng':
		standardMsg = "Please fill in the required fields!";
		break;
		case 'de':
		standardMsg = "Bitte die obligatorischen Felder ausfüllen!";
		break;
		default:
		standardMsg = "Veuillez remplir tous les champs obligatoirs!";
	}
	//sorting out required fields
	for(x = 0; x < requiredFields.length; x++){
		theElement = theForm.elements[requiredFields[x]];
			//getting the type of element
		if(theElement.type == 'select-one'){ //selection list one value
			if(theElement.options[theElement.selectedIndex].value.length == 0){
				theElement.focus();
				alert(standardMsg);
				return false;
			}
		}else if(theElement.type =='select-multiple'){ //selection list multiple values
			//alert('Required: '+theElement.name+' option selected: '+theElement.selectedIndex);
			if(theElement.selectedIndex == -1){
				theElement.focus();
				alert(standardMsg);
				return false;
			}
		}else if(theElement.type == 'text' || theElement.type == 'password' || theElement.type == 'textarea' || theElement.type == 'file'){ //text
			if(theElement.value.length == 0){
				theElement.focus();
				alert(standardMsg);
				return false;
			}
		}
	}
	 
 	return true;
} // end checkfield()
