<!--

function validate() {

	if( !checkIfEmpty() ) { return false; }
	
	return true;

}	
	

function emptyFieldAlert( fieldname ) {
	alert( "The required field '" + fieldname + "' is blank. This information is required." );
}

function checkIfEmpty() {

	if( !notEmpty( document.getElementById( "name" ) ) ) {
		emptyFieldAlert( "Name" );
		return false;
	}

	if( !notEmpty( document.getElementById( "email" ) ) ) {
		emptyFieldAlert( "Email Address" );
		return false;
	} 
	else {
		if( !checkEmail() ) { return false; }
		
	}		
	
	if( notEmpty( document.getElementById( "phone" ) ) ) {
		if( !checkPhone() ) { return false; }
		
	}	

	if( !notEmpty( document.getElementById( "comments" ) ) ) {
		emptyFieldAlert( "Questions and/or Comments" );
		return false;
	}

	return true;		
}

function notEmpty( elem ) {

	if( elem.type == 'select' ) {
		if( elem.selectedIndex == 0 ) { return false; }
	}
	else {
		if( elem.value.length == 0 ) { return false; }
	}
	
	return true;
		
}

function checkEmail() {
	
  	var myReg =/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  	  
  		if (document.getElementById( "email" ).value.search(myReg)==-1) {
  			alert("Please verify that your 'Email' is correct.");
  			return false;
  		} 
		else { return true; }
  	  
}

function checkPhone() {	
	
	var myReg =/^(\(*\d{3}\)*\s*\-*\d{3}\s*\-*\d{4}\s*)|(\d{3}\.*\d{3}\.*\d{4}\s*)$/;
	
	if (document.getElementById( "phone" ).value.search(myReg)==-1) {
		alert("Please verify that your 'Phone Number' is correct.");
		return false;		
	}	
	else { return true; }		
}

//-->