	// ===============================================================
	// Global Var
	// ===============================================================
	
	// Edit Handler
	// _______________________________________________________________________
	var EDIT_HANDLER = function(){};	
	EDIT_HANDLER.REF_IS_MODIFIED = false;
	EDIT_HANDLER.HAS_NEWLY_SAVED_DATA = false;
	var PROPERTY_PARENT_ID = 0;
	var PROPERTY_PARENT_DESCRIPTION = "";
	
	
	// Cache
	// _______________________________________________________________________
	var PROPERTY_REC_SMS_ID = -1;
	var PROPERTY_EDIT_MODE = false;
	var PROPERTY_EDIT_ROW_INDEX = -1;
	var INPUT_INSTANCE = null;
	
	
	// Buttons [Optional]
	// _______________________________________________________________________
	var ADD_BBI = null;
	var SAVE_BBI = null;
	var DELETE_BBI = null;
	var CANCEL_BBI = null;
	var NAVIGATION_BACK_BBI = null;
	var LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
	
	var LOAD_MORE_BBI = null;
	var LOAD_PREV_BBI = null;
	var LOAD_NEXT_BBI = null;
	var LOAD_PAGING_CMB = null;
	var LOAD_PAGING_IGNORE_NEXT_REQUEST = false;
	
	var SEARCH_CMD = null;
	var PRINT_BBI = null;
	var EXPORT_BBI = null;
	
	
	// Dialog Controls [Optional]
	// _______________________________________________________________________
	var REC_SMS_MESSAGE_TXT = null;
	var REC_SMS_PHONE_TXT = null;
	var REC_SMS_DATE_SCHEDULE_DTP = null;
	var REC_SMS_STATUS_CMB = null;
	var PARAM_REC_SMS_ID_FILE_FP = null;
	
	
	// DGV Controls
	// _______________________________________________________________________
	var HISTORY_DGV = null;
	var HISTORY_LAST_GET_MAP_ARRAY = null;

	// ===============================================================
	// Initialize Controls
	// ===============================================================     
	function FORM_INITIALIZE()
	{
		// Load Cache Parent Data [Add Redirects if this is a required data.]
		// ...........................................
		if(JSVC_COOKIE.VAR_ISSET("PROPERTY_PARENT_ID_HISTORY"))
		{
			PROPERTY_PARENT_ID = JSVC_COOKIE.VAR_READ("PROPERTY_PARENT_ID_HISTORY");
		}	
		else
		{
			//window.location = JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS];
			//window.close();
		}
		if(JSVC_COOKIE.VAR_ISSET("PROPERTY_PARENT_DESCRIPTION_HISTORY"))
		{
			PROPERTY_PARENT_DESCRIPTION = JSVC_COOKIE.VAR_READ("PROPERTY_PARENT_DESCRIPTION_HISTORY");
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PAGE_PARENT_DESCRIPTION_TXT") == true)
			{
				JSOC_ELEMENT.VAR_VALUE("PAGE_PARENT_DESCRIPTION_TXT", PROPERTY_PARENT_DESCRIPTION);			
			}
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PAGE_PARENT_DESCRIPTION_LBL") == true)
			{
				JSOC_ELEMENT.VAR_VALUE("PAGE_PARENT_DESCRIPTION_LBL", PROPERTY_PARENT_DESCRIPTION);			
			}
			if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PAGE_TITLE_LBL") == true)
			{
				JSOC_ELEMENT.VAR_VALUE("PAGE_TITLE_LBL", JSOC_ELEMENT.VAR_VALUE("PAGE_TITLE_LBL") + " : " + PROPERTY_PARENT_DESCRIPTION);	
			}
		}	
		else
		{
			//window.location = JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS];	
		}
	
		// Restore Cache on reload
		// ...........................................	
		if
		(
			JSVC_COOKIE.VAR_ISSET("PROPERTY_PARENT_ID_HISTORY") || 
			JSVC_COOKIE.VAR_ISSET("PROPERTY_PARENT_DESCRIPTION_HISTORY")
		)
		{
			  window.onbeforeunload = function(event)
			  {
					// Get Current Root path
					var CURRENT_ROOT_PATH = JSCUS_CACHE.ROOT_PATH + JSVC_STR.VAR_MID(JSVC_STR.VAR_DLEFT(JSCUS_CACHE.AUTH_REDIRECT_URL[JSCUS_CACHE.LOGIN_CLASS], JSCUS_CACHE.SERVER_URL.length), 1, 1);
				
					// Cache Primary Key
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_ID_HISTORY', 
						PROPERTY_PARENT_ID, 
						5, 
						CURRENT_ROOT_PATH
					);
					
					// Cache Description
					JSVC_COOKIE.VAR_ADD
					(
						'PROPERTY_PARENT_DESCRIPTION_HISTORY', 
						PROPERTY_PARENT_DESCRIPTION, 
						5, 
						CURRENT_ROOT_PATH
					);
			  };
		}
		
 		// Cache Class Properties
		// ...........................................
		if(JSVC_COOKIE.VAR_ISSET("PROPERTY_REC_SMS_ID"))
		{
			PROPERTY_REC_SMS_ID = JSVC_COOKIE.VAR_READ("PROPERTY_REC_SMS_ID");
		}	
		if(JSVC_COOKIE.VAR_ISSET("PROPERTY_EDIT_MODE"))
		{
			PROPERTY_EDIT_MODE = JSVC_COOKIE.VAR_READ("PROPERTY_REC_SMS_ID");
		}
	
		// Initialize: Modals
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("HISTORY_MODAL") == true)
		{
			// Display Modal
			JSOC_DIALOG.VAR_MODAL("HISTORY_MODAL", false);
		}

		// Initialize: Load more items to the list
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("LOAD_MORE_BBI"))
		{
    		LOAD_MORE_BBI = JSOC_ELEMENT.VAR_GET("LOAD_MORE_BBI");  
			LOAD_MORE_BBI.onclick = 
				function()
				{
					HTTP_SEARCH_LOAD_MORE();
				};
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("LOAD_PREV_BBI"))
		{
    		LOAD_PREV_BBI = JSOC_ELEMENT.VAR_GET("LOAD_PREV_BBI");  
			LOAD_PREV_BBI.onclick = 
				function()
				{
					var CURRENT_INDEX = JSOC_CMB.VAR_SELECTED_INDEX(LOAD_PAGING_CMB);
					if(CURRENT_INDEX > 0)
					{
						JSOC_CMB.VAR_SELECTED_INDEX(LOAD_PAGING_CMB, CURRENT_INDEX - 1);
						LOAD_PAGING_CMB.onchange();
					}
				};
		}		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("LOAD_NEXT_BBI"))
		{
    		LOAD_NEXT_BBI = JSOC_ELEMENT.VAR_GET("LOAD_NEXT_BBI");  
			LOAD_NEXT_BBI.onclick = 
				function()
				{
					var CURRENT_INDEX = JSOC_CMB.VAR_SELECTED_INDEX(LOAD_PAGING_CMB);
					if(CURRENT_INDEX + 1 < JSOC_CMB.VAR_COUNT(LOAD_PAGING_CMB))
					{
						JSOC_CMB.VAR_SELECTED_INDEX(LOAD_PAGING_CMB, CURRENT_INDEX + 1);
						LOAD_PAGING_CMB.onchange();
					}
				};
		}		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("LOAD_PAGING_CMB"))
		{
    		LOAD_PAGING_CMB = JSOC_ELEMENT.VAR_GET("LOAD_PAGING_CMB");  
			LOAD_PAGING_CMB.onchange = 
				function()
				{
					HTTP_SEARCH_LOAD_PAGE();
				};
		}
		
		// Initialize: Ribbon Buttons [Add Search]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_CMD"))
		{
			SEARCH_CMD = JSOC_ELEMENT.VAR_GET("SEARCH_CMD");
			SEARCH_CMD.onclick = function(){HTTP_SEARCH()};
		}		

		// Initialize: Ribbon Buttons [Add Print]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PRINT_BBI"))
		{
			PRINT_BBI = JSOC_ELEMENT.VAR_GET("PRINT_BBI");
			PRINT_BBI.onclick = function()
			{
				window.print();
			};
		}		
		
		// Initialize: Ribbon Buttons [Add Search]
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("EXPORT_BBI"))
		{
			EXPORT_BBI = JSOC_ELEMENT.VAR_GET("EXPORT_BBI");
			EXPORT_BBI.onclick = function()
			{
				JSRC_EXCEL.REF_EXPORT('HISTORY_DGV');
			};
		}		

		
		// Prepare onChange event
		// ...........................................
		var ON_CHANGE_EVENT = '';
		
		
		// Initialize: Input Controls
		// ...........................................
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_ID_TXT"))
		{
			REC_SMS_ID_TXT = JSOC_ELEMENT.VAR_GET("REC_SMS_ID_TXT");      
			REC_SMS_ID_TXT.onchange = 
				function()
				{
					if(REC_SMS_ID_TXT.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_ID_TXT.onkeypress = function(){REC_SMS_ID_TXT.onchange();};
			REC_SMS_ID_TXT.onpaste = function(){REC_SMS_ID_TXT.onchange();};
			REC_SMS_ID_TXT.oninput = function(){REC_SMS_ID_TXT.onchange();};
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_ACC_GROUP_ID_CMB"))
		{
			REC_SMS_ACC_GROUP_ID_CMB = JSOC_ELEMENT.VAR_GET("REC_SMS_ACC_GROUP_ID_CMB");      	
			REC_SMS_ACC_GROUP_ID_CMB.onchange = 
				function()
				{
					if(REC_SMS_ACC_GROUP_ID_CMB.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_ACC_GROUP_ID_CMB.onkeypress = function(){REC_SMS_ACC_GROUP_ID_CMB.onchange();};
			REC_SMS_ACC_GROUP_ID_CMB.onpaste = function(){REC_SMS_ACC_GROUP_ID_CMB.onchange();};
			REC_SMS_ACC_GROUP_ID_CMB.oninput = function(){REC_SMS_ACC_GROUP_ID_CMB.onchange();};							
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_MESSAGE_TXT"))
		{
			REC_SMS_MESSAGE_TXT = JSOC_ELEMENT.VAR_GET("REC_SMS_MESSAGE_TXT");      
			REC_SMS_MESSAGE_TXT.onchange = 
				function()
				{
					if(REC_SMS_MESSAGE_TXT.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_MESSAGE_TXT.onkeypress = function(){REC_SMS_MESSAGE_TXT.onchange();};
			REC_SMS_MESSAGE_TXT.onpaste = function(){REC_SMS_MESSAGE_TXT.onchange();};
			REC_SMS_MESSAGE_TXT.oninput = function(){REC_SMS_MESSAGE_TXT.onchange();};
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_PHONE_TXT"))
		{
			REC_SMS_PHONE_TXT = JSOC_ELEMENT.VAR_GET("REC_SMS_PHONE_TXT");      
			REC_SMS_PHONE_TXT.onchange = 
				function()
				{
					if(REC_SMS_PHONE_TXT.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_PHONE_TXT.onkeypress = function(){REC_SMS_PHONE_TXT.onchange();};
			REC_SMS_PHONE_TXT.onpaste = function(){REC_SMS_PHONE_TXT.onchange();};
			REC_SMS_PHONE_TXT.oninput = function(){REC_SMS_PHONE_TXT.onchange();};
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_DATE_REQUEST_DTP"))
		{
			REC_SMS_DATE_REQUEST_DTP = JSOC_ELEMENT.VAR_GET("REC_SMS_DATE_REQUEST_DTP");   
			JSOC_ELEMENT.VAR_VALUE(REC_SMS_DATE_REQUEST_DTP, JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD" + "T00:00"));
			REC_SMS_DATE_REQUEST_DTP.onchange = 
				function()
				{
					if(REC_SMS_DATE_REQUEST_DTP.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_DATE_REQUEST_DTP.onkeypress = function(){REC_SMS_DATE_REQUEST_DTP.onchange();};
			REC_SMS_DATE_REQUEST_DTP.onpaste = function(){REC_SMS_DATE_REQUEST_DTP.onchange();};
			REC_SMS_DATE_REQUEST_DTP.oninput = function(){REC_SMS_DATE_REQUEST_DTP.onchange();};					
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_REQUEST_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_REQUEST_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_REQUEST_FROM_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_REQUEST_FROM_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', -7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_REQUEST_TO_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_REQUEST_TO_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', 7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_DATE_SCHEDULE_DTP"))
		{
			REC_SMS_DATE_SCHEDULE_DTP = JSOC_ELEMENT.VAR_GET("REC_SMS_DATE_SCHEDULE_DTP");   
			JSOC_ELEMENT.VAR_VALUE(REC_SMS_DATE_SCHEDULE_DTP, JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD" + "T00:00"));
			REC_SMS_DATE_SCHEDULE_DTP.onchange = 
				function()
				{
					if(REC_SMS_DATE_SCHEDULE_DTP.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_DATE_SCHEDULE_DTP.onkeypress = function(){REC_SMS_DATE_SCHEDULE_DTP.onchange();};
			REC_SMS_DATE_SCHEDULE_DTP.onpaste = function(){REC_SMS_DATE_SCHEDULE_DTP.onchange();};
			REC_SMS_DATE_SCHEDULE_DTP.oninput = function(){REC_SMS_DATE_SCHEDULE_DTP.onchange();};					
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SCHEDULE_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SCHEDULE_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SCHEDULE_FROM_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SCHEDULE_FROM_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', -7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SCHEDULE_TO_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SCHEDULE_TO_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', 7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_DATE_SENT_DTP"))
		{
			REC_SMS_DATE_SENT_DTP = JSOC_ELEMENT.VAR_GET("REC_SMS_DATE_SENT_DTP");   
			JSOC_ELEMENT.VAR_VALUE(REC_SMS_DATE_SENT_DTP, JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD" + "T00:00"));
			REC_SMS_DATE_SENT_DTP.onchange = 
				function()
				{
					if(REC_SMS_DATE_SENT_DTP.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_DATE_SENT_DTP.onkeypress = function(){REC_SMS_DATE_SENT_DTP.onchange();};
			REC_SMS_DATE_SENT_DTP.onpaste = function(){REC_SMS_DATE_SENT_DTP.onchange();};
			REC_SMS_DATE_SENT_DTP.oninput = function(){REC_SMS_DATE_SENT_DTP.onchange();};					
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SENT_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SENT_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_NOW(), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SENT_FROM_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SENT_FROM_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', -7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("SEARCH_REC_SMS_DATE_SENT_TO_DTP"))
		{
			JSOC_ELEMENT.VAR_VALUE("SEARCH_REC_SMS_DATE_SENT_TO_DTP", JSVC_DATE.VAR_FORMAT(JSVC_DATE.VAR_ADD('DAY', 7, JSVC_DATE.VAR_NOW()), "YYYY-MM-DD") + "T00:00");
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REC_SMS_STATUS_CMB"))
		{
			REC_SMS_STATUS_CMB = JSOC_ELEMENT.VAR_GET("REC_SMS_STATUS_CMB");      	
			REC_SMS_STATUS_CMB.onchange = 
				function()
				{
					if(REC_SMS_STATUS_CMB.disabled == false)
					{
						EDIT_HANDLER.REF_IS_MODIFIED = true;
					}
				};
			REC_SMS_STATUS_CMB.onkeypress = function(){REC_SMS_STATUS_CMB.onchange();};
			REC_SMS_STATUS_CMB.onpaste = function(){REC_SMS_STATUS_CMB.onchange();};
			REC_SMS_STATUS_CMB.oninput = function(){REC_SMS_STATUS_CMB.onchange();};							
		}
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("PARAM_REC_SMS_ID_FILE_FP"))
		{
			PARAM_REC_SMS_ID_FILE_FP = JSOC_ELEMENT.VAR_GET("PARAM_REC_SMS_ID_FILE_FP");
		}

		
		// Initialize: Default Settings
		// ...........................................
		// FORM_PREPARE_DEFAULT_SETTINGS();   	
	}