function validateForm() {
	
	// loop through all of the elements of class required, and see if they have a value or a selected index.
	
		//alert('Called validateForm()');
	
	  var error = false;
	
	  var all = document.all ? document.all : document.getElementsByTagName('*');
						  
	  for (var e = 0; e < all.length; e++) {
													 
			if (all[e].className.search('required') != -1 ) {
			
				//alert('Found Required: '+all[e].id+'  Type: '+all[e].type+' \nValue: '+all[e].value+' SelectedIndex: '+all[e].selectedIndex);
				
				if (all[e].value == "" || all[e].selectedIndex == 0) {
				
					//alert('Found Unfilled Required');
				
					var bad_id = all[e].id;
					
					if (bad_id == 'email' || bad_id == 'first_name' || bad_id == 'last_name' || bad_id == 'company') {
					
						var highlight_id = 'p_'+bad_id;
					
						error = true;
					
						}	
					else {
					
						var id_array = bad_id.split('_');
						
						var highlight_id = 'p_id_'+id_array[1];
					
						error = true;
					
						}
						
					if (error == true) {
					
						document.getElementById(highlight_id).style.color='#FF0000';
						document.getElementById(bad_id).style.borderColor ='#FF0000';
						document.getElementById(bad_id).style.borderStyle ='solid';
						document.getElementById(bad_id).style.borderWidth ='1px';
						
						}
									
					}  // end if not filled
	
				} // end if required
			  
			}  // end for loop through all.length
			
	var yoyo_value = "";
	
	var first_name = document.getElementById('first_name').value;
	var last_name = document.getElementById('last_name').value;
	var total_name = last_name+first_name;
	
	for(x=0; x < total_name.length; x++) {
	
		char_code = total_name.charCodeAt(x);
		
		//alert('name part code: '+char_code);
		
		yoyo_value = yoyo_value + char_code;
	
		} 
	
	yoyo_value = parseInt(yoyo_value / total_name.length);
	
	//alert('Yoyo value: '+yoyo_value);
	
	document.getElementById('yoyo').value = yoyo_value;


	if (error == true) {
	
		document.getElementById('form_error').innerHTML = "You did not fill out one or more required fields on this form.  So that we may serve you better, please fill out the indicated fields before submitting this form.";
		document.getElementById('form_error').style.display='block';
		
		return false;
		}

	

	}  // end function

