function openSendMsgDlg(senderId, receiverId, receiverLogo, receiverName, divObj, positionObj){
	var timstamp = (new Date()).valueOf();
	var url = "/message/shortMessagePop.jsp";
	var pars = "senderId="+senderId;
	pars += "&receiverId="+receiverId;
	pars += "&receiverName="+encodeURI(encodeURI(receiverName));	
	pars += "&receiverLogo="+receiverLogo;
	pars += "&t="+timstamp;
				
	var myAjax = new Ajax.Request(url, {method: "get", parameters: pars, onComplete: function (req) { 
			
			var dlgWidth = 420;
			var dlgHeight = 240;
			divObj.innerHTML = req.responseText;		
			var x = positionCenter(dlgWidth) ;
			var y = positionMiddle(dlgHeight) ;
			openDialog('发站内短消息',divObj,dlgWidth,dlgHeight,x,y,false,'sendMsg') ;			
		} 
	});
	
}

function closeSendMsgDlg(){
	closeDialog('sendMsg');
}

function getMsg(){
	var descObj = document.getElementById("msg");
	return descObj.value;
}

function sendMessage(senderId, receiverId, content) {
	var buttonObj = document.getElementById("sf");
	if(clearBlankSpace(content)=="") {
		alert("请输入消息内容!");
		return;
	} 
	buttonObj.disabled = true;
	var endPoint="/bfapp";
	var buffalo = new Buffalo(endPoint);
	buffalo.remoteCall("MessagePrint.sendShorMessage",[g_mySpaceID, receiverId, content], function(reply) {
	   call_back_sendMsg(reply.getResult());
     	});		
}

function call_back_sendMsg(p_status){
   var info = "";
   if(parseInt(p_status) > 0){
       info = "发送成功!已发到对方收件箱.";
   }else{
       info = "短消息发送失败，请重试！";
   }
   var msgHintTh = document.getElementById("msgHintTh");
   var msgTh = document.getElementById("msgTh");
   msgHintTh.innerHTML = info;
   msgTh.innerHTML = "";   
   sleep(this,1000); 
   this.NextStep=function(){  
   	  closeSendMsgDlg();
   }   
}

function sleep(obj,iMinSecond){  
	if (window.eventList==null)  
		window.eventList=new Array();  
	var ind=-1; 
	for (var i=0;i<window.eventList.length;i++){   
		if (window.eventList[i]==null){  
			window.eventList[i]=obj;    
			ind=i;   
    		break;   
		}  
	}  
	if (ind==-1){   
		ind=window.eventList.length;   
		window.eventList[ind]=obj; 
	}  
	setTimeout("GoOn(" + ind + ")",iMinSecond); 
} 
function GoOn(ind){  
	var obj=window.eventList[ind]; 
	window.eventList[ind]=null; 
	if (obj.NextStep)
		obj.NextStep(); 
	else
		obj(); 
}
