function checkForm(formId) {
    var sendIt;
    var badInput;
    if (document.getElementById) {
        var contactForm = document.getElementById(formId);
        if (contactForm.length) {
            for (var i = 0; i < contactForm.length; i++) {
                // check to see if the input element has a name ending with '_'. we use that char to mark required input
                var inputElm = contactForm.elements.item(i);
                if (inputElm.name.indexOf('_') == (inputElm.name.length - 1)) {
                    // make sure this input has a value
                    if (inputElm.value.length == 0 || inputElm.value == '') {
                        badInput = inputElm;
                        break;
                    }
                }
            }
            sendIt = (i == contactForm.length) ? true : false;
        }
    }
    
    if (!sendIt) {
        var msg = new String();
        if (badInput.nodeType == 1 && badInput.alt != ''&& badInput.alt != null) {
            msg = badInput.alt;
        } else {
            msg = 'Please complete all required fields.'+"\n"+'Required fields are marked with an \'*\'';
        }
        alert(msg);
    }
    return sendIt;
}