function show_edit_post(postid) {
	params = {'postid': postid};
	$('postedit'+postid).show();
		new Ajax.Request('/js/ajax_server/get_blog_post_edit_form.php', {
			method: 'get',
			parameters: params,
			onCreate: function(process) {
				document.body.className = 'ajaxwait';
				$('postedit'+postid).update('Подождите...');
			},
			onComplete: function(complete) {
				document.body.className = '';
				$('main_div').style.cursor = 'auto';
				$('postedit'+postid).update(complete.responseText);
			}
		}
	);
}

function del_wall_message(wall_id, wall_author_urist_num, blocked){
	params = {'wall_id': wall_id, 
			'wall_author_urist_num':wall_author_urist_num,
			'blocked':blocked};
	if (wall_author_urist_num>=0 && blocked){
		fraza = 'Удаляем и блокируем?';
		params = {'wall_id': wall_id, 
			'wall_author_urist_num':wall_author_urist_num,
			'blocked':blocked
			};
	}
	else if (wall_author_urist_num<0){
		fraza = 'Удаляем?';
	}
	else{
		fraza = '';
	}
	
	new Ajax.Request('/js/ajax_server/wall_messages.php', {
		method: 'get',
		parameters: params,
		onComplete: function (complete){
			if (!blocked && wall_author_urist_num>=0){
				$('checkboxes'+wall_id).update(complete.responseText);
			}
			if (fraza!='' && window.confirm (fraza)){
				$('top'+wall_id).remove();
				$('bottom'+wall_id).remove();
			}
		}
	});
}
function edit_msg (msg_id) {
	if (!window.confirm('Удалить сообщение?')) {
		return;
	}
	params = {'msg_id': msg_id};
	new Ajax.Request('/js/ajax_server/urist_msg_edit.php', {
		method: 'get',
		parameters: params,
		onCreate: function(process) {
			document.body.className = 'ajaxwait';
		},
		onComplete: function(complete) {
			document.body.className = '';
			$('main_div').style.cursor = 'auto';
			if (complete.responseText.indexOf('<ok>') >= 0) {
				$('tr_m'+msg_id).remove();
			} else {
				$('msg_text'+msg_id).insert(complete.responseText);
			}
		}
	}
	);
}
function del_msg_history (mode, id) {
	if (!window.confirm('Удалить историю переписки с данным контактом?')) {
		return;
	}
	params = {'mode': mode, 'id': id};
	new Ajax.Request('/js/ajax_server/urist_msg_del_history.php', {
		method: 'get',
		parameters: params,
		onCreate: function(process) {
			document.body.className = 'ajaxwait';
		},
		onComplete: function(complete) {
			document.body.className = '';
			$('main_div').style.cursor = 'auto';
			if (complete.responseText.indexOf('<ok>') >= 0) {
				$('tr_m'+msg_id).remove();
			} else {
				$('msg_text'+msg_id).insert(complete.responseText);
			}
		}
	}
	);
}
