

// Checks that a checkbox has been checked
function checkBox_checked (buttonName)
{
if (buttonName.checked == false) {
	buttonName.focus ();
	return false;
	}
return true;
}

// Checks that a radio button has been checked
function radio_selected (radioName)
{
var i;
var checked = false;

for (i = 0; i < radioName.length; i++) {
	if (radioName [i].checked == true) checked = true;
	}
if (checked == false) radioName [0].focus ();
return checked;
}


// defaultValue is the one returned if nothing is chosen
function list_optionChosen (listName, defaultValue)
{
if (listName.value == defaultValue) {
	listName.focus ();
	return false;
	}
return true;
}

// Basic Email integrity check
function textBox_validEmail (textBoxName)
{
var atLocation;
var email;

email = textBoxName.value;
atLocation = email.indexOf ("@");

// Check for existance of '@'
if (atLocation == -1) {
	textBoxName.focus ();
	return false;
	}
	
// Is there a '.' after the '@'
if (email.indexOf (".", atLocation) == -1) {
	textBoxName.focus ();
	return false;
	}
return true;
}

function textBox_minLength (textBoxName, minLength)
{
if (textBoxName.value.length < minLength) {
	textBoxName.focus ();
	return false;
	}
return true;
}

function textBox_maxLength (textBoxName, maxLength)
{
if (textBoxName.value.length > maxLength) {
	textBoxName.focus ();
	return false;
	}
return true;
}

// Checks that textBoxName1 is the same as textBoxName2
function textBox_checkDuplicate (textBoxName1, textBoxName2)
{
if (textBoxName1.value != textBoxName2.value) {
	textBoxName2.focus ();
	return false;
	}
return true;
}

