/*  */
function modedb_edit_detail(path, sval, mode, ditem, fow, deri, iid) {
	var zmode = $('#SUB_MODE'+fow).val(),subph = $('#SUB_SUBPATH'+fow).val(), ERI = '';
	var dform = '#detail_form_'+zmode+fow,sform = '#sub_form_'+zmode+fow;
	var type = ((zmode == subph) ? 'D' : 'S');
	var eform = ((zmode == subph) ? dform : sform);
	var txatid = eform+' #edit_'+ditem;
	if ($(txatid).val() == 'disabled') {
		alert(return_language_str(path, sval, '', 'U_CAN_NOT_EDIT_NOW', '')+'!');
	} else {
		var zeri = $(dform+' #ERI').val(),
			maperi = ($(dform+' #HIDEFLOW_ERI').length > 0) ? $(dform+' #HIDEFLOW_ERI').val() : '';
		if (type == 'D') ERI = zeri;
		else {
			var suberis = $('#SUB_ERIPATH'+fow).val().split('/');
			ERI = suberis[suberis.length-1];
		}
		var url = path+'core/cw5e_engine_detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&ditem='+ditem+'&fow='+fow+'&type='+type+'&act=dbliedit';
		url += '&iedit=E&ERI='+ERI+'&deri='+deri+'&zeri='+zeri+'&zmode='+zmode+'&maperi='+maperi;
		var djson = (fromid_output_json(eform,'name')).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 {
				if (ret_msg[0].html_str) {
					iid.closest('tr').empty().append(ret_msg[0].html_str);
					mode_enableck_control(path, sval, mode, 'edit', eform, ditem, '', meri, fow);
				}
			}
		});
	}
}