<?php include("header_message.php");?>
<?php  
    if($uid != $conversation_uid){
		 $block_status =$Mat->Friends_block_Check($uid,$conversation_uid);
		 $CheckBlockUser =$Mat->Friends_block_Check($conversation_uid,$uid);
		if($block_status =='1' || $CheckBlockUser == '1'){
		   echo '<div class="global-profile-container"><div class="pagenotfound"><img src="'.$base_url.'mat_icons/blocked_message.png" /></div></div>';
		} else {
  	        include("chat_main.php");
               }
        } else { include("chat_main.php");
	 }

?>
<script type="text/javascript">

function newconversation(x) {
  var last_time = ($('.conversation-reply-text:last').length && $('.conversation-reply-text:last').attr('id')) ? $('.conversation-reply-text:last').attr('id') : "";
  var uid = ($('#stbody').length && $('#stbody').attr('class')) ? $('#stbody').attr('class') : "";
  if(uid === 'chat-user') {
    setTimeout(newconversation, 3000);
  } else {

    $.ajax({
      type: "POST",
      url: "/m.php",
     // Adds last_time to the data string
      data: "uid="+uid.replace('chat-user', '')+"&topcid=<?php echo $top_c_id;?>&last_time=" + last_time, 
      success: function(html) {
         // html is a string of all output of the server script.
        if(html) {
          $('.tekin').append(html);
          jQuery("span.timeago").timeago();
          
          // Scroll at the bottom of the div (focus new content)
          $(".tekin").scrollTop($(".tekin")[0].scrollHeight);
        }
        if(!x) {
          setTimeout(newconversation, 3000);
        }
       }
    });
  }
}
newconversation();
</script>

</body>
</html>