function validateFormTextField( field, min, max, fieldname )
{
	var str = field.value;
	
	// replace all spaces with nothing and store in a temp value
	str = str.replace( /(\s+)$/g, "" );

	// verify that the length of the field is not greater than the max or less than the min length	
	if ((field.value.length < min) || (field.value.length > max))
	{
		// alert the user of the error
		if (min == max)
			alert(fieldname + " must be " + max + " characters long");
		else
			alert(fieldname + " must be between " + min + " and " + max + " characters long");

		// put focus on the form field
		field.focus();
		return false;
		
	}
	// verify that the field does not just contain spaces
	else if ((field.value.length != 0) && ( str == ""))
	{
		// alert the user of the problem
		alert( fieldname + " contains only spaces"  );

		// put focus on the form field
		field.focus();
		return false;
	}

// verify that the length of the field is not greater than the max or less than the min length	
	if ((field.value.lenghth < min) || (field.value.lenghth > max))
	{
		// alert the user of the error
		if (min == max)
			alert(fieldname + " must be " + max + " characters long");
		else
			alert(fieldname + " must be between " + min + " and " + max + " characters long" + field.value.length);

		// put focus on the form field
		field.focus();
		return false;
		
	}

	// no problems. return success
	else return true;
}

function RemoveBad(strTemp) 
{ 
    strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,""); 
    return strTemp;
} 


function isEmail(emailString)
{
  var fullEmail = emailString.value;
  if (fullEmail == "") {
    alert("\nPlease enter your Internet e-mail address.")
    emailString.focus();
    return false;
  }
  if (fullEmail.indexOf (" ",0) == -1) {}
  else {
    alert("\nYour e-mail address cannot contain spaces.\n\nPlease re-enter your e-mail address.")
    emailString.select();
    emailString.focus();
    return false;
  }
  if (fullEmail.indexOf ("@",0) == -1 || fullEmail.indexOf (".",0) == -1) {
    alert("\nYour e-mail address requires that a \"@\" and a \".\" be used.\n\nPlease re-enter your e-mail address.")
    emailString.select();
    emailString.focus();
    return false;
  }
  else
    if (fullEmail.length < 8 || fullEmail.substring((fullEmail.length - 1),(fullEmail.length)) == "." ||  fullEmail.substring(0,1) == "@")
    {
    alert("\nYour e-mail address is invalid.\n\nPlease re-enter your e-mail address.")
    emailString.select();
    emailString.focus();
    return false;
    }
  else
    {
    return true;
    }
}


