<?
if (!isset($_SESSION)) //判斷是否已經開啟SESSION
{
session_start();
}//開起SESSION}
$id=$_SESSION['mAccount'];
$mid=$_SESSION['mId'];
putenv("NLS_LANG=TRADITIONAL CHINESE_TAIWAN.AL32UTF8");





?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>傳訊</title>
<script src='../jQuery/jquery-1.2.6.js' type='text/javascript'></script>
<SCRIPT LANGUAGE="JavaScript" src="../jQuery/TbxLenLimit.js"></SCRIPT>
<script type="text/javascript">
	

function send_msg() {

				
	
	
	
	$.ajax({
   type: "POST",
   url: "../raise/send_process.php",
   data: {title:$('#title').val(),content:$('#content_message').val(),mId:$('#smId').val(),rId:$('#rId').val(),action:$('#action').val()},
   beforeSend:function(){
   $('#msgform').fadeOut(200);
   $('.message-loading').fadeIn(200);

		var message = '';
		if (!$('#title').val()) {
			message += '主旨 is required. ';
		}
		if ($('#content_message').val()=='') {
			message += 'Message is required.';
		}
		
if ($('#content_message').val().length>250) {
			message += 'Message is too long.';
		}
		if (message.length > 0) {
		$('#msgg').html(message);
    	$('#msgg').fadeIn();
		  $('#msgform').fadeIn(200);
   $('.message-loading').fadeOut(200);
			return false;
		}
		else {
			return true;
		}
	}/*,
  success: function(response) {
         if (response.responseText!='') {
	    $('#msg').html(response.responseText);
    	$('#msg').fadeIn();
	
  		}else{
		//location.href="../member/index.php";
		}
  }*/,
  complete: function (xhr) {
  	//alert(xhr.responseText);
								$('#msgg').html(xhr.responseText);
							$('#msgg').fadeIn();
								  $('.message-loading').fadeOut(200);
							}


   });	return false;
  	
 }
	
	
		</script>
</head>

<body>

<?

 $mId=$_GET["mId"];
$rId=$_GET["rId"];

?>

<form id="msgform" name="form1" method="post" onsubmit="return send_msg();">

		<div class='message-message' style='display:none'></div>
		<div class='message-title'>Send a message:</div>
		<div >
<table>
<tr>
<td>主旨</td><td><input type='text'id='title' class='message-input' name='title' maxlength="30">(30字內)</td>
</tr>
<tr><td>內容</td><td>限制250個字喔~
	<textarea id='content_message' class='message-input' name='message' cols='35' rows='5'  ></textarea></td> 
</tr>
</table>
<input type='hidden' name='rId'  id='rId' value=<?=$rId ?> >
<input type='hidden' name='mId' id='smId' value=<?=$mId ?> >
<input type='hidden' name='action'  id='action' value='send'/>
<input type="Submit" name="Submit"  value="Send"/>
<input type="button" name="cancel" value="Cancel" onclick="self.parent.tb_remove();" />
</form>
</div>
<div class='message-loading' style='display:none'><img src="images/loadingAnimation.gif" /> Sending.....
	</div>
 <div id="msgg" style='display:none;'>
 	</div>


</body>
</html>
