// NOTE: [This JS must loaded as last item]
function SELECT_MODAL_CATEGORY_PROPERTY(){};

	// ===============================================================
	// Part 0 : Initialize Form
	// ===============================================================	
	SELECT_MODAL_CATEGORY_PROPERTY.DGV = null;
	SELECT_MODAL_CATEGORY_PROPERTY.SEARCH_CMD = null;
	SELECT_MODAL_CATEGORY_PROPERTY.APPLY_CMD = null;
	SELECT_MODAL_CATEGORY_PROPERTY.INPUT_INSTANCE = null;
	
	SELECT_MODAL_CATEGORY_PROPERTY.PRESET_MAP_ARRAY = null;
	SELECT_MODAL_CATEGORY_PROPERTY.AUTO_SELECT = false;
	
	SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY = null;
	SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
	SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_METHOD = null;
	SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_CONTROL = null;
	
	SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PREV_BBI = null;
	SELECT_MODAL_CATEGORY_PROPERTY.LOAD_NEXT_BBI = null;
	SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB = null;

	// ===============================================================
	// 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.
	 */	
	SELECT_MODAL_CATEGORY_PROPERTY.SHOW = function
	(
		CALLBACK_METHOD, CALLBACK_CONTROL, GET_MAP_ARRAY
	)
	{
		// Initialize
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(SELECT_MODAL_CATEGORY_PROPERTY.DGV) == false)
		{
			// Initialize Modal and DGV
			// ...........................................
			SELECT_MODAL_CATEGORY_PROPERTY.DGV = DataGridView("SELECT_MODAL_CATEGORY_PROPERTY_DGV");
			SELECT_MODAL_CATEGORY_PROPERTY.DGV.ON_CLICK
			(			
				function(COL_INDEX, ROW_INDEX)
				{
					if(COL_INDEX != SELECT_MODAL_CATEGORY_PROPERTY.DGV.COLUMN.INDEX("ROW_IS_SELECTED"))
					{
						SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.VALUE("ROW_IS_SELECTED", ROW_INDEX, true);
					}
				}
			);   	
			SELECT_MODAL_CATEGORY_PROPERTY.INPUT_INSTANCE = JSOC_WINDOW.VAR_INPUT_INSTANCE_CLONE("SELECT_MODAL_CATEGORY_PROPERTY");		

			// Initialize: Load more items to the list
			// ...........................................
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_PREV_BBI"))
			{
	    		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PREV_BBI = JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_PREV_BBI");  
				SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PREV_BBI.onclick = 
					function()
					{
						var CURRENT_INDEX = JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB);
						if(CURRENT_INDEX > 0)
						{
							JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB, CURRENT_INDEX - 1);
							SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB.onchange();
						}
					};
			}		
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_NEXT_BBI"))
			{
	    		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_NEXT_BBI = JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_NEXT_BBI");  
				SELECT_MODAL_CATEGORY_PROPERTY.LOAD_NEXT_BBI.onclick = 
					function()
					{
						var CURRENT_INDEX = JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB);
						if(CURRENT_INDEX + 1 < JSOC_CMB.VAR_COUNT(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB))
						{
							JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB, CURRENT_INDEX + 1);
							SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB.onchange();
						}
					};
			}		
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_PAGING_CMB"))
			{
	    		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB = JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY_LOAD_PAGING_CMB");  
				SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB.onchange = 
					function()
					{
						SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_LOAD_PAGE();
					};
			}
			
			// Initialize: Button
			// ...........................................
			SELECT_MODAL_CATEGORY_PROPERTY.SEARCH_CMD = JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CMD");
			SELECT_MODAL_CATEGORY_PROPERTY.SEARCH_CMD.onclick =
				function()
				{
					SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH();
				};
			
			SELECT_MODAL_CATEGORY_PROPERTY.APPLY_CMD = JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY_APPLY_CMD");
			SELECT_MODAL_CATEGORY_PROPERTY.APPLY_CMD.onclick = 
				function()
				{
					SELECT_MODAL_CATEGORY_PROPERTY.DIALOG_OK();
				};
		}
		
		// Copy params to cache
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_METHOD = CALLBACK_METHOD;
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_CONTROL = CALLBACK_CONTROL;
		SELECT_MODAL_CATEGORY_PROPERTY.PRESET_MAP_ARRAY = GET_MAP_ARRAY;
		
		// Display Modal
		// _______________________________________________________________________
		JSOC_WINDOW.VAR_INPUT_INSTANCE_RESTORE(SELECT_MODAL_CATEGORY_PROPERTY.INPUT_INSTANCE);
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY = null;
		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
		
		if(JSVC_VAR.VAR_ISSET(GET_MAP_ARRAY) == false)
		{
			JSOC_DIALOG.VAR_MODAL("SELECT_MODAL_CATEGORY_PROPERTY", true);
			SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH();
		}
		else
		{
			SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_PRESET(GET_MAP_ARRAY);
		}
	};
	
	
	// ===============================================================
	// Part 2.A : Search Option
	// ===============================================================
	SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH = function()
	{
		// Actual Function
		// _______________________________________________________________________
		var GET_MAP_ARRAY = JSCUS_SQL._CATEGORY._PROPERTY.CUS_PREPARE_MAPPED_ARRAY_FOR_GET();	
		SELECT_MODAL_CATEGORY_PROPERTY.AUTO_SELECT = false;
		
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_DESCRIPTION_TXT', 'PARAM_CAT_PROPERTY_DESCRIPTION'
		);	
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_STRING_TXT', 'PARAM_CAT_PROPERTY_STRING'
		);	
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_NUMERIC_FROM_TXT', 'PARAM_CAT_PROPERTY_NUMERIC_FROM'
		);
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_NUMERIC_TO_TXT', 'PARAM_CAT_PROPERTY_NUMERIC_TO'
		);
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_DECIMAL_FROM_TXT', 'PARAM_CAT_PROPERTY_DECIMAL_FROM'
		);
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_DECIMAL_TO_TXT', 'PARAM_CAT_PROPERTY_DECIMAL_TO'
		);
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_CAT_PROPERTY_STATUS_CMB', 'PARAM_CAT_PROPERTY_STATUS'
		);
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_ORDER_BY_CMB', 'PARAM_ORDER_FIELD'
		);	
		JSCUS_SQL._ADD_FROM
		(
			GET_MAP_ARRAY, 'SELECT_MODAL_CATEGORY_PROPERTY_SEARCH_LIMIT_CMB', 'PARAM_LIMIT'
		);	
					
		// REGULAR Search Mode
		// _______________________________________________________________________	
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._PROPERTY.CUS_GET
		(
			GET_MAP_ARRAY,
			SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_CALLBACK,
			true
		); 			
		
		// Update Paging Cache
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY = GET_MAP_ARRAY;
	};


	SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_PRESET = function(PREPARED_MAP_ARRAY)
	{	
		// Pre-populate Elements
		// _______________________________________________________________________	
		SELECT_MODAL_CATEGORY_PROPERTY.AUTO_SELECT = true;
					
		// REGULAR Search Mode
		// _______________________________________________________________________	
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._PROPERTY.CUS_GET
		(
			PREPARED_MAP_ARRAY,
			SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_CALLBACK,
			true
		); 			
		
		// Update Paging Cache
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY = GET_MAP_ARRAY;
	};
		
	
	// ===============================================================
	// Part 2.B : Search Pagination
	// ===============================================================
	SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_LOAD_PAGE = function()
	{
		// Abort if no GET cache is found
		// _______________________________________________________________________		
		if
		(
			JSVC_VAR.VAR_ISSET(SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY) == false ||
			JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB) < 0
		)
		{
			return;
		}
		
		// Update Paging row count
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY['PARAM_SKIP'] = 
		JSVC_NUM.VAR_NVALL(SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY['PARAM_LIMIT']) *
		JSOC_CMB.VAR_SELECTED_INDEX(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB);	
		
		// REGULAR Search Mode
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST = true;
		JSOC_DIALOG.VAR_LOADING_SPINNER(true);
		JSCUS_SQL._CATEGORY._PROPERTY.CUS_GET
		(
			SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY,
			function (IS_SUCCESS, RESPONSE_STRING)
			{
				SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_CALLBACK(IS_SUCCESS, RESPONSE_STRING, false);
			},
			true
		);
	};

	// ===============================================================
	// Part 2.C : Search Paging Control
	// ===============================================================	
	SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_LOAD_PAGING_UPDATE = function(ROW_COUNT)
	{
		// Abort if no paging function enabled
		// _______________________________________________________________________
		if
		(
			JSVC_VAR.VAR_ISSET(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB) == false || 
			SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST == true
		)
		{
			SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
			return;
		}
		
		// Initialize
		// _______________________________________________________________________
		var PAGING_INDEX = 0;
		var PAGING_COUNT = 
			ROW_COUNT / JSVC_NUM.VAR_NVALL(SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY['PARAM_LIMIT']);
		PAGING_COUNT = Math.trunc(PAGING_COUNT) + 1;
		JSOC_CMB.VAR_CLEAR(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB);
		
		// Populate Paging
		// _______________________________________________________________________
		while(PAGING_COUNT > PAGING_INDEX)
		{
			JSOC_CMB.VAR_ADD
			(
				SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_CMB, 
				(PAGING_INDEX + 1).toString(), 
				(PAGING_INDEX + 1).toString()
			);
			PAGING_INDEX ++;
		}
	};
	
	
	// ===============================================================
	// Part 2.D : Search Search Handler
	// ===============================================================	
	SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_CALLBACK = function(IS_SUCCESS, RESPONSE_STRING, KEEP_DGV_ITEMS = false)
	{
		// Disable Dialogs
		// _______________________________________________________________________
		CUS_SEND_DIALOG_TRY_DISMISS();
		
		// Validate
		// _______________________________________________________________________
		if(IS_SUCCESS === false)
		{
			console.error("CONNECTION ERROR: \n" + RESPONSE_STRING);
			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);
			return;
		}
		
		// Back to DGV Top
		// _______________________________________________________________________	
		if(SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST == true)
		{
			JSOC_ELEMENT.VAR_GET("SELECT_MODAL_CATEGORY_PROPERTY.DGV").scrollIntoView
			(
				{
			  		behavior: 'auto', 
			  		block: 'start'
				}
			);		
		}
		
		// JSON Empty (Clears the DataGrodView)
		// _______________________________________________________________________
		if(JSRC_JSON.REF_READ(JSON_OBJECT, "JSON_COUNT") <= 0)
		{
			SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_LOAD_PAGING_UPDATE(0);
			SELECT_MODAL_CATEGORY_PROPERTY.DGV.ROW.CLEAR();
			if(SELECT_MODAL_CATEGORY_PROPERTY.DGV.COLUMN.TOTAL_IS_READY())
			{
				SELECT_MODAL_CATEGORY_PROPERTY.DGV.COLUMN.TOTAL_REFRESH();
			}
			return;
		}
		SELECT_MODAL_CATEGORY_PROPERTY.HTTP_SEARCH_LOAD_PAGING_UPDATE
		(
			JSVC_NUM.VAR_NVALL
			(
				JSRC_JSON.REF_READ(JSON_OBJECT, "RECORD_COUNT", 1)
			)
		);
		
		// Populate DGV
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.DGV.POPULATE_FROM_QUERY
		(
				JSON_OBJECT, 
				'',
				KEEP_DGV_ITEMS,
				false,
				SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY['PARAM_SKIP'] + 1,
				[2, 1]
		);

		
		// Initialize
		// _______________________________________________________________________	
		var WEBTABLE_DATE = null;
		var CURRENT_CELL_VALUE = null;
		var ROW_INDEX = 0;
	
	
		// DateTime Format
		// _______________________________________________________________________	
		
		
		// Color Coding (Uncomment to use)
		// _______________________________________________________________________	
		//SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#1cc88a"; // Safe
		//SELECT_MODAL_CATEGORY_PROPERTY_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#5a5c69"; // Neutral
		//SELECT_MODAL_CATEGORY_PROPERTY_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#f6c23e"; // Caution
		//SELECT_MODAL_CATEGORY_PROPERTY_DGV.CELL.ELEMENT("COLUMN_NAME", ROW_INDEX).style.color = "#e74a3b"; // Warning


		// Auto-total tool
		// _______________________________________________________________________	
		if(SELECT_MODAL_CATEGORY_PROPERTY.DGV.COLUMN.TOTAL_IS_READY())
		{
			SELECT_MODAL_CATEGORY_PROPERTY.DGV.COLUMN.TOTAL_REFRESH();
		}
		
		// Auto Dismiss
		if(SELECT_MODAL_CATEGORY_PROPERTY.AUTO_SELECT == true)
		{
			// If rows exists
			if(SELECT_MODAL_CATEGORY_PROPERTY.DGV.ROW.COUNT() > 0)
			{
				SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.VALUE("ROW_IS_SELECTED", 0, true);
				SELECT_MODAL_CATEGORY_PROPERTY.DIALOG_OK();
			}
			
			// If no result found
			else
			{
				console.log('SELECT_MODAL_CATEGORY_PROPERTY : Preset not found');
				console.log(['SELECT_MODAL_CATEGORY_PROPERTY.PRESET_MAP_ARRAY', SELECT_MODAL_CATEGORY_PROPERTY.PRESET_MAP_ARRAY]);
				alert('Unable to populate property : selmodal');
			}
			SELECT_MODAL_CATEGORY_PROPERTY.DIALOG_OK();
		}
	};
				
				
	// ===============================================================
	// Part 3 : Return Selected Item
	// ===============================================================	
	SELECT_MODAL_CATEGORY_PROPERTY.DIALOG_OK = function()
	{
		// Initialize
		// _______________________________________________________________________
		var ROW_COUNT = SELECT_MODAL_CATEGORY_PROPERTY.DGV.ROW.COUNT();
		var ROW_INDEX = 0;
		
		var SELECTED_ID = -1;
		var SELECTED_DESCRIPTION = 'Not Selected';
		var CALLBACK_ELEMENT = SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_CONTROL;
		var CALLBACK_METHOD = SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_METHOD;
		
		
		// Get selected option
		// _______________________________________________________________________
		while(ROW_COUNT > ROW_INDEX)
		{
			if(SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.VALUE('ROW_IS_SELECTED', ROW_INDEX))
			{
				SELECTED_ID = SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.VALUE('CAT_PROPERTY_ID', ROW_INDEX);
				SELECTED_DESCRIPTION = SELECT_MODAL_CATEGORY_PROPERTY.DGV.CELL.VALUE('CAT_PROPERTY_DESCRIPTION', ROW_INDEX);
				break;
			}
			ROW_INDEX ++;
		}
		

		// Dismiss Cache
		// _______________________________________________________________________
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_MAP_ARRAY = null;
		SELECT_MODAL_CATEGORY_PROPERTY.LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_METHOD = null;
		SELECT_MODAL_CATEGORY_PROPERTY.CACHE_CALLBACK_CONTROL = null;
		
				
		// Handle Callback by control
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(CALLBACK_ELEMENT) && SELECTED_ID >= 0)
		{
			// Initialize
			// ...........................................
			CALLBACK_ELEMENT = JSOC_ELEMENT.VAR_GET(CALLBACK_ELEMENT);
			
			// Combobox
			// ...........................................
			if(JSVC_STR.VAR_LCASE(CALLBACK_ELEMENT.tagName) == 'select')
			{
				// Exists on dropdown
				if(JSOC_CMB.VAR_IS_KEY_EXISTS(CALLBACK_ELEMENT, SELECTED_ID))
				{
					JSOC_CMB.VAR_SELECTED_VALUE(CALLBACK_ELEMENT, SELECTED_ID);
					if(JSOC_CMB.VAR_SELECTED_TEXT(CALLBACK_ELEMENT) == '-ONLOAD_DATA_NOT_FOUND-')
					{
						JSOC_CMB.VAR_TEXT
						(
							CALLBACK_ELEMENT, 
							JSOC_CMB.VAR_SELECTED_INDEX(CALLBACK_ELEMENT),
							SELECTED_DESCRIPTION
						);
					}
				}
				
				// Add new item to dropdown
				else
				{
					JSOC_CMB.VAR_ADD(CALLBACK_ELEMENT, SELECTED_ID, SELECTED_DESCRIPTION);
					JSOC_CMB.VAR_SELECTED_VALUE(CALLBACK_ELEMENT, SELECTED_ID);
				}
			}
			
			// Other Input 
			// ...........................................
			else
			{
				JSOC_ELEMENT.VAR_VALUE(CALLBACK_ELEMENT, SELECTED_ID);
			}
		}
		
		
		// Handle Callback method
		// _______________________________________________________________________
		if(JSVC_VAR.VAR_ISSET(CALLBACK_METHOD))
		{
			CALLBACK_METHOD(SELECTED_ID, SELECTED_DESCRIPTION);
		}
		
		
		// Close Modal
		// _______________________________________________________________________	
		JSOC_DIALOG.VAR_MODAL("SELECT_MODAL_CATEGORY_PROPERTY", false);
	};
	
	
	// ===============================================================	
	// Load Required Script
	// ===============================================================	
	if(typeof JSCUS_SQL._CATEGORY._PROPERTY == 'undefined')
	{
		document.write('<script src="' + JSCUS_CACHE.SERVER_URL + '\/res\/comm\/category\/property.js"><\/script>');
	}
