// comment.js

function changeAvatar() {
	
	var myImg     = document.getElementById( 'avatarImg' );
    var selectBox = document.getElementById( 'selectedAvatar' );
	var theSrc    = "/images/avatars/" + selectBox.value;

    myImg.src = theSrc;

} // changeAvatar

function validComment( theForm ) {
	
	var error = "";
	
	if( theForm.name.value == "" )
		error += "- Name Field Empty.\n";

	if( theForm.comment.value == "" )
		error += "- Comments Field Empay.\n";

	if( theForm.name.value.substring( 0, 1 ) == " " )
		error += "- Invalid Name.\n";

	if( theForm.email.value.substring( 0, 1 ) == " " )
		error += "- Invalid Email Address.\n";

	if( theForm.url.value.substring( 0, 1 ) == " " )
		error += "- Invalid URL.\n";

	if( theForm.comment.value.substring( 0, 1 ) == " " )
		error += "- Invalid Comment.\n";

	if( error != "" ) {
		error = "You must correct the following problems:\n" + error;
		alert( error );
		return false;
	} // error
	
} // isValidComment
