function postBoard(){
	var title = getObj('board').value;
	var uid = getObj('board_uid').value;
	if (typeof(uid) == "undefined") {
		showDialog('error','沒有要留言的對象');
		return false;
	}
	if (title.length < 3 || title.length > 200) {
		showDialog('error','留言的字數請保證在3∼200之內');
		return false;
	}
	if (uid == winduid) {
		showDialog('error','不能自己給自己留言');
		return false;
	}
	
	ajax.send('mode.php?m=o&q=ajax&action=postboard','&uid='+uid+'&title='+title,function(){
		var rText = ajax.request.responseText.split('\t');
		if (rText[0]=='success') {
			creatBoard('board_container',rText[1],rText[2],title);
			getObj('board').value = '';
		}
	});
}
function delBoard(bid){
	if (isNaN(bid)) {
		showDialog('error','錯誤');
	}
	ajax.send('mode.php?m=o&q=ajax&action=delboard','id='+bid,function(){
		var rText = ajax.request.responseText;
		if (rText=='success') {
			delElement('board_'+bid);
		} else {
			ajax.send();
		}
	});
}
function creatBoard(container,bid,face,title){
	if (isNaN(bid)) {
		showDialog('error','錯誤');
	}
	container = objCheck(container);
	var dd	= elementBind('dd','board_'+bid,'cc pdD');
	var div	= elementBind('div');
	var inner_dl= elementBind('dl','','cc mt8');
	var inner_dd1	= elementBind('dd','','fl pdr');
	var img	= elementBind('img','','fl pdr portrait-s');
	img.src	= face;
	inner_dd1.appendChild(img);
	var inner_del	= elementBind('dd','','fr b gray1');
	var del	= elementBind('a','','','cursor: pointer;');
	del.setAttribute('onclick',"pwConfirm('是否確定刪除本條留言',this,function(){delBoard('"+bid+"')})");
	del.innerHTML	= '×';
	inner_del.appendChild(del);
	
	var inner_dd2	= elementBind('dd','','fl cc');

	var a	= elementBind('a');
	a.href	= 'mode.php?m=o&q=user';
	a.innerHTML	= windid;
	inner_dd2.appendChild(a);
	var span	= elementBind('span','','gray1','margin-left:2px');
	var date = new Date();
	var thispost = dateFormat(date,'yyyy-mm-dd hh:ii:ss');
	span.innerHTML = thispost + '留言道:';
	inner_dd2.appendChild(span);
	var inner_div = elementBind('div','','pdD');
	inner_div.innerHTML = char_cv(title);
	inner_dd2.appendChild(inner_div);
	
	inner_dl.appendChild(inner_dd1);
	inner_dl.appendChild(inner_del);
	inner_dl.appendChild(inner_dd2);
	
	div.appendChild(inner_dl);
	dd.appendChild(div);
	
	var dds = container.getElementsByTagName('dd');
	if (typeof(dds)=='object' && dds.length>0) {
		var firstdd = dds[0];
		container.insertBefore(dd,firstdd);
	} else {
		container.appendChild(dd);
	}
}