
function validate(){
  var errors = "";
  var vfocus = "";
  var cnt = 0;
  
	vTxT = /^[a-zA-Z0-9]{1,}/;
	if (!(vTxT.test(document.txtEntry.txt.value))) {
		cnt++;
		errors+= cnt+") Your Safer or No Sex entry field is a Required Field\n";
		document.txtEntry.txt.style.backgroundColor="#F1AE3A"; 
		vfocus="txt";
	} else {document.txtEntry.txt.style.backgroundColor="#cccccc";}
 
  vLongTxt = /^[a-zA-Z0-9]{1}/;
  if(!(vLongTxt.test(document.txtEntry.longtxt.value))) {
	cnt++;
	errors += cnt+") Full Entry field is a Required Field.\n";
	if(!(vfocus)) { vfocus = "longtxt"; }
	document.txtEntry.longtxt.style.backgroundColor="#F1AE3A";
  } else { document.txtEntry.longtxt.style.backgroundColor="#cccccc"; }
/*
  vSchool = /^[0-9]{1,}/;
  if(!(vSchool.test(document.txtEntry.sid.value))){
	cnt++;
	errors += cnt+") High School or Program is a Required Field.\n";
	if(!(vfocus)) { vfocus = "sid"; }
	document.txtEntry.sid.style.backgroundColor="#F1AE3A";
  } else { document.txtEntry.sid.style.backgroundColor="#cccccc"; }

  vGrade = /^[0-9a-zA-Z]{1,}/;
  if(!(vGrade.test(document.txtEntry.grade.value))){
	cnt++;
	errors += cnt+") Grade is a Required Field.\n";
	if(!(vfocus)) { vfocus = "grade"; }
	document.txtEntry.grade.style.backgroundColor="#F1AE3A";
  } else { document.txtEntry.grade.style.backgroundColor="#cccccc"; }
  
  if(document.txtEntry.cr.checked != 1){
	cnt++;
	errors += cnt+") You must agree to the Contest Rules.\n";
	document.txtEntry.cr.style.color="#F1AE3A";
  } else { document.txtEntry.cr.style.color="#cccccc"; }
*/
  //Print Out the Errors or Submit Form for Processing
  if (errors) {
	var aerrors=errors;
	errors="";
    alert(cnt+" ERROR(s):\n"+aerrors+"\n\nPlease correct all "+ cnt +" errors and resubmit.");
	return false;
  }
  else {
	//alert("no errors found");    	
	return true;
  }
}

function validateTxT(){
  var errors = "";
  var vfocus = "";
  var cnt = 0;
  
  
  if(document.txtEntry.fname.value){
	vName = /^[\w\s]{1,}$/;
	if (!(vName.test(document.txtEntry.fname.value))) {
		cnt++;
		errors+= cnt+") Your Name must be letters only.\n";
		document.txtEntry.fname.style.backgroundColor="#F1AE3A";
		vfocus="fname";
	} else {document.txtEntry.fname.style.backgroundColor="#cccccc";}
  }
 
  vTo = /^[0-9]{10}$/;
  if(!(vTo.test(document.txtEntry.to.value))) {
	cnt++;
	errors += cnt+") Your Friend's Cell Number is a Required Field.\n";
	if(!(vfocus)) { vfocus = "to"; }
	document.txtEntry.to.style.backgroundColor="#F1AE3A";
  } else { document.txtEntry.to.style.backgroundColor="#cccccc"; }

  vTxT = /^\W|\w{1,}/;
  if(!(vTxT.test(document.txtEntry.txt.value))){
	cnt++;
	errors += cnt+") TxT Message is a Required Field.\n";
	if(!(vfocus)) { vfocus = "txt"; }
	document.txtEntry.txt.style.backgroundColor="#F1AE3A";
  } else { document.txtEntry.txt.style.backgroundColor="#cccccc"; }

  if(document.txtEntry.message.value){
	vName = /^[\w|\W|\f|\n|\r|\s]{1,}$/;
	if (!(vName.test(document.txtEntry.message.value))) {
		cnt++;
		errors+= cnt+") Additional Message is an Optional Field, but and can only be word/sentence characters.\n";
		document.txtEntry.message.style.backgroundColor="#F1AE3A";
		vfocus="message";
	} else {document.txtEntry.message.style.backgroundColor="#cccccc";}
  }

  //Print Out the Errors or Submit Form for Processing
  if (errors) {
	var aerrors=errors;
	errors="";
    alert(cnt+" ERROR(s):\n"+aerrors+"\n\nPlease correct all "+ cnt +" errors and resubmit.");
	return false;
  }
  else {
	//alert("no errors found");    	
	return true;
  }
}
