<!--
//if you want to have email validation the name of that form field must be "email"
//otherwise any form field names are acceptable

//checks to make certain important info has been input

function checkForInfo(f,r,formname) {
	r = r.split(",")
	var sError = "";
if (formname == "TBSignUp") {
        var realNames = ['first name','last name','email address','verify email address','contact by email'];
} else {
        var realNames = ['first name','last name','email address','job title','company name','company address','city','zip','phone','verify email address', 'contact by email'];
}
	for (j=0;j<r.length;j++){
		if (r[j] == "contact"){
			if (!(f.contact[0].checked) && !(f.contact[1].checked)){
				if (sError == "") {
					sError = "The following information is required:\n"
					sError = sError + realNames[j] + "\n"
				} else {
					sError = sError + realNames[j] + "\n"
				}
			}
		}else if ((f[r[j]].name == "email")){
			if ((f[r[j]].value == "")){
				if (sError == "") {
					sError = "The following information is required:\n"
					sError = sError + realNames[j] + "\n"
				} else {
					sError = sError + realNames[j] + "\n"
				}
			} else if (!isEmail(f[r[j]].value)){
				if (sError == "") {
					sError = "You must supply a valid email address\n"
				} else {
					sError = sError + "a valid email address\n"
				}
			}
		} else if ((f[r[j]].value == "")){
			if (sError == "") {
				sError = "The following information is required:\n"
				sError = sError + realNames[j] + "\n"
			} else {
				sError = sError + realNames[j] + "\n"
			}
		}
	}
	if (f.verifyemail.value != f.email.value){
		if (sError == "") {
			sError = "Your email address did not match:\n"
		} else {
			sError = sError + "email address and verify email address fields do not match\n"
		}
	}
	if (!sError) return true;
	if (sError) {
                window.location="#details";
		alert(sError);
                
		return false;
	}
}
// check for valid email
function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }

  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}
//-->
