var moveobj;
var isdown=false;
var divleft,divtop;
var msgobjTimer;
var i=0;
function dosenddhzmessage()
{
	var sInputString=document.dhzmessagewindowform.Content.value;
	
	sInputString = sInputString.replace(/\r\n/g,"");
	sInputString = sInputString.replace(/\r/g,"");
	sInputString = sInputString.replace(/\n/g,"");
	sInputString = sInputString.replace(/\s/g,"");
	
	if(sInputString=="")
	{
		alert('亲爱的会员，别忘了填写消息内容!');
	}
	else if(sInputString.length >1000)
	{
		alert('亲爱的会员，你的消息内容请控制在1000个字符以内!');	
	}
	else
	{	
		document.dhzmessagewindowform.submit();
		document.getElementById('dhzmessagewindow').style.visibility='hidden';
		document.getElementById('dhzmessagewindow').style.zIndex=-1;
		var sdocWidth = document.body.clientWidth-550;
		var sdocHeight = document.body.clientHeight-400;
		document.getElementById("dhzmessagewindowsucceed").style.top = sdocHeight + parseInt(document.body.scrollTop,10);
		document.getElementById("dhzmessagewindowsucceed").style.left = sdocWidth + parseInt(document.body.scrollLeft,10);
		i=0;
		msgobjTimer = window.setInterval("doshowdhzmessagesucceed()",1);
	}
}

function doshowdhzmessagesucceed()
{
	i++;
	if(i>40)
	{
		document.getElementById('dhzmessagewindowsucceed').style.zIndex=2;
		document.getElementById('dhzmessagewindowsucceed').style.visibility='visible';
	}	
	if(i>150)
	{
	window.clearInterval(msgobjTimer);	
	document.getElementById('dhzmessagewindowsucceed').style.visibility='hidden';
	document.getElementById('dhzmessagewindowsucceed').style.zIndex=-2;
	}

}
function doopendhzmsgwnd(sendtousernickname,sendtouserid)
{
	var sdocWidth = document.body.clientWidth-550;
	var sdocHeight = document.body.clientHeight-450;
	document.getElementById("dhzmessagewindow").style.top = sdocHeight + parseInt(document.body.scrollTop,10);
	document.getElementById("dhzmessagewindow").style.left = sdocWidth + parseInt(document.body.scrollLeft,10);
	document.getElementById('dhzmessagewindow').style.zIndex=1;
	document.getElementById('dhzmessagewindow').style.visibility='visible';
	document.getElementById('dhzmessagewindowtitle').innerHTML='给'+sendtousernickname+'发送消息';
	document.getElementById('dhzmessagewindowuserid').innerHTML='<input name="ToUserID" type="hidden" value="'+sendtouserid+'">';
}

function doclosedhzmsgwnd()
{
	document.getElementById('dhzmessagewindow').style.visibility='hidden';
	document.getElementById('dhzmessagewindow').style.zIndex=-1;
}


function startdhzmsgmove(obj)
{
	moveobj=obj;
	isdown=true;

	divleft=event.clientX-parseInt(obj.style.left);
	divtop=event.clientY-parseInt(obj.style.top);
}
function stopdhzmsgmove()
{
	isdown=false;
}
function dhzmsgmove(){
	if(isdown){
		moveobj.style.left=event.clientX-divleft;
		moveobj.style.top=event.clientY-divtop;
	}
}
document.write("<iframe name=\"messagesave\" height=\"0\" width=\"0\" frameborder=\"0\"><\/iframe>");
document.write("<div id=\"dhzmessagewindow\" style=\"position:absolute;left:0px;top:0px;z-index:-1; visibility:hidden;\" onmousemove=\"dhzmsgmove()\" onmouseup=\"stopdhzmsgmove();\">");
document.write("  <table width=\"360\" height=\"180\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#FFD076\">");
document.write("    <tr>");
document.write("	  <td align=\"center\" valign=\"top\">		      	  ");
document.write("	  <table width=\"100%\" height=\"24\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
document.write("        <tr>");
document.write("          <td bgcolor=\"#FFE6BB\">");
document.write("		  <table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
document.write("            <tr>");
document.write("              <td width=\"7%\" align=\"center\"><img src=\"\/images\/message\/person.gif\" width=\"19\" height=\"17\"><\/td>");
document.write("              <td width=\"85%\" onmousedown=\"startdhzmsgmove(document.all.dhzmessagewindow)\" style=\"cursor:move;font-size:12px; color:#513001\"><div id=\"dhzmessagewindowtitle\"><\/div><\/td>");
document.write("              <td width=\"8%\" align=\"center\"><img src=\"\/images\/message\/quit.gif\" width=\"13\" height=\"13\" style=\"cursor:hand;\" onClick=\"doclosedhzmsgwnd();\"><\/td>");
document.write("            <\/tr>");
document.write("          <\/table>");
document.write("		  <\/td>");
document.write("        <\/tr>");
document.write("     	<\/table>				");
document.write("        <table width=\"100%\" height=\"156\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#FFAA2B\">");
document.write("		<form action=\"\/my\/messagesave.asp\" method=\"Post\" name=\"dhzmessagewindowform\" target=\"messagesave\">");
document.write("		<div id=\"dhzmessagewindowuserid\"><\/div>");
document.write("          <tr>");
document.write("            <td align=\"center\" valign=\"top\" bgcolor=\"#FFF0D7\">			");
document.write("			<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
document.write("              <tr>");
document.write("                <td height=\"10\"><\/td>");
document.write("              <\/tr>");
document.write("            <\/table>			");
document.write("              <table width=\"95%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\">");
document.write("                <tr>");
document.write("                  <td height=\"22\" align=\"center\">");
document.write("				  <textarea name=\"Content\" cols=\"45\" rows=\"7\" style=\"border-width:1px;border-style:ridge;border-color:#CCCCCC;\"><\/textarea>				  ");
document.write("				  <\/td>");
document.write("                <\/tr>");
document.write("              <\/table>			  ");
document.write("              <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");
document.write("                <tr>");
document.write("                  <td height=\"30\">&nbsp;&nbsp;");
document.write("				  <input name=\"button\" type=\"button\" onclick=\"dosenddhzmessage();\" value=\"发 送\" style=\"border-width:1px;border-style:ridge;border-color:#CCCCCC;background-color:#FFAA2B;\">&nbsp;");
document.write("				  <input name=\"reset\" type=\"reset\" onclick=\"doclosedhzmsgwnd();\" value=\"取 消\" style=\"border-width:1px;border-style:ridge;border-color:#CCCCCC;background-color:#f7f7f7;\">");
document.write("				 <\/td>");
document.write("                <\/tr>");
document.write("              <\/table>			  ");
document.write("		    <\/td>");
document.write("          <\/tr>");
document.write("		  <\/form>");
document.write("        <\/table>				");
document.write("	  <\/td>");
document.write("    <\/tr>");
document.write("  <\/table>");
document.write("<\/div>");