<!--
/*

 -------------------------------------------------------------------------------
|  Copyright (C) 2004 Azalea Technology. All rights reserved.                   |
|-------------------------------------------------------------------------------|
|  Unauthorized removal of this notice is considered a violation of the         |
|  license agreement under which this Code may be used. This work is protected  |
|  under United States copyright law and the similiar law(s) of other countries |
|  under which such as work is afforded legal protection, and upon conviction   |
|  of such a violation in a court of applicable jurisdiction, such person(s)    |
|  may be subject to the maximum allowable penalty as permitted under such law. |
|-------------------------------------------------------------------------------|
|  You acknowledge and agree that information presented to you through this     |
|  site (the "Web Site") is protected by all applicable copyrights, trademarks, |
|  service marks, patents or other proprietary rights and laws, and by virute   |
|  of accessing the Web Site, except as expressly authorized by the Azalea      |
|  Technology, LLC., you agree not to modify, rent, lease, loan, sell,          |
|  distribute, store, or create derivative works based on the Web Site, in      |
|  whole or in part.                                                            |
 -------------------------------------------------------------------------------

 Organization: MHC X-Ploration Corporation
       Domain: www.mhcexploration.com, www.mhcxploration.com
      Purpose: Form validation functions
	     Date: Monday, March 15, 2004 11:02 PM CST
   Programmer: Benjamin Roberts (broberts@azaleatech.com)
               Azalea Technology, LLC.
               P.O. Box 131150
			   Tyler, TX 75713-1150
*/

// MAIN PROGRAM - VALIDATES FORM
function validate(form_obj){
	var errors = false;
	var errorcnt = 0;
	var message;
		message  = "Form Validation Error Message\n\n";
		message += "Your information cannot be sent because of the\n";
		message += "following errors.  Please correct these errors\n";
		message += "and try again.\n"; 
		message += "_______________________________________________\n";
		
	toggleFormButtonLock(form_obj,true,"Processing...");
	form_obj._config_javascript_status.value = "enabled";

	if(isSpace(form_obj.Name.value)){
		message += "\n(" + (++errorcnt) + ") Invalid or missing name";
		form_obj.Name.focus();
		form_obj.Name.select();
		errors=true;
	}
	else form_obj.Name.value=toProperCase(form_obj.Name.value);

	
	if(!validEmail(form_obj.Email.value)){
		message += "\n(" + (++errorcnt) + ") Invalid or missing email address";
		form_obj.Email.focus();
		form_obj.Email.select();
		errors=true;
	}
	else form_obj.Email.value=form_obj.Email.value.toLowerCase().replace(/ /g,"");
	
		
	if(isSpace(form_obj.Message.value)){
		message += "\n(" + (++errorcnt) + ") Invalid or missing message";
		form_obj.Message.focus();
		form_obj.Message.select();
		errors=true;
	}
	else form_obj.Message.value=trim(form_obj.Message.value);

	if(errors){
		message += "\n\n" + errorcnt + " error";
		if(errorcnt>1) message += "s";
		message += " detected";
		alert(message);
		toggleFormButtonLock(form_obj,false,"Send");
		form_obj._config_javascript_status.value = "disabled";
		return false;
	}
	else if(!errors){
		var message;
			message  = "Reply-to Email Address Confirmation\n";
			message += "_______________________________________________\n\n";
			message += "Please confirm that:\n\n";
			message +=  form_obj.Email.value + " \n\n";
			message += "is your correct email address. Please note that\n";
			message += "this email address MUST be able to receive incoming\n";
			message += "internet email or you will NOT receive your confirmation.\n";
			message += "Enter only ONE email address.\n\n";
			message += "Thank you,\nMHC X-Ploration Corporation";
			message += "_______________________________________________\n\n";

		if(confirm(message)) return true;
		else{
			toggleFormButtonLock(form_obj,false,"Send");
			form_obj._config_javascript_status.value = "disabled";
			return false;
		}
	}
}
	
//-->
