/*  */
function modedb_addsave_detail(path, sval, mode, ditem, table, fow) {
	if (confirm(return_language_str(path, sval, '', 'CONFIRM_SUBMIT', '')+'?')) {
		var zmode = $('#SUB_MODE'+fow).val(),subph = $('#SUB_SUBPATH'+fow).val();
		var dform = '#detail_form_'+zmode+fow,sform = '#sub_form_'+zmode+fow;
		var eform = ((zmode == subph) ? dform : sform);
		var type = ((zmode == subph) ? 'D' : 'S'), 
			eid = $(eform+' #'+ditem+'_db_edit');
		var url = path+'core/cw5e_engine_detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&ditem='+ditem+'&table='+table+'&fow='+fow+'&type='+type+'&act=dballsave';
		url += '&dbtyp='+EncodeURLutf8($('#'+ditem+'_db_list #dblt_type_'+ditem).val())+
			   '&keyf='+EncodeURLutf8($('#'+ditem+'_db_list #page_keyfd_'+ditem).val())+
			   '&flow='+EncodeURLutf8($('#'+ditem+'_db_list #page_flow_'+ditem).val())+
			   '&meri='+EncodeURLutf8($(dform+' #ERI').val())+
			   '&teri='+EncodeURLutf8($(dform+' #TEMPERI').val())+
			   '&zmode='+zmode;
		var djson = (fromid_output_json(eid)).replace(/'/g, "''");
		var verlen = djson.length;
		url += '&verlen='+verlen.toString();
		$.post(url, 'htmljson='+EncodeURLutf8(djson), 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 {
				$('#'+ditem+'_db_list #dblt_type_'+ditem).val('E');
				alert(return_language_str(path, sval, '', 'DATA_SAVED', '')+'!');
				$(eform+' #'+ditem+'_db_edit').hide();
				$(eform+' #'+ditem+'_db_list').show();
				$(eform+' #table_'+ditem+' tr').not(':eq(0)').remove();
				detail_pagedb_load(path, sval, mode, ditem, '#'+ditem+'_db_list', fow, '1');
			}
		});
	}
}