////// Define all the functions used to enhance the page "index.php".



//// Validate the Sign-up Form.
function validateForm(theForm)
    {
    if (theForm.NAME_GIVEN.value == "")
        {
        alert("Please enter your given (first) name.");
        theForm.MESSAGE.focus();
        return (false);
        }
    else if (theForm.NAME_FAMILY.value == "")
        {
        alert("Please enter your family (last) name.");
        theForm.NAME_FAMILY.focus();
        return (false);
        }
    else if (theForm.EMAIL.value == "")
        {
        alert("Please your email address.");
        theForm.EMAIL.focus();
        return (false);
        }
    else if (theForm.CITY.value == "")
        {
        alert("Please your city.");
        theForm.CITY.focus();
        return (false);
        }
    else if (theForm.STATE.options[theForm.STATE.selectedIndex].value == "")
        {
        alert("Please select your state, or select \"other\" if outside the US.");
        theForm.CITY.focus();
        return (false);
        }
    else
        {
        return (true);
        }
    }


////// Assign behaviors to particular forms.
function setFormsOnePage()
    {
    if (document.getElementById)
        {
        // Check for forms that require special behaviors.

        // Sign-up Form.
        var theForm = document.getElementById("signup");
        if (theForm != null)
            {
            theForm.onsubmit = function()
                {
                var formResult = validateForm(theForm);
                if (formResult) { return true; } else { return false; }
                }
            }
        }
    }



////// Call all the functions used to enhance this page.
addToPage(setFormsOnePage);