function trim(str){
     return str.replace(/^\s*|\s(?=\s)|\s*$/g, "");
}

function requiredcheck(req, theform){
	//var invalidlist = new Array();
	for(var i in req){
		if(trim($("input[name='"+req[i]+"']").val()) == ""){
			//invalidlist.push(req[i]);
			alert("You must enter all required fields!");
			return true;
		}
	}
	theform.submit();
	/*
	if(invalidlist.length > 0){
		
	}
	*/
}

