﻿
function VerifyEntries() {
//updated 1/16/2004 to combat SQL injection

//	define variables
	var loginName
	var strEmail
	var userName
	var companyName
	var phoneNumber
	var zipCode

//	set varible values
	loginName = document.LoginForm.LoginName.value
	strEmail = document.LoginForm.EmailAddress.value
	userName = document.LoginForm.UserName.value
	companyName = document.LoginForm.CompanyName.value
	phoneNumber = document.LoginForm.Phone.value
	zipCode = document.LoginForm.ZipCode.value

//	check login name - disallow blank username, <6 or >15 char entries, special characters
	if (loginName == "") {
		alert('You must enter a login name.');
		document.LoginForm.LoginName.focus();
		return false;
	}
	if (loginName.length < 6 || loginName.length > 15 ) {
		alert('The Login name must be between 6 and 15 characters long.');
		document.LoginForm.LoginName.focus();
		return false;
	}
	if (CheckExtendedASCII(loginName) == false) {
		alert('The Login name may only contain alpha and numeric characters. Special characters are not allowed.')
		document.LoginForm.LoginName.focus();
		return false;
	}
	
//	check email - disallow blanks, 85+ char entries, emailCheck handles special characters
	if (strEmail == "") {
		alert('You must enter your Email Address.');
		document.LoginForm.Email.focus();
		return false;
	}
	if (strEmail.length > 85) {
		alert('The email address cannot be more than 85 characters long.');
		document.LoginForm.Email.focus();
		return false;
	}
	if (emailCheck(strEmail) == false) {	
		alert('The email address provided cannot be processed.');
		document.LoginForm.Email.focus();
		return false;
	}
	
//	check User name - disallow 40+ char entries, some special characters
//  handle apostrophe with DoubleApostrophe	function at server
	if (userName.length > 40) {
		alert('The last name cannot be more than 40 characters long.');
		document.LoginForm.LastName.focus();
		return false;
	}
	if (CheckASCII_ProperName(userName) == false) {
		alert('The last name may not contain special characters.')
		document.LoginForm.LastName.focus();
		return false;
	}

//	check company name - disallow 50+ char entries, some special characters 
//  handle apostrophe with DoubleApostrophe	function at server
	if (companyName.length > 50) {
		alert('The Company name cannot be more than 50 characters long.');
		document.LoginForm.CompanyName.focus();
		return false;
	}
	if (CheckASCII_JobCompany(companyName) == false) {
		alert('The Company name may not contain special characters.')
		document.LoginForm.CompanyName.focus();
		return false;
	}
	
//	check phone - non-numerics handled by input box, disallow 20+ char entries, ' 
	if (phoneNumber.length > 20) {
		alert('The phone number cannot be more than 20 characters long.');
		document.LoginForm.Phone.focus();
		return false;
	}
	if (CheckASCII_PhoneFax(phoneNumber) == false) {
		alert('The Phone Number may not contain special characters.')
		document.LoginForm.Phone.focus();
		return false;
	}
	
//	check zip - disallow blanks, 12+ char entries, special characters
	if (zipCode.length > 12) {
		alert('The Zip code cannot be more than 12 characters long.');
		document.LoginForm.ZipCode.focus();
		return false;
	}
	if (CheckASCII_Zip(zipCode) == false) {
		alert('The Zip Code may not contain special characters.')
		document.LoginForm.ZipCode.focus();
		return false;
	}
	
	document.LoginForm.OKToSend.value="True"
	document.LoginForm.submit()
}

function SetFocus() {
	document.LoginForm.LoginName.focus();
}
