Need Help With Iteration...

Need Help With Iteration...

Hello I am designing a private messaging service on a browser.

At the moment i have created the code which allows the user to click on the user they wish to have a PM with and then display the div to send a message to that user.

I need to come up with a way of checking that the user is not 'already' having a private conversation with the user they click on.

So if they click on 'Admin', then the box to write a PM will come up... but if they click 'Admin' again, a box should not appear.

Below is my function....



function Get_Users() {

$.ajax({              
type: "GET",            
url: "action/whosonline.php",      
  success: function(data){ 
   $("ul.whosonline").html(data);
   $('ul.whosonline li:even').css('background-color','#DEDEDE');
        $('ul.whosonline li:odd').css('background-color','#EDEDED'); 

  $('ul.whosonline li').click(function() { //if the user clicks on another user


  if(id != 4 && data != '<li>No Users Online</li>' && lock != 1) {
    id = id+1;
    $("#slidebottom").append(
   "<div class='"+id+"' id='chatinner'><div class='username'>"+user+"</div><ul class='pm'><li></li></ul><input type='text' name='message'></div>");
     right = right + 220
     $('.'+id).css('right',right);
      $('.'+id).hide();
      $('.'+id).fadeIn();
  }   
  });
  }
});
}



Any help with this would be greatley appreciated