function jsf_testVal(frm)
{
	var sMsg = new Array();
	if (frm.txName.value.length == 0)
	{
		sMsg.push('Please enter your name.');
	}
	if (frm.txPhone.value.length == 0 && frm.txMobile.value.length == 0)
	{
		sMsg.push('Please enter your phone or mobile number.');
	}
	if (frm.txEmail.value.length == 0 || !jsf_validEmail(frm.txEmail.value))
	{
		sMsg.push('Please enter a valid email address.');
	}
	if (frm.zoneLst.selectedIndex <= 0)
	{
		sMsg.push('Please select which zone you are applying for.');
	}
	if (!frm.borderingZone[0].checked && !frm.borderingZone[1].checked)
	{
		sMsg.push('Please choose whether you wish to be considered for a bordering zone.');
	}
	if (frm.positionType.selectedIndex <= 0)
	{
		sMsg.push('Please select your preferred position type.');
	}
	if (frm.positionLst.selectedIndex <= 0)
	{
		sMsg.push('Please select which position you are applying for.');
	}
	if (frm.positionLst.selectedIndex == 2 && frm.caseMgrOption.selectedIndex <= 0)
	{
		sMsg.push('Please select whether you would like to be considered for the Youth Worker role.');
	}
	if (frm.safeModel.value.length == 0)
	{
		sMsg.push('Please enter in your own words the Safe Places model and approach.');
	}
	if (!frm.rosteredSleepover.checked)
	{
		sMsg.push('Please acknowledge that you understand the high level availability to be rostered for sleepover shifts 24/7 Monday to Sunday.');
	}
	if (frm.regularCommitments.value.length == 0)
	{
		sMsg.push('Please enter details of any regular commitments. If you have no regular commitments please enter \'None\'.');
	}
	if (frm.oneoffCommitments.value.length == 0)
	{
		sMsg.push('Please enter details of any one off commitments. If you have no one off commitments please enter \'None\'.');
	}
	if (!frm.multipleSleepover.checked)
	{
		sMsg.push('Please acknowledge that you understand the weekly average of sleepover shifts.');
	}
	if (!frm.driversLicence[0].checked && !frm.driversLicence[1].checked)
	{
		sMsg.push('Please choose whether you have a current driver\'s licence.');
	}
	if (!frm.previousApp[0].checked && !frm.previousApp[1].checked)
	{
		sMsg.push('Please choose whether you have previously applied for a position with us.');
	}
	if (!frm.crimHistoryCheck[0].checked && !frm.crimHistoryCheck[1].checked)
	{
		sMsg.push('Please choose whether you are willing to undergo the criminal history and working with children checks.');
	}
	if (!frm.positionDesc[0].checked && !frm.positionDesc[1].checked)
	{
		sMsg.push('Please choose whether you have read the relevant Safe Places position description.');
	}
	if (!frm.ausResident[0].checked && !frm.ausResident[1].checked)
	{
		sMsg.push('Please choose whether you are an Australian resident.');
	}
	if (frm.stateCountry.selectedIndex <= 0)
	{
		sMsg.push('Please select which state or country you live in.');
	}
	if (frm.softwareCompetence.selectedIndex <= 0)
	{
		sMsg.push('Please choose your level of software competence.');
	}
	if (!frm.positionExp[0].checked && !frm.positionExp[1].checked)
	{
		sMsg.push('Please choose whether you meet the experience requirements.');
	}
	if (frm.positionExp[0].checked)
	{		
		if (frm.experienceLength.selectedIndex <= 0)
		{
			sMsg.push('Please select your experience relating to the position description.');
		}
		if (frm.experienceArea.selectedIndex <= 0)
		{
			sMsg.push('Please select your area of experience.');
		}
	}
	if (frm.hearAbout.selectedIndex <= 0)
	{
		sMsg.push('Please select how you heard about Safe Places.');
	}
	if (frm.hearAbout.selectedIndex == 4 && frm.hearAboutOther.value.length == 0)
	{
		sMsg.push('Please describe how you heard about Safe Places.');
	}
	if (frm.relExperience.value.length == 0)
	{
		sMsg.push('Please enter some details of your relevant experience. Your resume alone is not adequate.');
	}
	if (frm.resumeFile.value.length == 0)
	{
		sMsg.push('You are required to attached a resume.');
	}
	if (!frm.awareBox.checked || !frm.possessBox.checked || !frm.utiliseBox.checked || !frm.participateBox.checked || !frm.understandBox.checked)
	{
		sMsg.push('You must accept the 5 statements relating to challenging behaviour at the base of the form to submit an application.');
	}
	if (sMsg.length > 0)
	{
		alert(sMsg.join('\n'));
		return false;
	}
	else
	{
		return true;
	}
}
function jsf_validEmail(object_value)
{
	var regexPattern = new RegExp(/^[a-zA-Z_0-9-]+(\.[a-zA-Z_0-9-]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]{2,7}$/);
	//trim whitespace before we validate
	object_value = object_value.replace(/^\s+/,'').replace(/\s+$/,'');
	return regexPattern.test(object_value);
}
function jsf_testVal2(frm)
{
	var sMsg = new Array();
	if (frm.txName.value.length == 0)
	{
		sMsg.push('Please enter your name.');
	}	
	if (frm.txPhone.value.length == 0 && frm.txMobile.value.length == 0 && frm.txEmail.value.length == 0)
	{
		sMsg.push('Please enter your mobile, phone number or email address.');
	}
	if (frm.txEmail.value.length != 0 && !jsf_validEmail(frm.txEmail.value))
	{
		sMsg.push('Please enter a valid email address.');
	}
	if (sMsg.length > 0)
	{
		alert(sMsg.join('\n'));
		return false;
	}
	else
	{
		return true;
	}
}
function jsf_testRadio(oObj,sMsg)
{
	alert(sMsg);
	oObj.checked = false;
	
}
function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
		cntfield.value = maxlimit - field.value.length;
}
