function NatureOfInteractionCounter()	{
	var fMaxLimit = 1000;
	var fString = document.form.statement.value;
	var fLength = fString.length;
	if (fLength <= fMaxLimit) {
		document.form.NatureOfInteractionCharCount.value = fLength;
	}
	if (fLength > fMaxLimit) {
		var LimitedString = fString.substring(0, fMaxLimit);
		document.form.statement.value = LimitedString;
	}
}

function NominationJustificationCounter()	{
	var fMaxLimit = 3000;
	var fString = document.form.nominationJustification.value;
	var fLength = fString.length;
	if (fLength <= fMaxLimit) {
		document.form.NominationJustificationCharCount.value = fLength;
	}
	if (fLength > fMaxLimit) {
		var LimitedString = fString.substring(0, fMaxLimit);
		document.form.nominationJustification.value = LimitedString;
	}
}

function validate(thisform)
{
/*	var flag = true;
	with (thisform)
  {
  if (validate_required(first_name,"First name must be filled out.")==false)
  {first_name.focus();flag = false;}
  }*/
  
   var flag  = true;
   /*var email_str = document.form.email.value;
   var email_length = email_str.length;
   var email_sub = email_str.substr(email_length-13,13);*/
   
   //var first_name = document.getElementById('first_name').value;
   
	if (document.form.first_name.value == '') {
		document.getElementById('first_name').style.borderColor="red";
		if ( flag ){ document.form.first_name.focus(); }
		document.getElementById('req_name').style.color="red";
      	document.getElementById('req_name').innerHTML="*Please enter a first name.";
		flag = false;
	}
	else if (! /^[a-zA-Z ]+$/.test(document.form.first_name.value)) {
      	document.getElementById('first_name').style.borderColor="red";
		if ( flag ){ document.form.first_name.focus(); }
		document.getElementById('req_name').style.color="red";
      	document.getElementById('req_name').innerHTML="*Please enter a valid first name.";
      	flag = false;
	}
	else { 
		document.getElementById('first_name').style.borderColor="";
		document.getElementById('req_name').innerHTML="";
	}
	
	if (document.form.last_name.value == '') {
		document.getElementById('last_name').style.borderColor="red";
		if ( flag ){ document.form.last_name.focus(); }
		document.getElementById('req_last_name').style.color="red";
      	document.getElementById('req_last_name').innerHTML="*Please enter a last name.";
		flag = false;
	}
	else if (! /^[a-zA-Z ]+$/.test(document.form.last_name.value)) {
      	document.getElementById('last_name').style.borderColor="red";
		if ( flag ){ document.form.last_name.focus(); }
		document.getElementById('req_last_name').style.color="red";
      	document.getElementById('req_last_name').innerHTML="*Please enter a valid last name.";
      	flag = false;
	}
	else { 
		document.getElementById('last_name').style.borderColor="";
		document.getElementById('req_last_name').innerHTML="";
	}
	
	if (document.form.email.value == '') {
		document.getElementById('email').style.borderColor="red";
		if ( flag ){ document.form.email.focus(); }
		document.getElementById('req_email').style.color="red";
      	document.getElementById('req_email').innerHTML="*Please enter an E-Mail.";
		flag = false;
	}
	else if (! /^.+@.+\..{2,}$/.test(document.form.email.value)) {
		document.getElementById('email').style.borderColor="red";
		if ( flag ){ document.form.email.focus(); }
		document.getElementById('req_email').style.color="red";
      	document.getElementById('req_email').innerHTML="*Please enter a valid email";
	  	flag = false;
	}
	else if ( email_sub != 'csupomona.edu' ) {
		document.getElementById('email').style.borderColor="red";
		if ( flag ){ document.form.email.focus(); }
		document.getElementById('req_email').style.color="red";
      	document.getElementById('req_email').innerHTML="*Please enter your Cal Poly Email";
	  	flag = false;
	}
	else { 
		document.getElementById('email').style.borderColor="";
		document.getElementById('req_email').innerHTML="";
	}
	
	if (!(document.getElementById("undergrad").checked || document.getElementById("grad").checked)) {
		if ( flag ){ document.form.undergrad.focus(); }
		document.getElementById('req_type').style.color="red";
      	document.getElementById('req_type').innerHTML="*Please make a selection.";
		flag = false;
	}
	else { 
		document.getElementById('req_type').innerHTML="";
	}
	
	if ((document.form.nominator_department.value).toString() == "---Select Your Major---" ) {
		document.getElementById('nominator_department').style.borderColor="red";
		if ( flag ){ document.form.nominator_department.focus(); }
		document.getElementById('req_nominator_department').style.color="red";
      	document.getElementById('req_nominator_department').innerHTML="*Please make a selection.";
		flag = false;
	}
	else { 
		document.getElementById('nominator_department').style.borderColor="";
		document.getElementById('req_nominator_department').innerHTML="";
	}
	
	if ((document.form.nomineeName.value).toString() == "---Select---" ) {
		document.getElementById('nomineeName').style.borderColor="red";
		if ( flag ){ document.form.nomineeName.focus(); }
		document.getElementById('req_nomineeName').style.color="red";
      	document.getElementById('req_nomineeName').innerHTML="*Please make a selection.";
		flag = false;
	}
	else { 
		document.getElementById('nomineeName').style.borderColor="";
		document.getElementById('req_nomineeName').innerHTML="";
	}
	
	if (document.form.statement.value == '' ) {
		document.getElementById('statement').style.borderColor="red";
		if ( flag ){ document.form.statement.focus(); }
		document.getElementById('req_statement').style.color="red";
      	document.getElementById('req_statement').innerHTML="*Please enter a Statement of Nomination.";
		flag = false;
	}
	else {
		document.getElementById('statement').style.borderColor="";
		document.getElementById('req_statement').innerHTML="";
	}
	
	if (document.form.nominationJustification.value == '' ) {
		document.getElementById('nominationJustification').style.borderColor="red";
		if ( flag ){ document.form.nominationJustification.focus(); }
		document.getElementById('req_nominationJustification').style.color="red";
      	document.getElementById('req_nominationJustification').innerHTML="*Please enter a Nomination Justification.";
		flag = false;
	}
	else {
		document.getElementById('nominationJustification').style.borderColor="";
		document.getElementById('req_nominationJustification').innerHTML="";
	}

   return flag;
}


