﻿// JScript File
function checkfrm(theform){
    var badform = false;
    var msg = "";
        if(theform.County.value==""){
            badform = true;
            theform.County.style.background = "yellow"
            msg = msg + "Please enter your county.\n";
        }else{
            theform.County.style.background = "white"
        }
        if(theform.District.value==""){
            badform = true;     
            theform.District.style.background = "yellow"
            msg = msg + "Please enter your school district.\n";
        }else{
            theform.District.style.background = "white"
        }
        if(theform.LName.value==""){
            badform = true;
            theform.LName.style.background = "yellow"
            msg = msg + "Please enter your last name.\n";
        }else{
            theform.LName.style.background = "white"
        }
        if(theform.FName.value==""){
            badform = true;
            theform.FName.style.background = "yellow"
            msg = msg + "Please enter your first name.\n";
        }else{
            theform.FName.style.background = "white"
        }
        if(theform.SchoolName.value==""){
            badform = true;
            theform.SchoolName.style.background = "yellow"
            msg = msg + "Please enter your school name.\n";
        }else{
            theform.SchoolName.style.background = "white"
        }
        if(theform.Position.value==""){
            badform = true;
            theform.Position.style.background = "yellow"
            msg = msg + "Please enter your position.\n";
        }else{
            theform.Position.style.background = "white"
        }
        if(theform.SAddress.value==""){
            badform = true;
            theform.SAddress.style.background = "yellow"
            msg = msg + "Please enter your school address.\n";
        }else{
            theform.SAddress.style.background = "white"
        }
        if(theform.SCity.value==""){
            badform = true;
            theform.SCity.style.background = "yellow"
            msg = msg + "Please enter your school city/town.\n";
        }else{
            theform.SCity.style.background = "white"
        }
        if(theform.SState.value==""){
            badform = true;
            theform.SState.style.background = "yellow"
            msg = msg + "Please enter your school state.\n";
        }else{
            theform.SState.style.background = "white"
        }
        if(theform.SZip.value==""){
            badform = true;
            theform.SZip.style.background = "yellow"
            msg = msg + "Please enter your school zip.\n";
        }else{
            theform.SZip.style.background = "white"
        }
        var wphonebad = false;
        if(theform.WPhoneArea.value==""){
            wphonebad = true;
            badform = true;
            theform.WPhoneArea.style.background = "yellow"
            theform.WPhone1.style.background = "yellow"
            theform.WPhone2.style.background = "yellow"
            msg = msg + "Please enter your work phone number.\n";
        }else{
            theform.WPhoneArea.style.background = "white"
        }
        if(wphonebad == false){
            if(theform.WPhone1.value==""){
                wphonebad = true;
                badform = true;
                theform.WPhoneArea.style.background = "yellow"
                theform.WPhone1.style.background = "yellow"
                theform.WPhone2.style.background = "yellow"
                msg = msg + "Please enter your work phone number.\n";
            }else{
                theform.WPhone1.style.background = "white"
            }
        }
        if(wphonebad == false){
            if(theform.WPhone2.value==""){
                badform = true;
                wphonebad = true;
                theform.WPhoneArea.style.background = "yellow"
                theform.WPhone1.style.background = "yellow"
                theform.WPhone2.style.background = "yellow"
                msg = msg + "Please enter your work phone number.\n";
            }else{
                theform.WPhone2.style.background = "white"
            }
        }        
        if(theform.HAddress.value==""){
            badform = true;
            theform.HAddress.style.background = "yellow"
            msg = msg + "Please enter your home address.\n";
        }else{
            theform.HAddress.style.background = "white"
        }
        if(theform.HCity.value==""){
            badform = true;
            theform.HCity.style.background = "yellow"
            msg = msg + "Please enter your home city.\n";
        }else{
            theform.HCity.style.background = "white"
        }
        if(theform.HState.value==""){
            badform = true;
            theform.HState.style.background = "yellow"
            msg = msg + "Please enter your home state.\n";
        }else{
            theform.HState.style.background = "white"
        }
        if(theform.HZip.value==""){
            badform = true;
            theform.HZip.style.background = "yellow"
            msg = msg + "Please enter your home zip.\n";
        }else{
            theform.HZip.style.background = "white"
        }
        var hphonebad = false;
        if(theform.HPhoneArea.value==""){
            badform = true;
            hphonebad = true;
            theform.HPhoneArea.style.background = "yellow"
            theform.HPhone1.style.background = "yellow"
            theform.HPhone2.style.background = "yellow"
            msg = msg + "Please enter your home phone number.\n";
        }else{
            theform.HPhoneArea.style.background = "white"
        }
        if(hphonebad==false){
            if(theform.HPhone1.value==""){
                badform = true;
                hphonebad = true;
                theform.HPhoneArea.style.background = "yellow"
                theform.HPhone1.style.background = "yellow"
                theform.HPhone2.style.background = "yellow"
                msg = msg + "Please enter your home phone number.\n";
            }else{
                theform.HPhone1.style.background = "white"
            }
        }
        if(hphonebad==false){
            if(theform.HPhone2.value==""){
                badform = true;
                hphonebad = true;
                theform.HPhoneArea.style.background = "yellow"
                theform.HPhone1.style.background = "yellow"
                theform.HPhone2.style.background = "yellow"
                msg = msg + "Please enter your home phone number.\n";
            }else{
                theform.HPhone2.style.background = "white"
            }        
        }
        if(theform.DOB.value==""){
            badform = true;
            theform.DOB.style.background = "yellow"
            msg = msg + "Please enter your date of birth.\n";
        }else{
            theform.DOB.style.background = "white"
        }
        if(theform.BeneLastName.value==""){
            badform = true;
            theform.BeneLastName.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's last name.\n";
        }else{
            theform.BeneLastName.style.background = "white"
        }
        if(theform.BeneFirstName.value==""){
            badform = true;
            theform.BeneFirstName.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's first name.\n";
        }else{
            theform.BeneFirstName.style.background = "white"
        }
        if(theform.BeneRelationship.value==""){
            badform = true;
            theform.BeneRelationship.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's relationship.\n";
        }else{
            theform.BeneRelationship.style.background = "white"
        }
        if(theform.BeneCity.value==""){
            badform = true;
            theform.BeneCity.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's city.\n";
        }else{
            theform.BeneCity.style.background = "white"
        }
        if(theform.BeneState.value==""){
            badform = true;
            theform.BeneState.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's state.\n";
        }else{
            theform.BeneState.style.background = "white"
        }
        if(theform.BeneZip.value==""){
            badform = true;
            theform.BeneZip.style.background = "yellow"
            msg = msg + "Please enter your beneficiary's zip.\n";
        }else{
            theform.BeneZip.style.background = "white"
        }
    if (badform == true){
        alert(msg);
    }else{
        theform.submit();
    }    
}

