// Valid email address format contained in a textfield
function validEmail(theInput, errorText){
	if (theInput.value.indexOf("@", 1)==-1 || theInput.value.indexOf(".", 4)==-1){
		alert(errorText);
		theInput.focus();
		return false;
	}
	return true;
}

// Valid textfield containing at least 'textLength' characters
function validText(theInput, errorText, textLength){
	if (theInput.value.length<textLength){
		alert(errorText);
		theInput.focus();
		return false;
	}
	return true;
}

// Valid textfield containing at least 2 characters
function validText(theInput, errorText){
	if (theInput.value.length<2){
		alert(errorText);
		theInput.focus();
		return false;
	}
	return true;
}

// Valid select where value is at least 1 character
function validSelect(theInput, errorText){
	if (theInput.options[theInput.selectedIndex].value.length<1){
		alert(errorText);
		theInput.focus();
		return false;
	}
	return true;
}

// Valid radio button(s) where at least one button is selected
function validRadio(theInput, errorText){
	var foundOne=0;
	for (var loop=0; loop<theInput.length; loop++){
		if(theInput[loop].checked){
			foundOne=1;
		}
	}
	if (!foundOne){
		alert(errorText);
		theInput[0].focus();
		return false;
	}
	return true;
}
