
/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 3.2
 *	LISENSE: FL0HXF6DKASG - http://www.flynax.com/license-agreement.html
 *	PRODUCT: Pets Classifieds
 *	DOMAIN: smilesdelivery.com
 *	FILE: INDEX.PHP
 *
 *	This script is a commercial software and any kind of using it must be 
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out 
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2010
 *	http://www.flynax.com/
 *
 ******************************************************************************/

/* make username filed in focus */
$(document).ready(
	function(){
		$('#username').focus();
	}
);

/**
* check admin login form
*
* @param srting user_empty - error message in case when the user filed is empty
* @param string pass_empty - error message in case when the password filed is empty
*
* @return bool
* 
**/
function jsLogin( user_empty, pass_empty )
{
	if ( $("#username").val() != '' )
	{
		if ( $("#password").val() != '' )
		{
			/* show loading */
			$('#login_load').fadeIn('normal');
			$('#ses_exp_block').fadeOut('normal');
			
			/* hide notify message */
			$('#login_notify').css('display', 'none');
			
			/* default inputs */
			$('#username').removeClass('login_input_text_error');
			$('#username').addClass('login_input_text');
			$('#password').removeClass('login_input_text_error');
			$('#password').addClass('login_input_text');
			
			var pass_hash = $('#password').val();
			var password = hex_md5(sec_key)+hex_md5(pass_hash);

			xajax_logIn( $('#username').val(), password, $('#interface').val() );
		}
		else
		{
			fail_alert( '#password', pass_empty );
		}
	}
	else
	{
		fail_alert( '#username', user_empty );
	}
	
	return false;
}
