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

function doLogin() {
	if ( !$( 'login' ).value.match( /\w/ ) ) {
		showError( msg_no_username );
		return;
	}
	if ( !$( 'pass' ).value.match( /\w/ ) ) {
		showError( msg_no_password );
		return;
	}

	var postTxt = Form.serialize( $( "frmLogin" ) );

	ajaxRequest(
		'/!login',
		true,
		postTxt,
		function( t ) {
			res = deflateJSON( t.responseText );
			if ( res.actionResult != 0 ) {
				$( 'loginFailures' ).value++;
				if ( $( 'loginFailures' ).value == 3 ) {
					location.href='/login_help';
				}
				showError( msg_wrong_login );
			}
			else {
				location.href=location.href;
			}
		}
	);

}

