function postsumit_one(form)
{
	var cid = form.cid.options;
	if (cid[cid.selectedIndex].value == '')
	{
		alert('请选择合适的分类');
		return false;
	}
}
function insertatt(content){
	switch (editormod)
	{
		case '0':
		case '1':
			var txtarea = document.getElementById('posteditor_textarea');
			if (txtarea.createTextRange && txtarea.caretPos) {
				var caretPos = txtarea.caretPos;
				caretPos.text = content;
				txtarea.focus();
			} else {
				txtarea.value  += content;
				txtarea.focus();
			}
			break;
		case '2':
			var oEditor = FCKeditorAPI.GetInstance('content');
			if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
				oEditor.InsertHtml(content) ;
			} else {
				alert('请先转换到所见即所得模式') ;
			}
			break;
		default:
			alert('编辑器模式错误');
	}
}
function delatt(id) {
	$.ajax({
		type: 'GET',
		url: pb_url+'include/upload.inc.php',
		dataType: 'json',
		data: 'action=del&id=' + id + '&fsid=' + fsid + '&random=' + Math.random(),
		error: function(var1,var2,var3)
		{
			alert('附件删除错误，请检查网络连接。') ;
		},
		success: function(data)
		{
			document.getElementById('uploaded').removeChild(document.getElementById('attachment_'+data));
		}
	});
}
function supdelatt(id) {
	$.ajax({
		type: 'GET',
		url: pb_url+'manage.php',
		dataType: 'html',
		data: 'action=del&type=attachment&aid=' + id + '&random=' + Math.random(),
		error: function(var1,var2,var3)
		{
			alert('附件删除错误，请检查网络连接。') ;
		},
		success: function(data)
		{
			if (data)
			{
				document.getElementById('uploaded').removeChild(document.getElementById('e_attachment_'+id));
			}
			else
			{
				alert('附件删除错误，可能您无删除权限。') ;
			}
		}
	});
}
var oldtopicimg = '';
function changetopicimg(type)
{
	var topicimg = $('#topicimg');
	if (type == 'edit')
	{
		oldtopicimg = topicimg.html();
		topicimg.empty().html('<input type="file" id="topicimg" name="topicimg" />[<span onclick="changetopicimg(\'cancel\')">'+topicimg_cancel+'</span>]')
	}
	else if (type == 'cancel')
	{
		topicimg.empty().html(oldtopicimg);
	}
	return;
}
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}