// NOTE: [This JS must loaded as last item]
JSTOOL_CUSTOMIZE.DGVCALC = function(){};

	// ===============================================================
	// Part 0 : Initialize Form
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.DGV = null;
	JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV = null;
	JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_CMD = null;
	JSTOOL_CUSTOMIZE.DGVCALC.LOAD_COLUMNS_CMD = null;
	JSTOOL_CUSTOMIZE.DGVCALC.APPLY_CMD = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CANCEL_CMD = null;
	
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ID_TXT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_URL_TXT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_CODE_TXT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_DESCRIPTION_TXT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_SSTRING_TXT = null;
				
	JSTOOL_CUSTOMIZE.DGVCALC.INPUT_INSTANCE = null;
	JSTOOL_CUSTOMIZE.DGVCALC.INPUT_INSTANCE_EDIT = null;
	JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL = null;
	JSTOOL_CUSTOMIZE.DGVCALC.TOOL_TITLE = 'DGVCALC';
	
	JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX = -1;
	JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX = -1;
	JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX = -1;


	/**
	 * Break hidden element list in string to array
	 */
	JSTOOL_CUSTOMIZE.DGVCALC.LIST_TO_ARRAY = function(LIST_STRING)
	{
		// Initialize
		// _______________________________________________________________________
		var HIDDEN_ELEMENTS = [];
		var RESULT_ELEMENTS = [];
	
		// Actual Function
		// _______________________________________________________________________
		if(JSVC_STR.VAR_IS_BLANK(LIST_STRING))
		{
			return [];
		}
		
		// Single Entry
		// _______________________________________________________________________
		if(JSVC_STR.VAR_CONTAINS(LIST_STRING, ",") == false)
		{
			return [LIST_STRING];
		}
		HIDDEN_ELEMENTS = LIST_STRING.split(",");
		
		// Remove empty
		// _______________________________________________________________________
		while(JSVC_ARR.VAR_EMPTY(HIDDEN_ELEMENTS) == false)
		{
			if(JSVC_STR.VAR_IS_BLANK(HIDDEN_ELEMENTS[0]) == false)
			{
				RESULT_ELEMENTS.push(HIDDEN_ELEMENTS[0]);
			}
			HIDDEN_ELEMENTS.shift();
		}	
		
		// Return result
		// _______________________________________________________________________
		return RESULT_ELEMENTS;
	};
	

	// ===============================================================
	// Part 1 : Initialize Form
	// ===============================================================
	
	/**
	 *	Show Customer Selection modal
	 *	@param CALLBACK_METHOD Optional Callback on successful action. Method(ID, DESCRIPTION)
	 *	@param CALLBACK_CONTROL Optional Modal will assign a value to a element on success.
	 */	
	JSTOOL_CUSTOMIZE.DGVCALC.SHOW = function
	(
		CONFIG_URL, CONFIG_LEVEL
	)
	{
		// Initialize New Configuration
		// _______________________________________________________________________
		JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL = CONFIG_URL;

		// Initialize
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSTOOL_CUSTOMIZE.DGVCALC.DGV) == false)
		{
			// Initialize Modal and DGV
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.DGV = DataGridView("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV");
			JSTOOL_CUSTOMIZE.DGVCALC.DGV.ON_CLICK
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					if(JSTOOL_CUSTOMIZE.DGVCALC.DGV.COLUMN.NAME(COL_INDEX) == "COPY_BBI")
					{
						if
						(
							JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX >= 0 &&
							JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX >= 0		
						)
						{
							var CURRENT_VALUE = JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX);
							
							if(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX <= 0)
							{
								CURRENT_VALUE = 
									'`' + JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ELEMENT_ID", ROW_INDEX) + '`' + 
									CURRENT_VALUE;					
							}
							else if(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX >= JSVC_STR.VAR_LEN(CURRENT_VALUE))
							{
								CURRENT_VALUE = 
									CURRENT_VALUE +
									'`' + JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ELEMENT_ID", ROW_INDEX) + '`';									
							}
							else
							{
								CURRENT_VALUE = 
									JSVC_STR.VAR_LEFT(CURRENT_VALUE, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX) + 
									'`' + JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ELEMENT_ID", ROW_INDEX) + '`' +
									JSVC_STR.VAR_DLEFT(CURRENT_VALUE, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX);								
							}
							
							JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX, CURRENT_VALUE);
							JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX += JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ELEMENT_ID", ROW_INDEX).length + 2;
							JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.ELEMENT(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX).focus();			
							JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.ELEMENT(JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX, JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX).selectStart = JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX;						
						}
					}
					else if(COL_INDEX != JSTOOL_CUSTOMIZE.DGVCALC.DGV.COLUMN.INDEX("ROW_IS_SELECTED"))
					{
						JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX = -1;
						JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX = -1;
						JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX = -1;
						JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ROW_IS_SELECTED", ROW_INDEX, true);
					}
				}
			);   	
			
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV = DataGridView("DGVCALC_APPLY_MODAL_CATEGORY_CUSTOMIZE_DGV");
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ON_CLICK
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					// Delete Button
					// ...........................................
					if(JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.COLUMN.NAME(COL_INDEX) == "DELETE_BBI")
					{
						// Delete Unsaved Item
						JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.REMOVE_AT(ROW_INDEX);
					}	
				}
			);   	
			
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ON_FOCUS
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_COL_INDEX = COL_INDEX;
					JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_ROW_INDEX = ROW_INDEX;
					JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX = -1;
				}
			);   	
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ON_FOCUS_OUT
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					JSTOOL_CUSTOMIZE.DGVCALC.FOCUSED_SEL_INDEX = JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.ELEMENT(COL_INDEX, ROW_INDEX).selectionStart;
				}
			);   
									
			JSTOOL_CUSTOMIZE.DGVCALC.LOAD_COLUMNS_CMD = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_LOAD_COLUMNS_CMD");
			JSTOOL_CUSTOMIZE.DGVCALC.LOAD_COLUMNS_CMD.onclick = function()
			{
				JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS_COLUMNS();
			};
			
			
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ID_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_ID_TXT");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_URL_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_URL_TXT");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_ACC_LEVEL_ID_CMB");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_CODE_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_CODE_TXT");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_DESCRIPTION_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_DESCRIPTION_TXT");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_LSTRING_TXT");
			JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_SSTRING_TXT = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CAT_CUSTOM_SSTRING_TXT");
	
			JSTOOL_CUSTOMIZE.DGVCALC.INPUT_INSTANCE = JSOC_WINDOW.VAR_INPUT_INSTANCE_CLONE("DGVCALC_MODAL_CATEGORY_CUSTOMIZE");			
		
			// Initialize: Button
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_CMD = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGVCALC_CMD");
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_CMD.onclick = function()
				{
					JSTOOL_CUSTOMIZE.DGVCALC.DIALOG_CALC();
				};
				
			JSTOOL_CUSTOMIZE.DGVCALC.APPLY_CMD = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_APPLY_CMD");
			JSTOOL_CUSTOMIZE.DGVCALC.APPLY_CMD.onclick = function()
				{
					JSTOOL_CUSTOMIZE.DGVCALC.DIALOG_SAVE();
				};
				
			JSTOOL_CUSTOMIZE.DGVCALC.CANCEL_CMD = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_CANCEL_CMD");
			JSTOOL_CUSTOMIZE.DGVCALC.CANCEL_CMD.onclick = function()
				{
					JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE", false);
				};
							
			// Foreign Field
			// ...........................................
			JSOC_CMB.VAR_CLEAR(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB);
			JSCUS_SQL._ACCOUNT._LEVEL.CUS_GET_THEN_POPULATE_COMBOBOX
			(
				function(IS_SUCCESS, RESPONSE_STRING)
				{
					// Set Default index
					JSOC_CMB.VAR_SELECTED_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB, "1");
					JSOC_CMB.VAR_TEXT
					(
						JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB,
						JSOC_CMB.VAR_SELECTED_INDEX(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB), 
						"-- EVERYONE -- "
					);
				},		
				JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB,
				true, 2
			);
		
			// Onetime Loading
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS();
		}
		
		// Clean Modal
		// _______________________________________________________________________
		JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.CLEAR();
		JSOC_WINDOW.VAR_INPUT_INSTANCE_RESTORE(JSTOOL_CUSTOMIZE.DGVCALC.INPUT_INSTANCE);
		
		JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_URL_TXT, JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL);
		JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_CODE_TXT,  JSCUS_CACHE.CONFIG_CODE + JSTOOL_CUSTOMIZE.DGVCALC.TOOL_TITLE);
		JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_DESCRIPTION_TXT, 'Assigns auto computing Math function to DGV.Column');
		
		// New Data
		// _______________________________________________________________________
		if(JSVC_STR.VAR_IS_BLANK(CONFIG_URL))
		{
			// Initialize New Configuration
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL =  JSVC_URL._CURRENT.VAR_PATH();
			
			// Apply Configuration
			// ...........................................
			JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ID_TXT, 0);
			JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_URL_TXT, JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL);
			JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT, "");
			JSOC_CMB.VAR_SELECTED_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB, "1");
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.CLEAR();
			
			// Display Modal
			// ...........................................
			if(JSOC_CMB.VAR_COUNT('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB') <= 0)
			{
				alert('No DGV elements found');
				JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT", false);
				JSOC_DIALOG.VAR_MODAL("CATEGORY_CUSTOMIZE_MODAL_MAIN_MENU", true);
			}				
			else
			{
				JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE", true);
			}	
		}
		
		// Load Data
		// _______________________________________________________________________
		else
		{
			JSTOOL_CUSTOMIZE.DGVCALC.LOAD
			(
				JSTOOL_CUSTOMIZE.DGVCALC.CONFIG_URL,
				CONFIG_LEVEL,
				function(CONFIG_ID, CONFIG_DATA, CAT_CUSTOM_SSTRING, CONFIG_LEVEL)
				{
					// Apply Configuration
					// ...........................................
					JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ID_TXT, CONFIG_ID);
					JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT, CONFIG_DATA);
					JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_SSTRING_TXT, CAT_CUSTOM_SSTRING);
					JSOC_CMB.VAR_SELECTED_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB, CONFIG_LEVEL);
					
					// On Load Action
					// ...........................................
					JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_RESTORE();
					
					// Display Modal
					// ...........................................
					if(JSOC_CMB.VAR_COUNT('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB') <= 0)
					{
						alert('No DGV elements found');
						JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT", false);
						JSOC_DIALOG.VAR_MODAL("CATEGORY_CUSTOMIZE_MODAL_MAIN_MENU", true);
					}				
					else
					{
						JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE", true);
					}	
				}
			);
		}
	};
	
	
	// ===============================================================
	// Part 2.A : Load Elements
	// ===============================================================
	JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS = function()
	{
		// Initialize
		// _______________________________________________________________________
		var LIST_OF_ELEMENTS = JSOC_ELEMENT.VAR_SUB_ELEMENTS(document.body, true, true, JSTOOL_CUSTOMIZE.TOOL_ELEMENT_IDS);
		JSOC_CMB.VAR_CLEAR('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB');
		
		// List down DGV
		// _______________________________________________________________________
		if(JSVC_ARR.VAR_EMPTY(LIST_OF_ELEMENTS) == false)
		{
			LIST_OF_ELEMENTS = JSVC_ARR.VAR_SORT(LIST_OF_ELEMENTS, 'ASC');
		}
		
		while(JSVC_ARR.VAR_EMPTY(LIST_OF_ELEMENTS) == false)
		{
			// Has no inner HTML Tags
			// ...........................................
			if(JSVC_STR.VAR_CONTAINS(JSOC_ELEMENT.VAR_INNER_HTML(LIST_OF_ELEMENTS[0]), "<") == false)
			{
				LIST_OF_ELEMENTS.shift();
				continue;
			}
			
			// Abort Select Modals
			// ...........................................
			else if(JSVC_STR.VAR_CONTAINS_LEFT(LIST_OF_ELEMENTS[0], 'SELECT_MODAL_'))
			{
				LIST_OF_ELEMENTS.shift();
				continue;				
			}
			
			// Filter and allow only the [DIV][TABLE] Tags, and DGV Post-fix
			// ...........................................
			else if
			(
				JSVC_STR.VAR_CONTAINS_RIGHT(LIST_OF_ELEMENTS[0], '_DGV') &&
				JSVC_ARR.VAR_CONTAINS
				(
					['DIV', 'TABLE'], 
					JSVC_STR.VAR_UCASE(JSOC_ELEMENT.VAR_GET(LIST_OF_ELEMENTS[0]).tagName)
				)
			)
			{
				JSOC_CMB.VAR_ADD('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB', LIST_OF_ELEMENTS[0], LIST_OF_ELEMENTS[0]);
			}
			
			// To next loop
			// ...........................................
			LIST_OF_ELEMENTS.shift();
		}		
	};
		
	
	// ===============================================================
	// Part 2.A : Load Elements (List down columns)
	// ===============================================================
	JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS_COLUMNS = function(SKIP_VALIDATION = false)
	{		
		// Load DGV Columns
		// _______________________________________________________________________
		var ON_ALLOW_ACTION = function()
		{
			// Clear DGV
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.DGV.ROW.CLEAR();
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.CLEAR();
			
			// Abort if nothing selected
			// ...........................................
			var SELECTED_INDEX = JSOC_CMB.VAR_SELECTED_INDEX('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB');
			if(SELECTED_INDEX < 0)
			{
				return;
			}
			
			// Initialize
			// ...........................................
			var SELECTED_DGV_NAME = JSOC_CMB.VAR_SELECTED_VALUE('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB');
			var LIST_OF_ELEMENTS = JSOC_ELEMENT.VAR_SUB_ELEMENTS(SELECTED_DGV_NAME + '_HEADER', true, true, []);
			
			// GET COLUMNS
			// ...........................................
			while(JSVC_ARR.VAR_EMPTY(LIST_OF_ELEMENTS) == false)
			{
				JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS_ADD(JSVC_STR.VAR_DLEFT(LIST_OF_ELEMENTS[0], (SELECTED_DGV_NAME + '_HEADER_').length));
				LIST_OF_ELEMENTS.shift();
			}
			
			// Update Row Count
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.DGV.ROW.REFRESH_ROW_COUNT();
		};
		
		// Ask for user action
		// _______________________________________________________________________
		if
		(
			SKIP_VALIDATION == false && 
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() > 0
		)
		{
			JSOC_DIALOG.VAR_MESSAGE_BOX
			(
				'Do you want to override the current settings?', 
				'Load DataGridView', 
				JSOC_DIALOG.MSGBOX_TYPE_YES_NO,
				JSOC_DIALOG.MSGBOX_ICON_QUESTION,
				function(RESULT_BUTTON)
				{
					if(RESULT_BUTTON == JSOC_DIALOG.MSGBOX_YES)
					{
						ON_ALLOW_ACTION();
					}
				}
			);	
		}
		else
		{
			ON_ALLOW_ACTION();
		}
	};
	
	
	// ===============================================================
	// Part 2.B : Add Element
	// ===============================================================
	JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS_ADD = function(ELEMENT_ID)
	{
		JSTOOL_CUSTOMIZE.DGVCALC.DGV.ROW.ADD();
		JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE("ELEMENT_ID", JSTOOL_CUSTOMIZE.DGVCALC.DGV.ROW.COUNT() - 1, ELEMENT_ID);
	};
	

	
	// ===============================================================
	// Part 2.C : Restore Data from stored configuration
	// ===============================================================
	JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_RESTORE = function()
	{
		// Initialize
		// _______________________________________________________________________
		var SELECTED_DGV = JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_SSTRING_TXT);
		var CUSTOM_ELEMENTS = JSTOOL_CUSTOMIZE.DGVCALC.LIST_TO_ARRAY
		(
			JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT)
		);
		var CURRENT_DATA = null;
		
		// Replace Current DGV List
		// _______________________________________________________________________
		JSOC_CMB.VAR_SELECTED_VALUE('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB', SELECTED_DGV);
		JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_LOAD_ELEMENTS_COLUMNS(true);
		
		// Multi-Entry
		// _______________________________________________________________________
		while(JSVC_ARR.VAR_EMPTY(CUSTOM_ELEMENTS) == false)
		{
			if(JSVC_STR.VAR_IS_BLANK(CUSTOM_ELEMENTS[0]) == false)
			{
				CURRENT_DATA = CUSTOM_ELEMENTS[0].split("::");
				JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_RESTORE_ADD
				(
					CURRENT_DATA[0], 
					CURRENT_DATA [1],
					JSVC_NUM.VAR_NVALBOOL(CURRENT_DATA [2]),
					JSVC_NUM.VAR_NVALBOOL(CURRENT_DATA [3]),
					CURRENT_DATA [4]
				);
			}
			CUSTOM_ELEMENTS.shift();
		}
		JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.REFRESH_ROW_COUNT();
	};
	
	
	// ===============================================================
	// Part 2.D : Add Hidden Element
	// ===============================================================
	JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_RESTORE_ADD = function
	(
		ELEMENT_ID, 
		ELEMENT_CALCULATE, 
		APPLY_CFORMAT,
		APPLY_AUTO_TOTAL,
		APPLY_COPY_TOTAL
	)
	{
		if
		(
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.COLUMN.FIND('ELEMENT_ID', ELEMENT_ID, true) < 0
		)
		{
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.ADD();
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE("ELEMENT_ID", JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() - 1, ELEMENT_ID);	
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE("ELEMENT_CALCULATE", JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() - 1, ELEMENT_CALCULATE);	
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE("APPLY_CFORMAT", JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() - 1, APPLY_CFORMAT);	
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE("APPLY_AUTO_TOTAL", JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() - 1, APPLY_AUTO_TOTAL);	
			JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE("APPLY_COPY_TOTAL", JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT() - 1, APPLY_COPY_TOTAL);	
		}
	};	
				
				
	// ===============================================================
	// Part 3 : Add Selected Item to Hidden list
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.DIALOG_CALC = function()
	{
		// Initialize
		// _______________________________________________________________________
		var ROW_COUNT = JSTOOL_CUSTOMIZE.DGVCALC.DGV.ROW.COUNT();
		var ROW_INDEX = 0;		
		
		// Get selected option
		// _______________________________________________________________________
		while(ROW_COUNT > ROW_INDEX)
		{
			if(JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE('ROW_IS_SELECTED', ROW_INDEX))
			{
				JSTOOL_CUSTOMIZE.DGVCALC.ON_SHOWN_RESTORE_ADD
				(
					JSTOOL_CUSTOMIZE.DGVCALC.DGV.CELL.VALUE('ELEMENT_ID', ROW_INDEX)
				);
			}
			ROW_INDEX ++;
		}
		JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.REFRESH_ROW_COUNT();
	};
	
	
	// ===============================================================
	// Part 4 : Save Current Config
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.DIALOG_SAVE = function()
	{
		// Initialize
		// _______________________________________________________________________
		var ROW_COUNT = JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.ROW.COUNT();
		var ROW_INDEX = 0;		
		var RESULT_STRING = [];
		
		// Get selected option
		// _______________________________________________________________________
		while(ROW_COUNT > ROW_INDEX)
		{
			RESULT_STRING.push
			(
				JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE
				(
					'ELEMENT_ID', ROW_INDEX
				) + '::' +
				JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE
				(
					'ELEMENT_CALCULATE', ROW_INDEX
				) + '::' +
				JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE
				(
					'APPLY_CFORMAT', ROW_INDEX
				) + '::' +
				JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE
				(
					'APPLY_AUTO_TOTAL', ROW_INDEX
				) + '::' +
				JSTOOL_CUSTOMIZE.DGVCALC.DGVCALC_DGV.CELL.VALUE
				(
					'APPLY_COPY_TOTAL', ROW_INDEX
				)
			);
			ROW_INDEX ++;
		}		
		
		// Sort Elements
		// _______________________________________________________________________
		RESULT_STRING.sort();
		
		// Convert to String
		// _______________________________________________________________________
		JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT, RESULT_STRING.join());
		if(JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT).length > 5012)
		{
			alert('Config become too large.');
			return;
		}
		
		// Save item [Prepare]
		// _______________________________________________________________________
		var SAVE_MAP_ARRAY = JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_PREPARE_MAPPED_ARRAY_FOR_SAVE();
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_ID", JSVC_NUM.VAR_NVALL(JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ID_TXT)));				
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_URL", JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_URL_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_CODE", JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_CODE_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_DESCRIPTION", JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_DESCRIPTION_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_LSTRING", JSOC_ELEMENT.VAR_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_LSTRING_TXT));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_SSTRING", JSOC_CMB.VAR_SELECTED_VALUE('DGVCALC_MODAL_CATEGORY_CUSTOMIZE_DGV_SELECTION_CMB'));					
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_BIGINT", 0);
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_ACC_LEVEL_ID", JSOC_CMB.VAR_SELECTED_VALUE(JSTOOL_CUSTOMIZE.DGVCALC.CAT_CUSTOM_ACC_LEVEL_ID_CMB));	
		JSVC_MAP_ARRAY.VAR_SET(SAVE_MAP_ARRAY, "PARAM_CAT_CUSTOM_STATUS", 2);

		// Declare Post Request Handler
		// _______________________________________________________________________
		var RESPONSE_HANDLER = function(IS_SUCCESS, HTTP_RESPONSE)
		{
			// Disable Dialogs
			// ...........................................
			CUS_SEND_DIALOG_TRY_DISMISS();
			
			// Handle Error
			// ...........................................
			if(IS_SUCCESS === false)
			{
				METHOD_UNABLE_TO_SEND_REQUEST(function(){});	
				return;
			}
			
			// Catch JSON Error
			// ...........................................
			else if(JSRC_JSON.REF_IS_JSTRING(HTTP_RESPONSE) == false)
			{
				METHOD_SERVER_ISSUE(function(){}, HTTP_RESPONSE);
				return;			
			}
				
			// Read Response
			// ...........................................
			else
			{
				// Load Response
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(HTTP_RESPONSE);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					METHOD_REQUEST_FAILURE(function(){}, JSON_OBJECT);
					return;
				}
				
				// Close Modal
				else
				{				
					JSTOOL_CUSTOMIZE.DGVCALC.SHOW_CONFIG_LIST_REFRESH(function(){});
					JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE", false);											
				}
			}
		};
			
			
		// Save Item [Send Request]
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_SAVE 
		(
			SAVE_MAP_ARRAY,
			RESPONSE_HANDLER
		);
	};
	
	
	
	// ===============================================================
	// Load Config Data
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.LOAD = function(CONFIG_URL, CONFIG_LEVEL, CALLBACK_METHOD)
	{
		// Actual Function
		// _______________________________________________________________________
		GET_MAP_ARRAY = JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_CUSTOM_URL', CONFIG_URL);	
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_CUSTOM_ACC_LEVEL_ID', CONFIG_LEVEL);
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_CUSTOM_CODE', JSCUS_CACHE.CONFIG_CODE + JSTOOL_CUSTOMIZE.DGVCALC.TOOL_TITLE);	
		/*
		JSVC_MAP_ARRAY.VAR_SET
		(
			GET_MAP_ARRAY, 'SEARCH_CAT_CUSTOM_ACC_ACCOUNT_ID_CMB', 'PARAM_CAT_CUSTOM_ACC_ACCOUNT_ID'
		);
		*/
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
				
				
		// LITE Search Mode
		// _______________________________________________________________________
		JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_GET_LITE
		(
			GET_MAP_ARRAY,
			function(IS_SUCCESS, RESPONSE_STRING)
			{
				// Disable Dialogs
				// ...........................................
				CUS_SEND_DIALOG_TRY_DISMISS();
				
				// Validate
				// ...........................................
				if(IS_SUCCESS === false)
				{
					console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
					alert("Failed to load the page configuration.");
					return;
				}
				
				// Validate JSON Response
				// ...........................................
				var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
				if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
				{
					console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
					alert("Failed to load the page configuration.");
					return;
				}
				
				// JSON Empty (Clears the DataGrodView)
				// ...........................................
				if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
				{
					CALLBACK_METHOD("");
					return;
				}
				else
				{
					CALLBACK_METHOD
					(
						JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_ID", 1),
						JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_LSTRING", 1),
						JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_SSTRING", 1),
						JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_ACC_LEVEL_ID", 1)
					);
					return;
				}

			},
			true
		);
	};
	
	
	
	// ====================================================================================



	// ===============================================================
	// Apply existing configurations and hide elements.
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.APPLY = function(DGV_CONTROL)
	{	
		// Validate JSON Response
		// _______________________________________________________________________	
		var JSON_OBJECT = JSRC_JSON.REF_CREATE(JSTOOL_CUSTOMIZE_CONFIG_DGV_CALC);
		if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
		{
			console.error("REQUEST ERROR: \n" + JSTOOL_CUSTOMIZE_CONFIG_DGV_CALC);
			alert("Failed to load the page configuration.");
			location.reload();
			return;
		}
		
		
		// Initialize
		// _______________________________________________________________________	
		var AUTO_CALCULATE = [];
		var AUTO_TOTAL = [];
		var AUTO_TOTAL_COPY_TO = [];
		
		var CURRENT_DATA_BLOCK = null;
		var CURRENT_DATA = null;
		var JSON_COUNT = JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT"));
		var JSON_INDEX = 0;
		
		
		// Hide Elements
		// _______________________________________________________________________	
		while(JSON_COUNT > JSON_INDEX)
		{
			// Skip unrelated DGV
			// ...........................................
			if(JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_SSTRING", JSON_INDEX + 1) != DGV_CONTROL.CACHE_MAIN_DIV_ID)
			{
				JSON_INDEX ++;
				continue;
			}
			
			// Retrieve Current Settings
			// ...........................................
			CURRENT_DATA_BLOCK = JSTOOL_CUSTOMIZE.DGVCALC.LIST_TO_ARRAY(JSRC_JSON.REF_READ(JSON_OBJECT, "CAT_CUSTOM_LSTRING", JSON_INDEX + 1));
			JSON_INDEX ++;
			
			
			// Prepare AutoCompute Config
			// ...........................................
			while(JSVC_ARR.VAR_EMPTY(CURRENT_DATA_BLOCK) == false)
			{
				CURRENT_DATA = CURRENT_DATA_BLOCK[0].split('::');
				
				// ~~~~~
				
				// Populate Auto Calculate
				if(JSVC_STR.VAR_IS_BLANK(CURRENT_DATA[0]) == false)
				{
					AUTO_CALCULATE.push
					(
						[
							CURRENT_DATA[0],
							CURRENT_DATA[1],
							JSVC_NUM.VAR_NVALBOOL(CURRENT_DATA[2])
						]
					);
				}
				
				// ~~~~~
				
				// Populate Auto Total and Copy To
				if(JSVC_NUM.VAR_NVALBOOL(CURRENT_DATA[3]) == true)
				{
					AUTO_TOTAL.push
					(
						CURRENT_DATA[0]
					);
					
					if(JSVC_STR.VAR_IS_BLANK(CURRENT_DATA[4]) == false)
					{
						AUTO_TOTAL_COPY_TO.push
						(
							[
								CURRENT_DATA[0], 
								CURRENT_DATA[4]
							]
						);
					}	
				}
				
				// ~~~~~

				CURRENT_DATA_BLOCK.shift();
			}
		}		
		
		
		// Handle Callback
		// _______________________________________________________________________	
		return [AUTO_CALCULATE, AUTO_TOTAL, AUTO_TOTAL_COPY_TO];
	};

	
	// ====================================================================================


	// ===============================================================
	// Part 0.B : Initialize Form
	// ===============================================================	
	JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV = null;	
	JSTOOL_CUSTOMIZE.DGVCALC.ADD_CMD = null;
	
	/** 
	 * Show Modal with configuration list
	 */
	JSTOOL_CUSTOMIZE.DGVCALC.SHOW_CONFIG_LIST = function()
	{
		//JSOC_DIALOG.VAR_MODAL("CATEGORY_CUSTOMIZE_MODAL_MAIN_MENU", false);	
		
		
		// Initialize
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV) == false)
		{
			// Initialize Modal
			JSTOOL_CUSTOMIZE.DGVCALC.INPUT_INSTANCE_EDIT = JSOC_WINDOW.VAR_INPUT_INSTANCE_CLONE("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT");			
		
			
			// Initialize DGV
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV = DataGridView("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT_DGV");
			JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.ON_CLICK
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					if(COL_INDEX == JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.COLUMN.INDEX("OPEN_BBI"))
					{
						JSTOOL_CUSTOMIZE.DGVCALC.SHOW
						(
							JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.CELL.VALUE
							(
								"CAT_CUSTOM_URL", ROW_INDEX
							),
							JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.CELL.VALUE
							(
								"CAT_CUSTOM_ACC_LEVEL_ID", ROW_INDEX
							)							
						);
					}
				}
			);   				
			
			// Initialize: Button
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.ADD_CMD = JSOC_ELEMENT.VAR_GET("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT_ADD_CMD");
			JSTOOL_CUSTOMIZE.DGVCALC.ADD_CMD.onclick = function()
			{
				JSTOOL_CUSTOMIZE.DGVCALC.SHOW("");
			};	
		}
		
		// Load Stored Configurations
		// _______________________________________________________________________
		JSTOOL_CUSTOMIZE.DGVCALC.SHOW_CONFIG_LIST_REFRESH
		(
			function(IS_SUCCESS)
			{
				// Abort on failure
				// ...........................................
				if(IS_SUCCESS == false)
				{
					return;
				}
				
				// Show Modal
				// ...........................................
				JSOC_DIALOG.VAR_MODAL("DGVCALC_MODAL_CATEGORY_CUSTOMIZE_EDIT", true);			
			}
		);
	};
	
	/** 
	 * Populate Configuration List DGV
	 */
	JSTOOL_CUSTOMIZE.DGVCALC.SHOW_CONFIG_LIST_REFRESH = function(CALLBACK_METHOD)
	{	
		// Handle Callback of requesting Config data from server 
		// _______________________________________________________________________
		var CALLBACK_CONFIG = function(IS_SUCCESS, RESPONSE_STRING)
		{
			// Disable Dialogs
			// ...........................................
			CUS_SEND_DIALOG_TRY_DISMISS();
			
			// Validate
			// ...........................................
			if(IS_SUCCESS === false)
			{
				console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
				alert("Failed to load the page configuration.");
				CALLBACK_METHOD(false);
				return;
			}
			
			// Validate JSON Response
			// ...........................................
			var JSON_OBJECT = JSRC_JSON.REF_CREATE(RESPONSE_STRING);
			if(JSRC_JSON.REF_IS_SUCCESS(JSON_OBJECT) === false)
			{
				console.error("REQUEST ERROR: \n" + RESPONSE_STRING);
				alert("Failed to load the page configuration.");
				CALLBACK_METHOD(false);
				return;
			}
			
			// JSON Empty (Clears the DataGrodView)
			// ...........................................
			if(JSVC_NUM.VAR_NVALL(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT")) <= 0)
			{
				JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.ROW.CLEAR();
				CALLBACK_METHOD(true);
				return;
			}
			
			// Populate DGV
			// ...........................................
			JSTOOL_CUSTOMIZE.DGVCALC.EDIT_DGV.POPULATE_FROM_QUERY
			(
					JSON_OBJECT, 
					'',
					false,
					false,
					1,
					[2, 1]
			);
			
			CALLBACK_METHOD(true);
			return;
		};

		
		// Populate Parameters
		// _______________________________________________________________________
		GET_MAP_ARRAY = JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();		
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_CUSTOM_URL', JSVC_URL._CURRENT.VAR_PATH());	
		JSVC_MAP_ARRAY.VAR_SET(GET_MAP_ARRAY, 'PARAM_CAT_CUSTOM_CODE', JSCUS_CACHE.CONFIG_CODE + JSTOOL_CUSTOMIZE.DGVCALC.TOOL_TITLE);		

		// Send Request
		// _______________________________________________________________________
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._CUSTOMIZE.CUS_GET_RELATED
		(
			GET_MAP_ARRAY,
			CALLBACK_CONFIG
		);
	};
	
	
	
	// ===============================================================	
	// Load Required Script
	// ===============================================================	
	if(typeof JSCUS_SQL._ACCOUNT._LEVEL == 'undefined')
	{
		document.write('<script src="' + JSCUS_CACHE.SERVER_URL + '\/res\/comm\/account\/level.js"><\/script>');
	}

	