function commentssug() {

var firstname=document.sug.FirstName.value;
var lastname=document.sug.LastName.value;
var email=document.sug.Email.value;
var subject=document.sug.Subject.value;
var comments=document.sug.Comments.value;

if(firstname==""){
alert("Please enter your first name.");
document.sug.FirstName.focus();
return false;
}
if(lastname==""){
alert("Please enter your last name.");
document.sug.LastName.focus();
return false;
}
var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.sug.Email.focus();
return false;
}
if(subject==""){
alert("Please enter a subject.");
document.sug.Subject.focus();
return false;
}
if(comments==""){
alert("Please enter your comments.");
document.sug.Comments.focus();
return false;
}
if(comments.length > 5000){
alert("Please keep your comments under 5000 characters.");
document.sug.Comments.focus();
return false;
}
return true;
}
function requestinfo() {

var firstname=document.info.FirstName.value;
var lastname=document.info.LastName.value;
var address=document.info.Address1.value;
var city=document.info.City.value;
var state=document.info.State.selectedIndex;
var zipcode=document.info.Zip.value;
var email=document.info.Email.value;
var dayphone=document.info.DayPhone.value;
var eveningphone=document.info.EveningPhone.value;
var findus=document.info.FindUs.selectedIndex;
var comments=document.info.Comments.value;

if(firstname==""){
alert("Please enter your first name.");
document.info.FirstName.focus();
return false;
}
if(lastname==""){
alert("Please enter your last name.");
document.info.LastName.focus();
return false;
}
if(address==""){
alert("Please enter your address.");
document.info.Address1.focus();
return false;
}
if(city==""){
alert("Please enter your city.");
document.info.City.focus();
return false;
}
if(state==0){
alert("Please select your state.");
document.info.State.focus();
return false;
}
if(zipcode.length < 5){
alert("Please enter your 5 digit zip code.");
document.info.Zip.focus();
return false;
}
var zipcodecheck=numbersonly(zipcode);
if(zipcodecheck=="no"){
alert("You can only enter numbers for the zip code.");
document.info.Zip.focus();
return false;
}
var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.info.Email.focus();
return false;
}
if(dayphone!="") {
var phonecheck=numbersonly(dayphone);
if(phonecheck=="no"){
alert("Please enter the day phone number as numbers only e.g. xxx-xxx-xxxx would be xxxxxxxxxx.");
document.info.DayPhone.focus();
return false;
}
if(dayphone.length < 10){
alert("The day phone number must contain 10 numbers including the area code.");
document.info.DayPhone.focus();
return false;
}
}
if(eveningphone!="") {
var phonecheckevening=numbersonly(eveningphone);
if(phonecheckevening=="no"){
alert("Please enter the evening phone number as numbers only e.g. xxx-xxx-xxxx would be xxxxxxxxxx.");
document.info.EveningPhone.focus();
return false;
}
if(eveningphone.length < 10){
alert("The evening phone number must contain 10 numbers including the area code.");
document.info.EveningPhone.focus();
return false;
}
}
if(findus==0 || findus==1){
alert("Please select how you heard about our website.");
document.info.FindUs.focus();
return false;
}
if(comments==""){
alert("Please enter your comments.");
document.info.Comments.focus();
return false;
}
if(comments.length > 5000){
alert("Please keep your comments under 5000 characters.");
document.info.Comments.focus();
return false;
}
return true;
}
function emailphoto() {

var rname=document.emphot.RName.value;
var remail=document.emphot.REmail.value;
var yname=document.emphot.YName.value;
var yemail=document.emphot.YEmail.value;
var subject=document.emphot.Subject.value;
var message=document.emphot.Message.value;

if(rname==""){
alert("Please enter the recipients name.");
document.emphot.RName.focus();
return false;
}
var emailcheck=checkemail(remail);
if(emailcheck!=null){
alert(emailcheck);
document.emphot.REmail.focus();
return false;
}
if(yname==""){
alert("Please enter your name.");
document.emphot.YName.focus();
return false;
}
var emailchecky=checkemail(yemail);
if(emailchecky!=null){
alert(emailchecky);
document.emphot.YEmail.focus();
return false;
}
if(subject==""){
alert("Please enter a subject.");
document.emphot.Subject.focus();
return false;
}
if(message==""){
alert("Please enter your personalized message.");
document.emphot.Message.focus();
return false;
}
if(message.length > 500){
alert("Please keep your personalized message under 500 characters.");
document.emphot.Message.focus();
return false;
}
return true;
}
function register() {

var firstname=document.reg.FirstName.value;
var lastname=document.reg.LastName.value;
var address=document.reg.Address.value;
var city=document.reg.City.value;
var state=document.reg.State.selectedIndex;
var zipcode=document.reg.ZipCode.value;
var phone=document.reg.Phone.value;
var email=document.reg.Email.value;
var password=document.reg.Password.value;
var passwordverify=document.reg.PasswordVerify.value;
var findus=document.reg.HearAbout.selectedIndex;

if(firstname==""){
alert("Please enter your first name.");
document.reg.FirstName.focus();
return false;
}
if(lastname==""){
alert("Please enter your last name.");
document.reg.LastName.focus();
return false;
}
if(address==""){
alert("Please enter your address.");
document.reg.Address.focus();
return false;
}
if(city==""){
alert("Please enter your city.");
document.reg.City.focus();
return false;
}
if(state==0){
alert("Please select your state.");
document.reg.State.focus();
return false;
}
if(zipcode.length < 5){
alert("Please enter your 5 digit zip code.");
document.reg.ZipCode.focus();
return false;
}
var zipcodecheck=numbersonly(zipcode);
if(zipcodecheck=="no"){
alert("You can only enter numbers for the zip code.");
document.reg.ZipCode.focus();
return false;
}
var phonecheck=numbersonly(phone);
if(phonecheck=="no"){
alert("Please enter the phone number as numbers only e.g. xxx-xxx-xxxx would be xxxxxxxxxx.");
document.reg.Phone.focus();
return false;
}
if(phone.length < 10){
alert("The phone number must contain 10 numbers including the area code.");
document.reg.Phone.focus();
return false;
}
var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.reg.Email.focus();
return false;
}
if(password.length < 4){
alert("Your password must contain at least 4 characters.");
document.reg.Password.focus();
return false;
}
if(password!=passwordverify){
alert("Your confirmation password must match your password.");
document.reg.Password.focus();
return false;
}
if(findus==0 || findus==1){
alert("Please select how you heard about our website.");
document.reg.HearAbout.focus();
return false;
}
return true;
}
function register3() {

var landlocation=document.reg.LandLocation.selectedIndex;

if(landlocation==0){
alert("Please choose an area.");
document.reg.LandLocation.focus();
return false;
}
return true;
}
function register4() {

var email=document.reg.Email.value;

var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.reg.Email.focus();
return false;
}
return true;
}
function login() {

var email=document.lgin.Email.value;
var password=document.lgin.Password.value;

var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.lgin.Email.focus();
return false;
}
if(password.length < 4){
alert("Hint: Your password is at least 4 characters.");
document.lgin.Password.focus();
return false;
}
return true;
}
function loginemail() {

var email=document.lgineml.Email.value;

var emailcheck=checkemail(email);
if(emailcheck!=null){
alert(emailcheck);
document.lgineml.Email.focus();
return false;
}
return true;
}
function numbersonly(numberstring) {
var valid = "0123456789"
var ok="yes";
var temp;
for (var i=0; i<numberstring.length; i++) {
temp = "" + numberstring.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
return ok;
   }
}
function checkemail(email){

var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var emailPat=/^(.+)@(.+)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var matchArray=email.match(emailPat);

if (email=="") {

var alertwindow ="An email address must be entered.";
return alertwindow;
}
if (matchArray==null) {

var alertwindow="Your email address seems incorrect (check @ and .'s)";
return alertwindow;
}
var user=matchArray[1];
var domain=matchArray[2];

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
var alertwindow="Your email username contains invalid characters.";
return alertwindow;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
var alertwindow="Your email domain name contains invalid characters.";
return alertwindow;
   }
}

if (user.match(userPat)==null) {
var alertwindow="Your email username doesn't seem to be valid.";
return alertwindow;
}

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {
for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
var alertwindow="Your email destination IP address is invalid!";
return alertwindow;
   }
}
return true;
}
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
var alertwindow="Your email domain name does not seem to be valid.";
return alertwindow;
   }
}
if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
var alertwindow="Your email address must end in a well-known domain or two letter " + "country.";
return alertwindow;
}
if (len<2) {
var alertwindow="Your email address is missing a hostname!";
return alertwindow;
}
}
