var formId = "contentTable"; // The id that you give to your form
var reqClass = "required"; // The class that you give all required input fields

function validate() {
	var submitForm = true;
	var container = document.getElementById(formId);
	var allReq = getElementsByClassName(container,reqClass);
	for (var x = 0; x < allReq.length; x++) {
		var currReq = allReq[x];
		if (currReq.value == "") {
			submitForm = false;
			break;
		}
	}
	
	if (submitForm == false) {
		alert("Please fill out all required fields.");
		return false;
	} else {
		return true;
	}
}

function getElementsByClassName(parentElem,className){
	var elements = new Array();
	var allTags = parentElem.getElementsByTagName("*");

	for (var x = 0; x < allTags.length; x++) {
		if (allTags[x].className.indexOf(className) != -1) {
			elements.push(allTags[x]);
		}
	}
	if (elements.length > 0) {
		return elements;
	} else {
		return false;
	}
}