
	var PROPERTY_PARENT_ID = 0;
	var PROPERTY_REC_JORDER_ID = 0;
	var PROPERTY_REC_JORDER_CODE = '';

	var JOB_ORDER_DGV = null;
	var JOB_ORDER_TASK_DELIVER_DGV = null;
	var JOB_ORDER_TASK_RETURN_DGV = null;

	var SEARCH_REC_JORDER_DATE_POST_CMB = null;
	var SEARCH_REC_JORDER_DATE_ASSIGN_CMB = null;
	var SEARCH_REC_JORDER_DATE_COMPLETE_CMB = null;
	var SEARCH_REC_JORDER_DATETIME_A_CMB = null;
	var SEARCH_REC_JORDER_DATETIME_B_CMB = null;

	var APPROVE_BBI = null;
	var DELIVERED_BBI = null;
	var CANCEL_BBI = null;
	var REJECT_BBI = null;
	var SEARCH_CMD = null;
	var EXPORT_BBI = null;

	var STATUS_ID = 0;
	var CMB_STATUS_IDENTIFIER = 0;
	var PAR_DATA = [];

	function FORM_INITIALIZE()
	{
		JSCUS_QUICK_SAVE.CUS_SAVE_INITIALIZE();

		// Restore Cache on reload
		// ...........................................	
		window.onbeforeunload = function(event)
		{
			if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_RETURN_URL) == false)
			{
				JSCUS_QUICK_SAVE.CUS_SAVE_REFRESH();
			}
		};
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("APPROVE_BBI"))
		{
    		APPROVE_BBI = JSOC_ELEMENT.VAR_GET("APPROVE_BBI");     
			if(JSVC_VAR.VAR_ISSET(HTTP_UPDATE_JO))
			{
				// Prepare Save callback
				var CALLBACK_HANDLER = 
					function(IS_SUCCESS)
					{
						// Abort on failure
						if(IS_SUCCESS == false)
						{
							return;
						}

						HTTP_SEARCH();

						// Show record saved messageBox
						JSVC_INFO.VAR_RECORD_SAVED('');
					}
				
				// Add OnClick event
				APPROVE_BBI.onclick = 
					function()
					{
						HTTP_UPDATE_JO(CALLBACK_HANDLER);
					}
			}
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("DELIVERED_BBI"))
		{
    		DELIVERED_BBI = JSOC_ELEMENT.VAR_GET("DELIVERED_BBI");     
			if(JSVC_VAR.VAR_ISSET(HTTP_UPDATE_JO))
			{
				// Prepare Save callback
				var CALLBACK_HANDLER = 
					function(IS_SUCCESS)
					{
						// Abort on failure
						if(IS_SUCCESS == false)
						{
							return;
						}

						if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_RETURN_URL) == false)
							JSCUS_QUICK_SAVE.CUS_SAVE_COMPLETE(1);
						else
						{
							HTTP_SEARCH();

							// Show record saved messageBox
							JSVC_INFO.VAR_RECORD_SAVED('');
						}
					}
				
				// Add OnClick event
				DELIVERED_BBI.onclick = 
					function()
					{
						HTTP_DELIVERED_RESERVATION(CALLBACK_HANDLER);
					}
			}
		}

		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS("REJECT_BBI"))
		{
    		REJECT_BBI = JSOC_ELEMENT.VAR_GET("REJECT_BBI");     
			if(JSVC_VAR.VAR_ISSET(HTTP_APPROVE))
			{
				// Prepare Save callback
				var CALLBACK_HANDLER = 
					function(IS_SUCCESS)
					{
						// Abort on failure
						if(IS_SUCCESS == false)
						{
							return;
						}
						
						if(JSVC_STR.VAR_IS_BLANK(JSCUS_QUICK_SAVE.CACHE_RETURN_URL) == false)
							JSCUS_QUICK_SAVE.CUS_SAVE_COMPLETE(1);
						else
						{
							HTTP_SEARCH();

							// Show record saved messageBox
							JSVC_INFO.VAR_RECORD_SAVED('');
						}
					}
				
				// Add OnClick event
				REJECT_BBI.onclick = 
					function()
					{
						STATUS_ID = 2;
						HTTP_APPROVE(CALLBACK_HANDLER);
					}
			}
		}

		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 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('JOB_ORDER_DGV');
				
			};
		}	
		
		if(JSOC_ELEMENT.VAR_ELEMENT_EXISTS('SEARCH_REC_JORDER_DATE_COMPLETE_CMB'))
		{
			// Initialize
			var SEARCH_REC_JORDER_DATE_COMPLETE_CMB = JSOC_ELEMENT.VAR_GET("SEARCH_REC_JORDER_DATE_COMPLETE_CMB");
			JSOC_DTP.VAR_CREATE_LIST(SEARCH_REC_JORDER_DATE_COMPLETE_CMB);
				
			// Setup onChange event
			SEARCH_REC_JORDER_DATE_COMPLETE_CMB.onchange = function()
			{
				if(SEARCH_REC_JORDER_DATE_COMPLETE_CMB.disabled == false)
				{
					JSOC_DTP.VAR_DATESET_ASSIGN
					(
						"SEARCH_REC_JORDER_DATE_COMPLETE_FROM_DTP", 
						"SEARCH_REC_JORDER_DATE_COMPLETE_TO_DTP", 
						SEARCH_REC_JORDER_DATE_COMPLETE_CMB
					);
				}
			};
				
			// Set to this week
			JSOC_CMB.VAR_SELECTED_VALUE('SEARCH_REC_JORDER_DATE_COMPLETE_CMB', '1'); 
			SEARCH_REC_JORDER_DATE_COMPLETE_CMB.onchange();
		}
	};
	
	