function StartVerify() {
    // first check required fields
    if ( ValidateFields() ) {
        // then initiate recaptch check
        CheckReCaptcha();
    } // if
} // function

//Gets the browser specific XmlHttpRequest Object
function getXmlHttpRequestObject() {
    if (window.XMLHttpRequest) {
        return new XMLHttpRequest();
    } else if(window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        alert("Your web browser does not support this feature.  We apologize for the inconvenience.  Please use another method to select your project.");
    }
}

// create on xmlhttp request object to use on this page for search requests
var ajaxRequest = getXmlHttpRequestObject();

// initiate an ajax call to search for projects matching the search crtieria, set ProcessSaearchResults as the function to call when complete
function CheckReCaptcha() {
    if (ajaxRequest.readyState == 4 || ajaxRequest.readyState == 0) {
        var challengeField = escape(document.getElementById('recaptcha_challenge_field').value);
        var responseField = escape(document.getElementById('recaptcha_response_field').value);
        ajaxRequest.open("GET", '/ajax_recaptcha_check.php?recaptcha_challenge_field=' + challengeField + '&recaptcha_response_field=' + responseField, true);
        ajaxRequest.onreadystatechange = ProcessReCaptchaResults;
        ajaxRequest.send(null);
    }
} // function SuggestProjects()

// display the search results on the screen
function ProcessReCaptchaResults() {
    if (ajaxRequest.readyState == 4) {
        var resultDiv = document.getElementById('resultArea');
        //alert(ajaxRequest.responseText);
        // check active conversion and if good, then post
        if (ajaxRequest.responseText == '1') {
            var theForm = document.getElementById('acForm');
            theForm.submit();
        } else {
            alert('Please try re-entering the verification text (reCAPTCHA).');
        } // if
    }
}

function get(id) {
    if (typeof id == "string") {
        return document.getElementById(id);
    } else {
        return id;
    }
}

function ValidateFields() {
    var e = false;
    e = get('fullName');
    if (e.value == "") {
        alert('Please enter a value for the \'Your Name\' field.');
        return false;
    }
    e = get('email');
    if (e.value == "") {
        alert('Please enter a value for the \'Your Email\' field.');
        return false;
    }
    e = get('phone');
    if (e.value == "") {
        alert('Please enter a value for the \'Your Phone\' field.');
        return false;
    }
    return true;
}