function buildTop(image) {

     document.write("<table width=775 border=0 cellpadding=0 cellspacing=0>");
     document.write("<tr><td align=left>");
     document.write("<DIV class='titlebox'><table border=0 cellpadding=0 cellspacing=0>");
     document.write("<table border=0 width=765 cellpadding=0 cellspacing=0><td><img height=100 src="+image+" width=765 border=0></td>");
     document.write("</tr></table></DIV></td></tr></table>");

     document.write("<table width=775 border=0 cellpadding=0 cellspacing=0>");
     document.write("<tr><td align='left' valign='top'>");
     document.write("<DIV class='links'>");
     document.write("<table border=0 width=765><tr><td><a CLASS=links href='index.htm'>Home</a></td><td>");
     document.write("<a CLASS=links href='news_archive.htm'>Newsletter Archives</a></td><td>");
     document.write("<a CLASS=links href='staff.htm'>About Us</a></td><td>");
     document.write("<a CLASS=links href='links.htm'>Links</a></td><td>");
     document.write("<a CLASS=links href='fun.htm'>Fun Stuff</a></td><td>");
     document.write("<a CLASS=links href='contact.htm'>Contact Us</a></td><td>");
     document.write("<a CLASS=links href='clients.htm'>Pay Bill</a></td></tr></table></DIV>");
     document.write("</td></tr></table>");
     document.write("<DIV class='body'>");
     document.write("<table border=0 width=100% height=100%><tr><td valign=top>");

}

function buildBottom() {
     document.write("</td></tr><tr><td colspan=2 align=center valign=bottom><table border=0 width=100%><tr>");
     document.write("<td align=center><a href='index.htm'>Home</a></td><td> - </td>");
     document.write("<td align=center><a href='news_archive.htm'>Newsletter Archives</a></td><td> - </td>");
     document.write("<td align=center><a href='staff.htm'>The Staff</a></td><td> - </td>");
     document.write("<td align=center><a href='links.htm'>Links</a></td><td> - </td>");
     document.write("<td align=center><a href='fun.htm'>Fun Stuff</a></td><td> - </td>");
     document.write("<td align=center><a href='contact.htm'>Contact Us</a></td><td> - </td>");
     document.write("<td align=center><a href='clients.htm'>Pay Bill</a></td>");
     document.write("</tr></table></td></tr></table>");
     document.write("</DIV>");
}



function checkFields(mailform) {
eMess = "\n You must provide"
data2 = mailform.name.value 
if (data2.length <= 0) {
   eMess = eMess + "\n -your name"
}

if (!validEmail(mailform.address.value))  {
     eMess = eMess + "\n -A valid email address"
  }

data2 = mailform.subject.value 
if (data2.length <= 0) {
   eMess = eMess + "\n -An email subject"
}

data2 = mailform.inquiry.value 
if (data2.length <= 0) {
   eMess = eMess + "\n -a message"
}

if (eMess.length >= 20) {
    alert ("The following errors occured when trying to process your form:" +eMess)
    return false
    }

    return true
} 

function validEmail(email) { 
    invalidChars = " /:,;"

    if (email == "") {
        return false
    }

    for(i=0; i<invalidChars.length; i++) {
        badChar = invalidChars.charAt(i)
        if(email.indexOf(badChar,0) > -1) {
            return false
        }
    }

    atPos = email.indexOf("@",1)
    if(atPos == -1) {
        return false
    }

    if(email.indexOf("@",atPos+1) > -1) {
        return false
    }

    periodPos = email.indexOf(".",atPos)
    if(periodPos == -1) {
        return false
    }

    if(periodPos+3 > email.length) {
        return false
    }

    return true
} 