function hidediv(div_id) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(div_id).style.display = 'none';
    }
    else {
        if (document.layers) { // Netscape 4
            eval("document."+div_id+".display = 'none'");
        }
        else { // IE 4
            eval("document.all."+div_id+".style.display = 'none'");
        }
    }
}

function showdiv(div_id) {
    if (document.getElementById) { // DOM3 = IE5, NS6
        document.getElementById(div_id).style.display = 'inline';
    }
    else {
        if (document.layers) { // Netscape 4
            eval("document."+div_id+".display = 'inline'");
        }
        else { // IE 4
            eval("document.all."+div_id+".style.display = 'inline'");
        }
    }
} 
function checkForm() {
    hidediv('pre_click');
    showdiv('post_click');
    var thisform = document.getElementById('emma_inquiry_form');
    /* var thisform = document.emma_inquiry_form; */

    var empty_field = /^\s*$/;

    if (empty_field.test(thisform.first_name.value)
        || empty_field.test(thisform.last_name.value)
        || empty_field.test(thisform.email.value)
        || empty_field.test(thisform.company.value)
        || empty_field.test(thisform.zipcode.value)) {
        hidediv('post_click');
        showdiv('pre_click');
        alert("Please fill out all of the required fields (marked with *) to continue!");
        return;
    }

    if (thisform.industry.selectedIndex == 0 
        || thisform.how_they_found_us.selectedIndex == 0) {
        hidediv('post_click');
        showdiv('pre_click');
        alert("Please fill out all of the required fields (marked with *) to continue!");
        return;
    }

    internal = /internal/.test(window.location.href);
    if (internal && thisform.inquiry_type.selectedIndex == 0) {
        hidediv('post_click');
        showdiv('pre_click');
        alert("Please fill out all of the required fields (marked with *) to continue!");
        return;
    }

    thisform.submit();
}
