// Required: common.js

// ACCOUNT_MEMBER GET
JSCUS_SQL._ACCOUNT._LOGIN = function(){};


	/** 
	 * Properties
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = null;
	JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = "";
	
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ID = 0;
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_LEVEL_ID = 0;
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID = 0;
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_USEERNAME = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_FIRST_NAME = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_MIDDLE_NAME = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_LAST_NAME = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_NAME = "";
	
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_GROUP_DESCRIPTION = "";
	JSCUS_SQL._ACCOUNT._LOGIN.SYS_GENDER_DESCRIPTION = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_POSITION = "";
	JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE = [];
	JSCUS_SQL._ACCOUNT._LOGIN.IS_AUTHENTICATED = false;
        	
	
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean.
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGIN = function
	(
        PARAM_ACCOUNT_USERNAME,
        PARAM_ACCOUNT_PASSWORD,
        CALLBACK_ADDRESS,
        REDIRECT_ADDRESS
	)
	{
		// Parameter Validation
		// _______________________________________________________________________
		JSVC_AV.VAR_VALIDATE_NULL(PARAM_ACCOUNT_USERNAME, "PARAM_ACCOUNT_USERNAME");
		JSVC_AV.VAR_VALIDATE_NULL(PARAM_ACCOUNT_PASSWORD, "PARAM_ACCOUNT_PASSWORD");
		JSVC_AV.VAR_VALIDATE_NULL(CALLBACK_ADDRESS, "CALLBACK_ADDRESS");
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(PARAM_ACCOUNT_USERNAME, 'PARAM_ACCOUNT_USERNAME', 'STRING');
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(PARAM_ACCOUNT_PASSWORD, 'PARAM_ACCOUNT_PASSWORD', 'STRING');
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(CALLBACK_ADDRESS, 'CALLBACK_ADDRESS', 'FUNCTION');
		
		
		// If on-going request exists
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK))
		{
			alert("Request already exists.");
			return;
		}
		
		
		// Process SQL Request
		// _______________________________________________________________________
		var PARAM_SET = "";			
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ACCOUNT_USERNAME', PARAM_ACCOUNT_USERNAME);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ACCOUNT_PASSWORD', PARAM_ACCOUNT_PASSWORD);
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = CALLBACK_ADDRESS;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = REDIRECT_ADDRESS;
		
		
		// Send SQL Request
		// _______________________________________________________________________					
		CUS_SEND_REQUEST
		(
			JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGIN_CALLBACK,
			JSCUS_CACHE.SERVER_URL + '/Account/member/login',
			JSCUS_CACHE.SERVER_URL + '/System/nonce/get',
			PARAM_SET
		);
	}
	

   	
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean. [Callback]
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGIN_CALLBACK = function
	(
		IS_SUCCESS, 
		RESPONSE_STRING
	)
	{
		
		// Initialize
		// _______________________________________________________________________
		var REQUEST_CALLBACK = JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK;
		var REDIRECT_PAGE = JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = null;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = null;
		
		
		// Abort on connection failure.
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			// Disable Dialogs (if not removed, it overlaps the dialog message box below)
			// ...........................................				
			CUS_SEND_DIALOG_TRY_DISMISS();
			
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				"CONNECTION ERROR: \n" + RESPONSE_STRING, "Log-In",
				"OK", "ERROR",
				function(MESSAGE_BOX_RESPONSE)
				{
					if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
					{
						REQUEST_CALLBACK(false);
					}	
				}
			);
			return;
		}
		
		
		// Initialize JSON
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		
		
		// Abort on Server Failure
		// _______________________________________________________________________
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.log(RESPONSE_STRING);

			// Disable Dialogs (if not removed, it overlaps the dialog message box below)
			// ...........................................				
			CUS_SEND_DIALOG_TRY_DISMISS();
			
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				"Invalid Username or Password.", "Log-In",
				"OK", "ERROR",
				function(MESSAGE_BOX_RESPONSE)
				{
					if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
					{
						REQUEST_CALLBACK(false);
					}		
				}
			);
			return;	
		}
		
			
		// Return Success
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
		{
			REQUEST_CALLBACK(true);
		}
		
		
		// Redirect if given
		// _______________________________________________________________________
		JSCUS_SQL._ACCOUNT._LOGIN.CUS_ME
		(
			function(IS_SUCCESS)
			{
				if(IS_SUCCESS == true)
				{
					if(JSVC_STR.VAR_IS_BLANK(REDIRECT_PAGE) === false)
					{
						if(REDIRECT_PAGE == 'DEFAULT')
						{
							window.location.replace(JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS]);
						}
						else
						{
							window.location.replace(REDIRECT_PAGE);		
						}
					}		
				}	
			},
			JSCUS_CACHE.LOGOUT_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS]
		);
		return;
	}
	
	
	
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean.
	 * @param CALLBACK_ADDRESS Method [Optional]
	 * @param REDIRECT_ADDRESS String [Optional]
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGOUT = function
	(
        CALLBACK_ADDRESS,
        REDIRECT_ADDRESS
	)
	{
		// Parameter Validation
		// _______________________________________________________________________

		
		// If on-going request exists
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK))
		{
			alert("Request already exists.");
			return;
		}
		
		
		// Process SQL Request
		// _______________________________________________________________________
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = CALLBACK_ADDRESS;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = REDIRECT_ADDRESS;
		
		
		// Send SQL Request
		// _______________________________________________________________________					
		CUS_SEND_REQUEST
		(
			JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGOUT_CALLBACK,
			JSCUS_CACHE.SERVER_URL + '/Account/member/logout',
			JSCUS_CACHE.SERVER_URL + '/System/nonce/get',
			""
		);
	}
	

   	
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean. [Callback]
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_LOGOUT_CALLBACK = function
	(
		IS_SUCCESS, 
		RESPONSE_STRING
	)
	{
		
		// Initialize
		// _______________________________________________________________________
		var REQUEST_CALLBACK = JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = null;
		
		
		// Abort on connection failure.
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				"CONNECTION ERROR: \n" + RESPONSE_STRING, "Logout",
				"OK", "ERROR",
				function(MESSAGE_BOX_RESPONSE)
				{
					if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
					{
						REQUEST_CALLBACK(false);
					}	
				}
			);
			return;
		}
		
		
		// Initialize JSON
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		
		
		// Abort on Server Failure
		// _______________________________________________________________________
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.log(RESPONSE_STRING);
			
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				"REQUEST ERROR: Please contact your system administrator.", "Logout",
				"OK", "ERROR",
				function(MESSAGE_BOX_RESPONSE)
				{
					if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
					{
						REQUEST_CALLBACK(false);
					}
				}
			);
			return;	
		}
		
			
		// Return Success
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
		{
			REQUEST_CALLBACK(true);
		}
		
		
		// Redirect if given
		// _______________________________________________________________________
		if(JSVC_STR.VAR_IS_BLANK(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE) === false)
		{
			window.location.replace(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE);
			JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = null;
		}
		return;
	}
	
	
	
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean.
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_ME = function
	(
		CALLBACK_ADDRESS,
		REDIRECT_ADDRESS
	)
	{
		// Parameter Validation
		// _______________________________________________________________________
		JSVC_AV.VAR_VALIDATE_NULL(CALLBACK_ADDRESS, "CALLBACK_ADDRESS");
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(CALLBACK_ADDRESS, 'CALLBACK_ADDRESS', 'FUNCTION');

		
		// If on-going request exists
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK))
		{
			alert("Request already exists.");
			return;
		}
		
	
		// Process SQL Request
		// _______________________________________________________________________
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = CALLBACK_ADDRESS;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = REDIRECT_ADDRESS;
		
		
		// Send SQL Request
		// _______________________________________________________________________					
		CUS_SEND_REQUEST
		(
			JSCUS_SQL._ACCOUNT._LOGIN.CUS_ME_CALLBACK,
			JSCUS_CACHE.SERVER_URL + '/Account/member/me',
			JSCUS_CACHE.SERVER_URL + '/System/nonce/get',
			""
		);
	}
	
	
    
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean. [Callback]
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_ME_CALLBACK = function
	(
		IS_SUCCESS, 
		RESPONSE_STRING
	)
	{
		
		// Initialize
		// _______________________________________________________________________
		var REQUEST_CALLBACK = JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = null;
		
		
		// Abort is callback is null
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK) === false)
		{
			return;
		}	
		
		
		// Abort on connection failure.
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				"CONNECTION ERROR: \n" + RESPONSE_STRING, "Authenticated Session",
				"OK", "ERROR",
				function(MESSAGE_BOX_RESPONSE)
				{
					if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK))
					{
						REQUEST_CALLBACK(false);
					}	
				}
			);
			return;
		}
		
		
		// Initialize JSON
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		
		
		// Abort on Server Failure [Not Authenticated]
		// _______________________________________________________________________
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			//console.log(RESPONSE_STRING);
			REQUEST_CALLBACK(false);
			
			// Redirect if given
			if(JSVC_STR.VAR_IS_BLANK(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE) === false)
			{
				window.location.replace(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE);
				JSCUS_SQL._ACCOUNT._LOGIN.CACHE_REDIRECT_PAGE = null;
			}
			return;	
		}
		
			
		// Read Data
		// _______________________________________________________________________
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ID = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_ID', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_LEVEL_ID = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_ACC_LEVEL_ID', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_ACC_GROUP_ID = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_ACC_GROUP_ID', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_USEERNAME = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_USERNAME', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_FIRST_NAME = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_FIRST_NAME', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_MIDDLE_NAME = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_MIDDLE_NAME', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_LAST_NAME = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_LAST_NAME', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_NAME = 
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_LAST_NAME + ", " + 
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_FIRST_NAME + " " + 
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_MIDDLE_NAME;
		
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_GROUP_DESCRIPTION = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_GROUP_DESCRIPTION', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.SYS_GENDER_DESCRIPTION = JSRC_JSON.REF_READ(JSON_OBJECT, 'SYS_GENDER_DESCRIPTION', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_POSITION = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_ACCOUNT_POSITION', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE = JSRC_JSON.REF_READ(JSON_OBJECT, 'ACC_LEVEL_LANDING_PAGE', '1');
		JSCUS_SQL._ACCOUNT._LOGIN.IS_AUTHENTICATED = true;
		JSCUS_SQL._ACCOUNT._LOGIN.CUS_REDIRECT_MANAGEMENT_INITIALIZE();	

			
		// Return Success
		// _______________________________________________________________________
		REQUEST_CALLBACK(true);
		return;
	}
	
	
	/** 
	 * =======================================================================================================
	 * Perform SQL AUTH VERIFICATION request to the table ACCOUNT. Returns Boolean.
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_REDIRECT_MANAGEMENT_INITIALIZE = function()
	{
		// Convert to Array
		// _______________________________________________________________________
		if
		(
			JSVC_STR.VAR_IS_BLANK(JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE) == false &&
			JSVC_STR.VAR_CONTAINS(JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE, ",")
		)
		{
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE = JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE.split(',');
		}
		else if(JSVC_STR.VAR_IS_BLANK(JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE) == false)
		{
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE = [JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE];
		}
		else
		{
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE = [];
		}		
		
		// Update Redirection
		// _______________________________________________________________________	
		if
		(
			JSVC_ARR.VAR_IS_EMPTY(JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE) ||
			JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE.length <= JSCUS_CACHE.LOGIN_CLASS ||
			JSVC_STR.VAR_IS_BLANK(JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE[JSCUS_CACHE.LOGIN_CLASS])
		)
		{
			JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS] = JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS];
		}
		else
		{
			JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS] = JSCUS_CACHE.SERVER_URL + JSCUS_SQL._ACCOUNT._LOGIN.ACC_LEVEL_LANDING_PAGE[JSCUS_CACHE.LOGIN_CLASS];
		}	
	};
	
	
	
	/** 
	 * =======================================================================================================
	 * Perform SQL AUTH VERIFICATION request to the table ACCOUNT. Returns Boolean.
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_VERIFY_PASSWORD = function
	(
		VERIFY_PASSWORD,
		CALLBACK_ADDRESS
	)
	{
		// Parameter Validation
		// _______________________________________________________________________
		JSVC_AV.VAR_VALIDATE_NULL(VERIFY_PASSWORD, "VERIFY_PASSWORD");
		JSVC_AV.VAR_VALIDATE_NULL(CALLBACK_ADDRESS, "CALLBACK_ADDRESS");
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(VERIFY_PASSWORD, 'VERIFY_PASSWORD', 'STRING');
		JSVC_AV.VAR_VALIDATE_ARGUMENT_TYPE(CALLBACK_ADDRESS, 'CALLBACK_ADDRESS', 'FUNCTION');
		
		// If on-going request exists
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK))
		{
			alert("Request already exists.");
			return;
		}
		
		// Process SQL Request
		// _______________________________________________________________________
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = CALLBACK_ADDRESS;
		var PARAM_SET = "";			
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ACCOUNT_USERNAME', JSCUS_SQL._ACCOUNT._LOGIN.ACC_ACCOUNT_USEERNAME);
		PARAM_SET = JSRC_HTTP.REF_ADD(PARAM_SET, 'PARAM_ACCOUNT_PASSWORD', VERIFY_PASSWORD);
		
		// Send SQL Request
		// _______________________________________________________________________					
		CUS_SEND_REQUEST
		(
			JSCUS_SQL._ACCOUNT._LOGIN.CUS_VERIFY_PASSWORD_CALLBACK,
			JSCUS_CACHE.SERVER_URL + '/Account/member/verify_password',
			JSCUS_CACHE.SERVER_URL + '/System/nonce/get',
			PARAM_SET
		);
	}
	
	
    
	/** 
	 * =======================================================================================================
	 * Perform SQL LOGIN request to the table ACCOUNT. Returns Boolean. [Callback]
	 * =======================================================================================================
	 */
	JSCUS_SQL._ACCOUNT._LOGIN.CUS_VERIFY_PASSWORD_CALLBACK = function
	(
		IS_SUCCESS, 
		RESPONSE_STRING
	)
	{

		// Initialize
		// _______________________________________________________________________
		var REQUEST_CALLBACK = JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK;
		JSCUS_SQL._ACCOUNT._LOGIN.CACHE_CALLBACK = null;
		
		// Abort is callback is null
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(REQUEST_CALLBACK) === false)
		{
			return;
		}	
		
		// Abort on connection failure.
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			REQUEST_CALLBACK(false);
			return;
		}
		
		// Initialize JSON
		// _______________________________________________________________________
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
		
		// Abort on Server Failure [Not Authenticated]
		// _______________________________________________________________________
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === true)
		{
			REQUEST_CALLBACK(true);
			return;	
		}
		else
		{
			REQUEST_CALLBACK(false);
		}
		
		// Return Success
		// _______________________________________________________________________
		return;
	}