/*  */
function detail_pagedb_load(path, sval, mode, ditem, ddiv, fow, page) {
	var zmode = $('#SUB_MODE'+fow).val(),eri = '',
		type = ($('#SUB_MODE'+fow).val() == $('#SUB_SUBPATH'+fow).val()) ? 'D' : 'S';
	var dform = '#detail_form_'+zmode+fow;
	if (type == 'D') {
		eri = ($(dform+' #ERI').length > 0 && $(dform+' #ERI').val().trim() != '') ? EncodeURLutf8($(dform+' #ERI').val()) : EncodeURLutf8($(dform+' #TEMPERI').val());
	} else {
		var suberis = $('#SUB_ERIPATH'+fow).val().split('/');
		eri = suberis[suberis.length-1];
	}
	var maperi = ($(dform+' #HIDEFLOW_ERI').length > 0) ? $(dform+' #HIDEFLOW_ERI').val() : '';
	var url = path+'core/cw5e_engine_detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&ditem='+ditem+'&page='+page+'&fow='+fow+'&act=dbliload';
	var djson = (fromid_output_json(dform,'name')).replace(/'/g, "''");
	var verlen = djson.length;
	url += '&verlen='+verlen.toString()+'&zmode='+zmode+'&eri='+eri+'&maperi='+maperi;
	var data = 'stfd='+EncodeURLutf8($(ddiv+' #page_stfd_'+ditem).val())+
			  '&tabl='+EncodeURLutf8($(ddiv+' #page_table_'+ditem).val())+
			  '&keyf='+EncodeURLutf8($(ddiv+' #page_keyfd_'+ditem).val())+
			  '&flow='+EncodeURLutf8($(ddiv+' #page_flow_'+ditem).val())+
			  '&ordr='+EncodeURLutf8($(ddiv+' #page_ord_'+ditem).val())+
			  '&crpa='+EncodeURLutf8($(ddiv+' #page_crpa_'+ditem).val())+
			  '&aiem='+EncodeURLutf8($(ddiv+' #dall_item_'+ditem).val())+
			  '&dbtyp='+EncodeURLutf8($(ddiv+' #dblt_type_'+ditem).val())+
			  '&txat='+EncodeURLutf8($('#edit_'+ditem).val())+
			  '&type='+EncodeURLutf8(type)+
			  '&stype='+EncodeURLutf8($(ddiv+' #searchtype_'+ditem).val())+
			  '&sname='+EncodeURLutf8($(ddiv+' #searchname_'+ditem).val())+
			  '&skey='+EncodeURLutf8($(ddiv+' #searchtb_'+ditem).val())+
			  '&meri='+(($(dform+' #ERI').length > 0) ? EncodeURLutf8($(dform+' #ERI').val()) : '')+
			  '&teri='+(($(dform+' #TEMPERI').length > 0) ? EncodeURLutf8($(dform+' #TEMPERI').val()) : '')+
			  '&htmljson='+EncodeURLutf8(djson);
	//console.log(data);
	$.post(url, data, function(msg) {
		// console.log(msg);
		var ret_msg = JSON.parse(msg);
		if (ret_msg[0].result == "false") {
			alert(ret_msg[0].message);
			return false;
		} else {
			if (ret_msg[0].html_str) {
				$(ddiv).empty().append(ret_msg[0].html_str);
				//檢查欄位mask.js 
				eval('if (typeof '+ditem+'_chk == "function") '+ditem+'_chk();');
			}
		}
	});
}