/*  */
function mode_update_code(path, sval, mode, ditem, table, act, dform){
	var url = path+'core/cw5e_engine_detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&table='+table+'&act='+act;
	var djson = (fromid_output_json(dform,'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;
		} else {
			if ((ret_msg[0].id) && (ret_msg[0].code)) {
				if ($('#'+ret_msg[0].id).length > 0) {
					$('#'+ret_msg[0].id).val(ret_msg[0].code);
				}
				if ($('.'+ret_msg[0].id+'_span').length > 0) {
					$('.'+ret_msg[0].id+'_span').html(ret_msg[0].code);
				}
			}
		}
	});
}