// FBContactUs.js

function bodyOnload() {				 
	document.forms['Form'].Name.focus();
	search_onload();	 		
}
	 

function validateForm() {	
							
	// Comment Type 
	if (( document.forms['Form'].CommentType[0].checked == false ) && ( document.forms['Form'].CommentType[1].checked == false ) && ( document.forms['Form'].CommentType[2].checked == false ) && ( document.forms['Form'].CommentType[3].checked == false )) {	
		window.alert('What kind of comment would you like to send?');
		return false;	
	} 
					
	// Comment Category
	if (( trim(document.forms['Form'].CommentCategory.value) == '' ) && ( trim(document.forms['Form'].OtherCommentCategory.value) == '' )) {	
		window.alert('On what do you want to comment?');
		document.forms['Form'].CommentCategory.focus();
		return false;	
	}				
																
	// Your Name 
	if ( trim(document.forms['Form'].Name.value) == '' ) {	
		window.alert('Please enter Your Name.');
		document.forms['Form'].Name.focus();
		return false;	
	}	
	
	// Email Address or Phone Number 
	if (( trim(document.forms['Form'].EmailAddress.value) == '' ) && ( trim(document.forms['Form'].PhoneNumber.value) == '' )) {	
		window.alert('Please enter an Email Address or Phone Number.');
		document.forms['Form'].EmailAddress.focus();
		return false;	
	}
	
	// Email Address 
	if ((( trim(document.forms['Form'].EmailAddress.value) != '' )) && ( !isValidEmail(trim(document.forms['Form'].EmailAddress.value))) ) {	
		window.alert('Email Address is not valid.');
		document.forms['Form'].EmailAddress.focus();
		return false;
	}		
	
	// Phone Number 
	value = trim(document.forms['Form'].PhoneNumber.value);
	value = value.replace(/[\(\)\.\-\+\s]/g, '');
	if (( trim(document.forms['Form'].PhoneNumber.value) != '' ) && ( isNaN(value) == true )) {	
		window.alert('Phone Number is not valid.');
		document.forms['Form'].PhoneNumber.focus();
		return false;
	}	
	
	// Comment 
	if ( trim(document.forms['Form'].Comment.value) == '' ) {	
		window.alert('Please enter a Question or Comment.');
		document.forms['Form'].Comment.focus();
		return false;	
	}	

}	

function submitForm() {
	document.forms['Form'].submit();	
}