//发消息
function ajax_sendmsg()
{
	var myAjax	= $.appfn("boke");
	var reciver	= document.msgform.reciver.value.trim();
	var title 	= document.msgform.title.value.trim();
	var content = document.msgform.content.value.trim();
	var msg_id = document.msgform.msg_id.value.trim();
	
	if(reciver==""){
		msg('请选择一个您的好友！');
	}else if(title==""){
		msg('请填写消息主题！');
	}else if(content==""){
		msg('请填写消息内容！');
	}else{	
		var pras="op=save&reciver="+reciver+"&title="+title+"&content="+content+"&msg_id="+msg_id+"&_r="+Math.random();
		myAjax.sendAjax("message.php?"+pras,{
			onSuccess:function(){
			var result_msg=parseReturnMsg(this.responseXML);
			if(result_msg.status=='ok'){
					if(msg_id != "0"){
						alertMsg('消息发送成功！', "location.href='../space/message.php?op=read&from=inbox&msg_id="+msg_id+"'",'提示');
					}else{
						alertMsg('消息发送成功！', "location.href='../space/message.php?op=list&type=2'",'提示');
					}
				}
				else
				{
					msg(result_msg.description);
				}
			},
			onFailure:function(){msg('消息发送失败！', '','提示')}
		});
	}
}
//留言
function ajax_sendword(from)
{
	var myAjax		= {};
	var reciverId	= document.gbook.reciverId.value.trim();
	var content 	= document.gbook.content.value.trim();
	var security 	= document.gbook.security.value.trim();
	
	if(document.gbook.security.checked == true)
	{
		security = 1;
	}else{
		security = 0;
	}
	
	if(reciverId==""){
		msg('缺少用户ID！');
	}else if(content==""){
		msg('请填写留言内容！');
	}else if(getCnLen(trim(content))>1000){
		msg('您的留言内容太多了,最多500字！');
	}else{	
		document.gbook.sub_btn.disabled=true;
		document.gbook.sub_btn.value="正在提交...";
		var pras="op=sendWord&reciverId="+reciverId+"&content="+content+"&security="+security+"&_r="+Math.random();
		myAjax.sendAjax("../space/guestbook.php?"+pras,{
			onSuccess:function(){
			var result_msg=parseReturnMsg(this.responseXML);
			if(result_msg.status=='ok'){
					if(from == "index"){
						h_guestbook(reciverId);
						document.gbook.content.value="";
					}else{
						alertMsg('留言成功！', "location.reload()",'提示');
					}
				}
				else{
					msg(result_msg.description);
				}
			},
			onFailure:function(){msg('留言出错了！')}
		});
		document.gbook.sub_btn.disabled='';
		document.gbook.sub_btn.value="提交留言";
	}
}