/*
just do something like:
<script language="javascript" src="http://qconline.com/home/js/parse_form_fields.js"></script>
<form name="myform" action="#" method="post" ONSUBMIT="return parse_form_fields('field1,field2,field3,..');">
hint: make sure all required fields have "id='fieldname' for the getelementbyid attribute to work right
hint: a field's 'id' does NOT have to match the field's 'name'
*/
function parse_form_fields(mycheckfields){
	
	//var checkfields=new Array("name","address","phone");
	var checkfields = mycheckfields.split(",");
	var error_message = "";

	for (i=0;i<checkfields.length;i++){
		if(!document.getElementById(checkfields[i]).value){
			error_message = error_message + "\n- " + checkfields[i];
			document.getElementById(checkfields[i]).style.border = '2px solid #CA0715';
		}
	}
	if(error_message==""){
		return true;
	}
	else{
		alert ('Please make sure you filled out the following required fields: ' + error_message);
		return false;
	}
}

