<div class="global-message-container">
  <div class="chat-list-container chat-list-active">
   <!--User Information Area Started-->
    <div class="user-container">
    <div id="loader"></div>
     <div class="close-info materiald" data-state="close" data-id="<?php echo $conversation_uid;?>"><div class="icon-profile-back icon-arrow-line-left"></div></div>           
     <div class="sidebar-content top">
      </div>
    </div>
    
<!--User Information Area Finished-->
  <!--User Follow List View Started-->
     <div class="follow-list-container">
      <div class="follow-list-header">
        <div class="back-to-chat-list md-ripple md-ripple-yellow wow bounceInLeft" data-wow-offset="300">
          <div class="icon-back-to-chat icon-chevron-left-thick"></div>
          <div class="new-chat">New Chat</div>
        </div>
      </div>
      <div class="follow-list-wrp">
        <div class="chat-list-widget-wrap">
          <?php include("chat_following_widget.php");?>
        </div>
      </div>
    </div>
<!--User Follow List View Finished-->   
    <div class="chat-list-header" style="position:relative;">
      <a href="<?php echo $base_url.$session_username; ?>">
       <img src="<?php echo $profileface;?>"/>
      </a>
    <div class="list-view-btn md-ripple md-ripple-yellow wow bounceInLeft" data-wow-offset="300">
      <div class="icon-chated icon-users"></div>
    </div>
    </div>
    <div class="from-message-area">
<?php 
if($conversation_uid){
	// Show the conversation list
   include('ConversationList.php');
  }
  // Show the last conversation
   include('loadConversation.php'); 
?>

</div>
<?php include("footer.php");?>
  </div>
     <!--User Information Area Started-->
    <div class="user-container-mobile">
     <div id="loader"></div>
     <div class="close-info-mobile materiald-mobile-close ss" data-statesmob="close" data-id="<?php echo $conversation_uid;?>">
      <div class="icon-profile-back icon-arrow-line-left"></div>
     </div>           
     <div class="sidebar-content-mobile">
     </div>
    </div>
<!--User Information Area Finished-->
  <div class="chat-container">
  <!--User Profile Mobile Version Started-->
  <div class="user-profile-mobile">
    <div class="user-profile-mobile-in"></div>
  </div>
  <!--User Profile Mobile Version Finished-->
     <div class="chat-header-current-talking cd-item">
     <div class="icon-ls icon-align-justify open-chat-list" data-states="close"></div>
     <div class="materiald  md-ripple md-ripple-yellow wow bounceInLeft show-user-profile-left-side" data-wow-offset="300" data-state="close" data-id="<?php echo $conversation_uid;?>" >
      <?php 
        if(empty($conversation_usr)) {
           } else {
	          echo '<img src="'.$cfaces=$Mat->User_MiniProfilepic($conversation_uid,$base_url).'" />';
           }
      ?>
     <div class="curretnt-chatting-name cd-trigger" >
     <?php  
	 if(isset($conversation_usr)) {
		 echo $cu=htmlspecialchars($Mat->UserFullName($conversation_usr));
		 } else {
		 }
	 ?>
	 
     </div>
     </div>
     <div class="materiald-mobile  md-ripple md-ripple-yellow wow bounceInLeft show-user-profile-left-side" data-wow-offset="300" data-statesmob="close" data-id="<?php echo $conversation_uid;?>" >
     <?php 
      if(empty($conversation_usr)) {
          } else {
	          echo '<img src="'.$cfaces=$Mat->User_MiniProfilepic($conversation_uid,$base_url).'" />';
          }
      ?>
     <div class="curretnt-chatting-name cd-trigger" >
	 <?php  
	 if(isset($conversation_usr)) {
		 echo $cu=htmlspecialchars($Mat->UserFullName($conversation_usr));
		 } else {
		 }
	 ?></div>
     
     </div>
     <div class="show-user-information"></div>
     <!---------->
     <div class="send-aPhoto konfi"><div class="icon-sendPhoto icon-picture"></div></div>
     <!---------->
     </div>
     <div class="messages--wrap conversationReply_grid tekin" id="reply_content">
<?php 
$top_c_id=$Mat->Conversation_Insert($uid,$conversation_uid);
// Start the conversation updates
if(!isset($last_message) || $last_message == '') {
  $last_message=0;
  // Show next sent official image
 }
 $Conversation_Updates=$Mat->Conversation_Updates($top_c_id,$uid,$last_time,$conversation_uid,$last_message);
 if(empty($Conversation_Updates)) {
	 // If the conversation is empty
	 if($top_c_id) {
		 // Check the conversation username
	    $cu=htmlspecialchars($Mat->UserFullName($conversation_usr));
		// Then show the message like sende a message from 
		//the (This is the name of the person sending messages)
		 echo "<div class='changec talk-with' id='reply_content'>Send a message from the ' ".$cu."</div>";
	   } else {
		   // If the user not selected a user for conversation
		   // Then show the intro body
		   echo "
		   <div class='talk-with'>
		   <div class='intro-body'>
		   <div class='intro-image'></div>
		   </div>
		   </div>";
		}
		} else {
			// If the sending message is not empty with top_c_id
			// then show the conversations
		    include('html_conversationReply.php'); 
	}
?>
</div>
<?php 
if($top_c_id) { 
?>
  <div class="mesaj-gcvp">
  <div class="sending_message">
  <div aria-busy="true" aria-label="Loading, please wait." role="progressbar"></div>
  </div>
  <div class="image-preview-area">
  <div class="image-preview-wrap">
  <div class="image-preview-c"></div>
  </div>
   <div class="send-image-f">  
    <form id="imageform" method="post" enctype="multipart/form-data" action='<?php echo $base_url;?>conversation_image_upload.php'> 
     <div class="chose-image-bttn"><input type="file" name="photoimg" id="photoimg" class="select-file"><input type='hidden' id='uploadvalues'/></div>
    </form>
  </div>
  </div>
<div class="send-aSmiley clickficon">
<div class="icon-sendPhoto icon-happy-smiley-very"></div>
<?php include("emoticons.php");?>
</div>
  <input type="hidden" id="cid" value="<?php echo $top_c_id;?>">
  <input type="hidden" id="cuid" value="<?php echo $conversation;?>">
<div class="message-text-ww">
  <textarea name="update" id="text_up_p" class="reply-message-text-area chat-user<?php echo $top_c_id;?>" placeholder="Write a message"></textarea>
</div>
<div class="send-reply-message">
  <input type="submit" class="rsend reply_button repplybutton update_box" id="update_button" value="" />
  <div class="icon-send-reply-message icon-mail-send z"></div>
  </div>
</div>
</div>
<?php
}
?> 
</div>
</div>
<!--User Search modal Started-->
<?php include("search.php");?>
<!--User Search Modal Finished-->
<div class="backbar"></div>
