function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.contactform.firstname.value))
	{ errormessage += "\n\nPlease complete the \"First Name\" text field."; }
if(WithoutContent(document.contactform.lastname.value))
	{ errormessage += "\n\nPlease complete the \"Last Name\" text field."; }
	
if(ContactName())
	{ errormessage += "\n\nThe \"First Name\" and \"Last Name\" Fields must contain different text."; }

if(WithoutContent(document.contactform.sendertel.value))
	{ errormessage += "\n\nPlease complete the \"Telephone\" text field."; }
if(WithoutContent(document.contactform.senderemail.value))
	{ errormessage += "\n\nPlease complete the \"Email Address\" text field."; }



//if(WithoutSelectionValue(document.contactform.country))
	//{ errormessage += "\n\nPlease select your country from the dropdown list."; }	
//if(WithoutCheck(document.contactform.checkLoner))
	//{ errormessage += "\n\nThe \"Loner\" check box must be checked."; }	
//if(NoneWithCheck(document.contactform.checkOne))
	//{ errormessage += "\n\nPlease check one or more check boxes of the set of three."; }			
//if(WithoutCheck(document.contactform.radioLoner))
	//{ errormessage += "\n\nThe \"Loner\" radio button must be clicked."; }
//if(NoneWithContent(document.contactform.oneOrTheOther))
//	{ errormessage += "\n\nSomething must be typed in one or both of the set of form text fields."; }
//if(WithoutContent(document.contactform.FileGet.value))
	//{ errormessage += "\n\nA file name must be provided for uploading."; }


// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}

//Removes submit button after form is validated
if (document.contactform) {
document.getElementById('preProc').style.visibility = "hidden";
document.getElementById('postProc').style.visibility = "visible";
}

return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}

function ContactName() {
		
	pw1 = document.contactform.firstname.value;
	pw2 = document.contactform.lastname.value;
	if (pw1 != pw2) {
		return false;
	}
else return true;
}
			
//-->

var newWin = null; 
function popUp(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixedscroll") 
   strOptions="status,scrollbars,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="scrollbars,"+ 
     "resizable,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

function checkForm(form){
     intro = 'Please provide the following information:\n\n';
     msg = '';
     regex = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
     email = form.email.value;
     if(form.firstname.value==''){msg+='First name\n';}
     if(form.lastname.value==''){msg+='Last name\n';}
     if(email==''||!regex.test(email)){msg+='A valid email address\n';}
     if(form.organisation.value==''){msg+='Organisation details\n';}
     if(form.interest.value==''){msg+='Interest\n';}
     if(msg==''){return true}
     else if (msg!= ''){alert(intro + '\n' + msg);return false;}
}

function checkform() 
{
	document.application_form.submit();
}

