function validate_submission(form){
	// Variables
	var errorText = "";

	errorText += validate_name(form.thename);
	errorText += validate_email(form.thecontact);
	errorText += validate_company(form.thecompany);

	if(errorText != ""){
		alert(errorText);
		return false;
	} else {
        return true;
    }
} // END validate_submission

function validate_name(the_name){
	// Variables
	var err_text = "";

	// Not checking validity of name other than if length is above zero
	if(the_name.value.match("Name")){
		err_text = "Name must be filled out before submitting.\n";
		the_name.style.background  = 'Red';
	}else if(the_name.value.length == 0){
		the_name.style.background = 'Red';
		err_text = "Name missing.\n";
	}else{
		the_name.style.background = 'White';
	}
	return err_text;
} // END val_name

function validate_email(the_email){
	// Variables
	var errorText = "";
	var atSignIndex = the_email.value.lastIndexOf("@");
	var dotIndex = the_email.value.lastIndexOf(".");

	if(the_email.value.match("E-Mail")){
		errorText = "E-mail must be filled out before submitting.\n";
		the_email.style.background = 'Red';
	}else if(the_email.value.length == 0){
		errorText = "Missing E-Mail.\n";
		the_email.style.background = 'Red';
		return errorText;
	}else if(atSignIndex < 1 || dotIndex - atSignIndex < 2){
		errorText = "Invalid E-Mail Address.\n";
		the_email.style.background = 'Red';
		return errorText;
	}else{
		the_email.style.background = 'White';
	}
	return errorText;
} // END val_email 

function validate_company(the_company){
	// Variables
	var err_text = "";
	
	// As with name, not checking validity of company name other than if length is above zero.
	if(the_company.value.match("Company")){
		err_text = "Company must be filled out before submitting.\n";
		the_company.style.background = 'Red';
	}else if(the_company.value.length == 0){
		the_company.style.background = 'Red';
		err_text = "Company name missing.\n";
	}else{
		the_name.style.background = 'White';
	}
	return err_text;
} // END validate_company