/***
*	javascript file 
*	(c) 2007 by Mirko Scharf
***/

function submitEntry() {

	$('inputText').value = oEditor.GetHTML();

	if( !$('inputAuthor').value.match(/\w/) )	{ showWarning( msg_no_author ); return false; }
	if( $('inputEmail').value.match(/\w/) && !checkEmail( $('inputEmail').value ) )		{ showError( msg_wrong_email ); return false; }
	if( !$('inputTitle').value.match(/\w/) )		{ showWarning( msg_no_title ); return false; }
	if( !$('inputText').value.match(/\w/) )		{ showWarning( msg_no_text ); return false; }

	$( 'btnSubmit' ).disabled = true;

	var postTxt = Form.serialize( $( "frmNewEntry" ) );
	
	ajaxRequest(
		'/!guestbookNewEntry',
		true,
		postTxt,
		function( t ) {
			res = deflateJSON( t.responseText );
			if ( res.result != '0' ) {
				showError( msg_new_gb_entry_error[ res.result ] );
			}
			else {
				location.href = '/guestbook_new_entry_saved';
			}
		}
	);

	
}

