// City National Funding, Inc.
// http://www.citynationalfunding.com
// Author: Eric Grossnickle <eric@ericgrossnickle.com>

function isEmpty (strng, message) {
	var error = "";
	if (strng == "") {
		error = message;
	}
	return error;
}

function checkForm (formName) {
    var why = "";
	
	theForm = document.forms[formName];
	
	if (formName == "application") {
		why += isEmpty(theForm.firstname.value, "Enter your first name.\n");
		why += isEmpty(theForm.lastname.value, "Enter your last name.\n");
		why += isEmpty(theForm.address1.value, "Enter your address.\n");
		why += isEmpty(theForm.city.value, "Enter your city.\n");
		why += isEmpty(theForm.state.value, "Enter your state.\n");
		why += isEmpty(theForm.zip.value, "Enter your zip code.\n");
		why += isEmpty(theForm.phone.value, "Enter your phone number.\n");
	}
	else if (formName == "contact") {
		why += isEmpty(theForm.name.value, "Enter your name.\n");
		why += isEmpty(theForm.email.value, "Enter your email address.\n");
		why += isEmpty(theForm.comments.value, "Enter some comments.\n");
	}
	
	if (why != "") {
       alert(why);
       return false;
    }
	return true;
}