<!--
var emailPattern = /^([\S.]+)(@[\S.]+)(\.[a-z]{2,3})$/;
var badName = /([^a-zA-Z-])+/gi ; // Just look for any non letter or hyphen character within the string
var strCVFile = /\\+\w+(\.){1}(doc)|(rtf)$/i; //Check for valid file names, ignore the path
var testRslt;

function checkForm(formObj){
	var msg = "", thsEl;
	for(i=0; i<formObj.elements.length; i++){
		thsEl = formObj.elements[i]; 
		if(thsEl.required){
			switch(thsEl.type){
				case "text":
					if (thsEl.id == "Email"){
						testRslt = thsEl.value.match(emailPattern);
						if ((testRslt == null)|| (testRslt.length < 4)){
						    msg += "Please enter your email address\r\n";
						}
					} else {
						testRslt = thsEl.value.match(badName);
						if ((thsEl.value.length == 0) || (testRslt != null)){
							// Bad character found in name, fail form submission
							msg += thsEl.name.substring(0,(thsEl.name.length-4)) + " Name can only contain letters and an optional hyphen\r\n";
						}
					}
					break;
				case "select-one":
					if(thsEl.selectedIndex == 0 ){
						msg += "Please select a work category\r\n";
					}
					break;
				case "file":
					testRslt = thsEl.value.match(strCVFile);
					if((thsEl.value.length == 0) || (testRslt == null)){
						msg += "Please attach your CV\r\n";
					}
					break;
				default:
					// not handled
					break;
			}
		}
	}
	if (msg.length <= 0){
		return true;
	}
	alert (msg);
	return false;
}

function setRequired(formObj){
	formObj.elements['Firstname'].required = true;
	formObj.elements['Lastname'].required = true;
	formObj.elements['worksector'].required = true;
	formObj.elements['Email'].required = true;
	formObj.elements['FILE1'].required = true;	
}

//-->