| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -3,7 +3,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					Copyright (c) 2009 Anant Garg (anantgarg.com | inscripts.com) | 
					 | 
					 | 
					 | 
					Copyright (c) 2009 Anant Garg (anantgarg.com | inscripts.com) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					This script may be used for non-commercial purposes only. For any | 
					 | 
					 | 
					 | 
					This script may be used for non-commercial purposes only. For any | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					commercial purposes, please contact the author at 
 | 
					 | 
					 | 
					 | 
					commercial purposes, please contact the author at | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					anant.garg@inscripts.com | 
					 | 
					 | 
					 | 
					anant.garg@inscripts.com | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					Changes and Chamilo Integration: Julio Montoya <gugli100@gmail.com> | 
					 | 
					 | 
					 | 
					Changes and Chamilo Integration: Julio Montoya <gugli100@gmail.com> | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -42,8 +42,8 @@ function set_user_status(status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    $.ajax({ | 
					 | 
					 | 
					 | 
					    $.ajax({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        url: ajax_url+"?action=set_status", | 
					 | 
					 | 
					 | 
					        url: ajax_url+"?action=set_status", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        data: "status="+status, | 
					 | 
					 | 
					 | 
					        data: "status="+status, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cache: false,        
 | 
					 | 
					 | 
					 | 
					        cache: false, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        success: function(data) {        
 | 
					 | 
					 | 
					 | 
					        success: function(data) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }); | 
					 | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    user_status = status; | 
					 | 
					 | 
					 | 
					    user_status = status; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -51,8 +51,8 @@ function set_user_status(status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					$(document).ready(function() { | 
					 | 
					 | 
					 | 
					$(document).ready(function() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						originalTitle = document.title; | 
					 | 
					 | 
					 | 
						originalTitle = document.title; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						startChatSession();    
 | 
					 | 
					 | 
					 | 
						startChatSession(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$([window, document]).blur(function() { | 
					 | 
					 | 
					 | 
						$([window, document]).blur(function() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							windowFocus = false; | 
					 | 
					 | 
					 | 
							windowFocus = false; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -60,59 +60,59 @@ $(document).ready(function() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							windowFocus = true; | 
					 | 
					 | 
					 | 
							windowFocus = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							document.title = originalTitle; | 
					 | 
					 | 
					 | 
							document.title = originalTitle; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}); | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						/* Live conditions */ | 
					 | 
					 | 
					 | 
						/* Live conditions */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // User name header toogle
 | 
					 | 
					 | 
					 | 
					    // User name header toogle
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$('#chatboxtitlemain').live('click', function() {        
 | 
					 | 
					 | 
					 | 
						$('#chatboxtitlemain').live('click', function() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (user_status == 1) {            
 | 
					 | 
					 | 
					 | 
					        if (user_status == 1) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            stopChatHeartBeat();   
 | 
					 | 
					 | 
					 | 
					            stopChatHeartBeat(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $('.user_status_main').html(offline_button); | 
					 | 
					 | 
					 | 
					            $('.user_status_main').html(offline_button); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $('#chatboxtitlemain').html(disconnect_lang);             
 | 
					 | 
					 | 
					 | 
					            $('#chatboxtitlemain').html(disconnect_lang); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            set_user_status(0);      
 | 
					 | 
					 | 
					 | 
					            set_user_status(0); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else {            
 | 
					 | 
					 | 
					 | 
					        } else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            startChatHeartBeat(); | 
					 | 
					 | 
					 | 
					            startChatHeartBeat(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $('.user_status_main').html(online_button); | 
					 | 
					 | 
					 | 
					            $('.user_status_main').html(online_button); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            $('#chatboxtitlemain').html(connect_lang); | 
					 | 
					 | 
					 | 
					            $('#chatboxtitlemain').html(connect_lang); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            set_user_status(1);      
 | 
					 | 
					 | 
					 | 
					            set_user_status(1); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						});    
 | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						// User name header toogle
 | 
					 | 
					 | 
					 | 
						// User name header toogle
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$('.chatboxtitle').live('click', function(){ | 
					 | 
					 | 
					 | 
						$('.chatboxtitle').live('click', function(){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							chatbox = $(this).parents(".chatbox"); | 
					 | 
					 | 
					 | 
							chatbox = $(this).parents(".chatbox"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var chat_id = chatbox.attr('id'); | 
					 | 
					 | 
					 | 
							var chat_id = chatbox.attr('id'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							chat_id = chat_id.split('_')[1];		
 | 
					 | 
					 | 
					 | 
							chat_id = chat_id.split('_')[1]; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							toggleChatBoxGrowth(chat_id); | 
					 | 
					 | 
					 | 
							toggleChatBoxGrowth(chat_id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}); | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						//Minimize button 
 | 
					 | 
					 | 
					 | 
						//Minimize button
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$('.chatboxhead .togglelink').live('click', function(){ | 
					 | 
					 | 
					 | 
						$('.chatboxhead .togglelink').live('click', function(){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var chat_id =  $(this).attr('rel');	
 | 
					 | 
					 | 
					 | 
							var chat_id =  $(this).attr('rel'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							toggleChatBoxGrowth(chat_id);		
 | 
					 | 
					 | 
					 | 
							toggleChatBoxGrowth(chat_id); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						});	
 | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						//Close button
 | 
					 | 
					 | 
					 | 
						//Close button
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$('.chatboxhead .closelink').live('click', function(){			
 | 
					 | 
					 | 
					 | 
						$('.chatboxhead .closelink').live('click', function(){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var chat_id =  $(this).attr('rel');	
 | 
					 | 
					 | 
					 | 
							var chat_id =  $(this).attr('rel'); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							closeChatBox(chat_id);		
 | 
					 | 
					 | 
					 | 
							closeChatBox(chat_id); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}); | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}); | 
					 | 
					 | 
					 | 
					}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function showChatConnect() {       
 | 
					 | 
					 | 
					 | 
					function showChatConnect() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (user_status == 1) { | 
					 | 
					 | 
					 | 
					    if (user_status == 1) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        button = online_button;  
 | 
					 | 
					 | 
					 | 
					        button = online_button; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        label = connect_lang; | 
					 | 
					 | 
					 | 
					        label = connect_lang; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else {        
 | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        button = offline_button; 
 | 
					 | 
					 | 
					 | 
					        button = offline_button; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        label = disconnect_lang; | 
					 | 
					 | 
					 | 
					        label = disconnect_lang; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    $("<div />" ).attr("id","chatmain") | 
					 | 
					 | 
					 | 
					    $("<div />" ).attr("id","chatmain") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						.addClass("chatboxmain") | 
					 | 
					 | 
					 | 
						.addClass("chatboxmain") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						.html('<div class="chatboxheadmain"><div class="user_status_main">'+button+'</div><div id="chatboxtitlemain">'+label+'</div><div class="chatboxoptions"></div><br clear="all"/></div></div>') | 
					 | 
					 | 
					 | 
						.html('<div class="chatboxheadmain"><div class="user_status_main">'+button+'</div><div id="chatboxtitlemain">'+label+'</div><div class="chatboxoptions"></div><br clear="all"/></div></div>') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						.appendTo($( "body" ));       
 | 
					 | 
					 | 
					 | 
						.appendTo($( "body" )); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -128,25 +128,25 @@ function startChatSession() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          dataType: "json", | 
					 | 
					 | 
					 | 
					          dataType: "json", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          success: function(data) { | 
					 | 
					 | 
					 | 
					          success: function(data) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (data) { | 
					 | 
					 | 
					 | 
					            if (data) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                username = data.me;    
 | 
					 | 
					 | 
					 | 
					                username = data.me; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                user_status = data.user_status; | 
					 | 
					 | 
					 | 
					                user_status = data.user_status; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                showChatConnect(); | 
					 | 
					 | 
					 | 
					                showChatConnect(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (user_status == 1) {            
 | 
					 | 
					 | 
					 | 
					                if (user_status == 1) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    startChatHeartBeat();   
 | 
					 | 
					 | 
					 | 
					                    startChatHeartBeat(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else { | 
					 | 
					 | 
					 | 
					                } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    stopChatHeartBeat();   
 | 
					 | 
					 | 
					 | 
					                    stopChatHeartBeat(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                $.each(data.items, function(my_user_id, user_items) { | 
					 | 
					 | 
					 | 
					                $.each(data.items, function(my_user_id, user_items) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    my_items = user_items['items'];                
 | 
					 | 
					 | 
					 | 
					                    my_items = user_items['items']; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $.each(my_items, function(i, item) { | 
					 | 
					 | 
					 | 
					                    $.each(my_items, function(i, item) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        if (item)    { // fix strange ie bug                        
 | 
					 | 
					 | 
					 | 
					                        if (item)    { // fix strange ie bug
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            //my_user_id        = item.f;                        
 | 
					 | 
					 | 
					 | 
					                            //my_user_id        = item.f;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            if ($("#chatbox_"+my_user_id).length <= 0) {                            
 | 
					 | 
					 | 
					 | 
					                            if ($("#chatbox_"+my_user_id).length <= 0) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                createChatBox(my_user_id, user_items.user_info.user_name, 1, user_items.user_info.online); | 
					 | 
					 | 
					 | 
					                                createChatBox(my_user_id, user_items.user_info.user_name, 1, user_items.user_info.online); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            } | 
					 | 
					 | 
					 | 
					                            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            if (item.s == 1) { | 
					 | 
					 | 
					 | 
					                            if (item.s == 1) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                //item.f = username;
 | 
					 | 
					 | 
					 | 
					                                //item.f = username;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            } | 
					 | 
					 | 
					 | 
					                            } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -159,31 +159,31 @@ function startChatSession() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            } | 
					 | 
					 | 
					 | 
					                            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        } | 
					 | 
					 | 
					 | 
					                        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }); | 
					 | 
					 | 
					 | 
					                    }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }); | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for (i=0;i<chatBoxes.length;i++) { | 
					 | 
					 | 
					 | 
					                for (i=0;i<chatBoxes.length;i++) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    my_user_id = chatBoxes[i]; | 
					 | 
					 | 
					 | 
					                    my_user_id = chatBoxes[i]; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    $("#chatbox_"+my_user_id+" .chatboxcontent").scrollTop($("#chatbox_"+my_user_id+" .chatboxcontent")[0].scrollHeight); | 
					 | 
					 | 
					 | 
					                    $("#chatbox_"+my_user_id+" .chatboxcontent").scrollTop($("#chatbox_"+my_user_id+" .chatboxcontent")[0].scrollHeight); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }        
 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }}); | 
					 | 
					 | 
					 | 
					        }}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function stopChatHeartBeat() {    
 | 
					 | 
					 | 
					 | 
					function stopChatHeartBeat() { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    clearInterval(timer); | 
					 | 
					 | 
					 | 
					    clearInterval(timer); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    timer = null; | 
					 | 
					 | 
					 | 
					    timer = null; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function startChatHeartBeat() {    
 | 
					 | 
					 | 
					 | 
					function startChatHeartBeat() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    timer = setInterval('chatHeartbeat();', chatHeartbeatTime);    
 | 
					 | 
					 | 
					 | 
					    timer = setInterval('chatHeartbeat();', chatHeartbeatTime); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/* | 
					 | 
					 | 
					 | 
					/* | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Shows the user messages in all windows | 
					 | 
					 | 
					 | 
					 * Shows the user messages in all windows | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * 
 | 
					 | 
					 | 
					 | 
					 * | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Item array structure : | 
					 | 
					 | 
					 | 
					 * Item array structure : | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * 
 | 
					 | 
					 | 
					 | 
					 * | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * item.s = type of message: 1 = message, 2 = "sent at" string | 
					 | 
					 | 
					 | 
					 * item.s = type of message: 1 = message, 2 = "sent at" string | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * item.m = message | 
					 | 
					 | 
					 | 
					 * item.m = message | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * item.f = from_user | 
					 | 
					 | 
					 | 
					 * item.f = from_user | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -191,23 +191,23 @@ function startChatHeartBeat() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 **/ | 
					 | 
					 | 
					 | 
					 **/ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function chatHeartbeat() { | 
					 | 
					 | 
					 | 
					function chatHeartbeat() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						var itemsfound = 0; | 
					 | 
					 | 
					 | 
						var itemsfound = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (windowFocus == false) { | 
					 | 
					 | 
					 | 
						if (windowFocus == false) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var blinkNumber  = 0; | 
					 | 
					 | 
					 | 
							var blinkNumber  = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var titleChanged = 0; | 
					 | 
					 | 
					 | 
							var titleChanged = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							for (x in newMessagesWin) { | 
					 | 
					 | 
					 | 
							for (x in newMessagesWin) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								if (newMessagesWin[x].status == true) { | 
					 | 
					 | 
					 | 
								if (newMessagesWin[x].status == true) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									++blinkNumber; | 
					 | 
					 | 
					 | 
									++blinkNumber; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									if (blinkNumber >= blinkOrder) { | 
					 | 
					 | 
					 | 
									if (blinkNumber >= blinkOrder) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										document.title = newMessagesWin[x].username+' says...'; | 
					 | 
					 | 
					 | 
										document.title = newMessagesWin[x].username+' says...'; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										titleChanged = 1; | 
					 | 
					 | 
					 | 
										titleChanged = 1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										break;	
 | 
					 | 
					 | 
					 | 
										break; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									} | 
					 | 
					 | 
					 | 
									} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								} | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (titleChanged == 0) { | 
					 | 
					 | 
					 | 
							if (titleChanged == 0) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								document.title = originalTitle; | 
					 | 
					 | 
					 | 
								document.title = originalTitle; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								blinkOrder = 0; | 
					 | 
					 | 
					 | 
								blinkOrder = 0; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -229,16 +229,16 @@ function chatHeartbeat() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								} | 
					 | 
					 | 
					 | 
								} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$.ajax({ | 
					 | 
					 | 
					 | 
						$.ajax({ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							url: ajax_url+"?action=chatheartbeat", | 
					 | 
					 | 
					 | 
							url: ajax_url+"?action=chatheartbeat", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							cache: false, | 
					 | 
					 | 
					 | 
							cache: false, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							dataType: "json", | 
					 | 
					 | 
					 | 
							dataType: "json", | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							success: function(data) {			
 | 
					 | 
					 | 
					 | 
							success: function(data) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$.each(data.items, function(my_user_id, user_items) { | 
					 | 
					 | 
					 | 
								$.each(data.items, function(my_user_id, user_items) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                my_items = user_items['items'];				
 | 
					 | 
					 | 
					 | 
					                my_items = user_items['items']; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									$.each(my_items, function(i, item) { | 
					 | 
					 | 
					 | 
									$.each(my_items, function(i, item) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										if (item)	{ // fix strange ie bug
 | 
					 | 
					 | 
					 | 
										if (item)	{ // fix strange ie bug
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -260,17 +260,17 @@ function chatHeartbeat() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												$("#chatbox_"+my_user_id+" .chatboxcontent").append('<div class="chatboxmessage"><span class="chatboxinfo">'+item.m+'</span></div>'); | 
					 | 
					 | 
					 | 
												$("#chatbox_"+my_user_id+" .chatboxcontent").append('<div class="chatboxmessage"><span class="chatboxinfo">'+item.m+'</span></div>'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											} else { | 
					 | 
					 | 
					 | 
											} else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												newMessages[my_user_id]		= {'status':true, 'username':item.username}; | 
					 | 
					 | 
					 | 
												newMessages[my_user_id]		= {'status':true, 'username':item.username}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												newMessagesWin[my_user_id]	= {'status':true, 'username':item.username};						
 | 
					 | 
					 | 
					 | 
												newMessagesWin[my_user_id]	= {'status':true, 'username':item.username}; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
												$("#chatbox_"+my_user_id+" .chatboxcontent").append('<div class="chatboxmessage">\n\ | 
					 | 
					 | 
					 | 
												$("#chatbox_"+my_user_id+" .chatboxcontent").append('<div class="chatboxmessage">\n\ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
																									 <span class="chatboxmessagefrom">'+item.username+':  </span>\n\ | 
					 | 
					 | 
					 | 
																									 <span class="chatboxmessagefrom">'+item.username+':  </span>\n\ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
																									 <span class="chatboxmessagecontent">'+item.m+'</span></div>'); | 
					 | 
					 | 
					 | 
																									 <span class="chatboxmessagecontent">'+item.m+'</span></div>'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											} | 
					 | 
					 | 
					 | 
											} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											$("#chatbox_"+my_user_id+" .chatboxcontent").scrollTop($("#chatbox_"+my_user_id+" .chatboxcontent")[0].scrollHeight); | 
					 | 
					 | 
					 | 
											$("#chatbox_"+my_user_id+" .chatboxcontent").scrollTop($("#chatbox_"+my_user_id+" .chatboxcontent")[0].scrollHeight); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        if ($('#chatbox_'+my_user_id+' .chatboxcontent').css('display') == 'none') { | 
					 | 
					 | 
					 | 
					                        if ($('#chatbox_'+my_user_id+' .chatboxcontent').css('display') == 'none') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            $('#chatbox_'+my_user_id+' .chatboxhead').toggleClass('chatboxblink'); | 
					 | 
					 | 
					 | 
					                            $('#chatbox_'+my_user_id+' .chatboxhead').toggleClass('chatboxblink'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        } | 
					 | 
					 | 
					 | 
					                        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
											itemsfound += 1; | 
					 | 
					 | 
					 | 
											itemsfound += 1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
										} | 
					 | 
					 | 
					 | 
										} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -292,13 +292,13 @@ function chatHeartbeat() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								//timer = setTimeout('chatHeartbeat();',chatHeartbeatTime);
 | 
					 | 
					 | 
					 | 
								//timer = setTimeout('chatHeartbeat();',chatHeartbeatTime);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}); //ajax	
 | 
					 | 
					 | 
					 | 
						}); //ajax
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function closeChatBox(user_id) { | 
					 | 
					 | 
					 | 
					function closeChatBox(user_id) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$('#chatbox_'+user_id).css('display','none'); | 
					 | 
					 | 
					 | 
						$('#chatbox_'+user_id).css('display','none'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        restructureChatBoxes();	
 | 
					 | 
					 | 
					 | 
					        restructureChatBoxes(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        $.post(ajax_url+"?action=closechat", {chatbox: user_id} , function(data){	
 | 
					 | 
					 | 
					 | 
					        $.post(ajax_url+"?action=closechat", {chatbox: user_id} , function(data){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}); | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -321,18 +321,25 @@ function restructureChatBoxes() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Function that fires the chat with an user (creates a chat bloclk) | 
					 | 
					 | 
					 | 
					 * Function that fires the chat with an user (creates a chat bloclk) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param int		user id 
 | 
					 | 
					 | 
					 | 
					 * @param int		user id | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param string	user's firstname + lastname | 
					 | 
					 | 
					 | 
					 * @param string	user's firstname + lastname | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param status | 
					 | 
					 | 
					 | 
					 * @param status | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * | 
					 | 
					 | 
					 | 
					 * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 **/ | 
					 | 
					 | 
					 | 
					 **/ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function chatWith(user_id, user_name, status) { | 
					 | 
					 | 
					 | 
					function chatWith(user_id, user_name, status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						createChatBox(user_id, user_name, 0, status); | 
					 | 
					 | 
					 | 
						createChatBox(user_id, user_name, 0, status); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$("#chatbox_"+user_id+" .chatboxtextarea").focus();	
 | 
					 | 
					 | 
					 | 
						$("#chatbox_"+user_id+" .chatboxtextarea").focus(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					function chatNotYetWith(message) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    $("#message_ajax_reponse").html(message); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    $("#message_ajax_reponse").css('display', 'block'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    $("#message_ajax_reponse").attr('class', 'alert'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    $('#message_ajax_reponse').alert() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Creates a div 
 | 
					 | 
					 | 
					 | 
					 * Creates a div | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
					 | 
					 | 
					 | 
					function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if ($("#chatbox_"+user_id).length > 0) { | 
					 | 
					 | 
					 | 
						if ($("#chatbox_"+user_id).length > 0) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -342,7 +349,7 @@ function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id+" .chatboxtextarea").focus(); | 
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id+" .chatboxtextarea").focus(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return; | 
					 | 
					 | 
					 | 
							return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}	
 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						user_is_online = return_online_user(user_id, online); | 
					 | 
					 | 
					 | 
						user_is_online = return_online_user(user_id, online); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -358,9 +365,9 @@ function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								<div class="chatboxcontent"></div>\n\ | 
					 | 
					 | 
					 | 
								<div class="chatboxcontent"></div>\n\ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								<div class="chatboxinput"><textarea class="chatboxtextarea" onkeydown="javascript:return checkChatBoxInputKey(event,this,\''+user_id+'\');"></textarea></div>') | 
					 | 
					 | 
					 | 
								<div class="chatboxinput"><textarea class="chatboxtextarea" onkeydown="javascript:return checkChatBoxInputKey(event,this,\''+user_id+'\');"></textarea></div>') | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						.appendTo($( "body" )); | 
					 | 
					 | 
					 | 
						.appendTo($( "body" )); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								   
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						$("#chatbox_"+user_id).css('bottom', '0px'); | 
					 | 
					 | 
					 | 
						$("#chatbox_"+user_id).css('bottom', '0px'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						chatBoxeslength = 0; | 
					 | 
					 | 
					 | 
						chatBoxeslength = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for (x in chatBoxes) { | 
					 | 
					 | 
					 | 
						for (x in chatBoxes) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -375,7 +382,7 @@ function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							width = (chatBoxeslength)*(225+7)+20 +225; | 
					 | 
					 | 
					 | 
							width = (chatBoxeslength)*(225+7)+20 +225; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id).css('right', width+'px'); | 
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id).css('right', width+'px'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						chatBoxes.push(user_id); | 
					 | 
					 | 
					 | 
						chatBoxes.push(user_id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (minimizeChatBox == 1) { | 
					 | 
					 | 
					 | 
						if (minimizeChatBox == 1) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -418,28 +425,28 @@ function createChatBox(user_id, chatboxtitle, minimizeChatBox, online) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Creates the div user status (green/gray button next to the user name) 
 | 
					 | 
					 | 
					 | 
					 * Creates the div user status (green/gray button next to the user name) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param int       user id | 
					 | 
					 | 
					 | 
					 * @param int       user id | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * @param int       status  1 or 0 | 
					 | 
					 | 
					 | 
					 * @param int       status  1 or 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function return_online_user(user_id, status) { | 
					 | 
					 | 
					 | 
					function return_online_user(user_id, status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						var div_wrapper = $("<div />" ); | 
					 | 
					 | 
					 | 
						var div_wrapper = $("<div />" ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						var new_div = $("<div />" ); | 
					 | 
					 | 
					 | 
						var new_div = $("<div />" ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						new_div.attr("id","online_"+user_id); | 
					 | 
					 | 
					 | 
						new_div.attr("id","online_"+user_id); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						new_div.attr("class","user_status"); | 
					 | 
					 | 
					 | 
						new_div.attr("class","user_status"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if (status == '1' || status == 1) { | 
					 | 
					 | 
					 | 
						if (status == '1' || status == 1) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							new_div.html(online_button); | 
					 | 
					 | 
					 | 
							new_div.html(online_button); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} else { | 
					 | 
					 | 
					 | 
						} else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							new_div.html(offline_button); | 
					 | 
					 | 
					 | 
							new_div.html(offline_button); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						div_wrapper.append(new_div); | 
					 | 
					 | 
					 | 
						div_wrapper.append(new_div); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						return div_wrapper.html();	
 | 
					 | 
					 | 
					 | 
						return div_wrapper.html(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					/** | 
					 | 
					 | 
					 | 
					/** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 * Updates the user status (green/gray button next to the user name) 
 | 
					 | 
					 | 
					 | 
					 * Updates the user status (green/gray button next to the user name) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 */ | 
					 | 
					 | 
					 | 
					 */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function update_online_user(user_id, status) { | 
					 | 
					 | 
					 | 
					function update_online_user(user_id, status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if ($("#online_" +user_id).length > 0) { | 
					 | 
					 | 
					 | 
						if ($("#online_" +user_id).length > 0) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -452,13 +459,13 @@ function update_online_user(user_id, status) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function toggleChatBoxGrowth(user_id) {		
 | 
					 | 
					 | 
					 | 
					function toggleChatBoxGrowth(user_id) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if ($('#chatbox_'+user_id+' .chatboxcontent').css('display') == 'none') { | 
					 | 
					 | 
					 | 
						if ($('#chatbox_'+user_id+' .chatboxcontent').css('display') == 'none') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var minimizedChatBoxes = new Array(); | 
					 | 
					 | 
					 | 
							var minimizedChatBoxes = new Array(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if ($.cookie('chatbox_minimized')) { | 
					 | 
					 | 
					 | 
							if ($.cookie('chatbox_minimized')) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								minimizedChatBoxes = $.cookie('chatbox_minimized').split(/\|/);			
 | 
					 | 
					 | 
					 | 
								minimizedChatBoxes = $.cookie('chatbox_minimized').split(/\|/); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							} | 
					 | 
					 | 
					 | 
							} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var newCookie = ''; | 
					 | 
					 | 
					 | 
							var newCookie = ''; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -475,7 +482,7 @@ function toggleChatBoxGrowth(user_id) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxcontent').css('display','block'); | 
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxcontent').css('display','block'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxinput').css('display','block'); | 
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxinput').css('display','block'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id+" .chatboxcontent").scrollTop($("#chatbox_"+user_id+" .chatboxcontent")[0].scrollHeight); | 
					 | 
					 | 
					 | 
							$("#chatbox_"+user_id+" .chatboxcontent").scrollTop($("#chatbox_"+user_id+" .chatboxcontent")[0].scrollHeight); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} else {		
 | 
					 | 
					 | 
					 | 
						} else { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							var newCookie = user_id; | 
					 | 
					 | 
					 | 
							var newCookie = user_id; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if ($.cookie('chatbox_minimized')) { | 
					 | 
					 | 
					 | 
							if ($.cookie('chatbox_minimized')) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								newCookie += '|'+$.cookie('chatbox_minimized'); | 
					 | 
					 | 
					 | 
								newCookie += '|'+$.cookie('chatbox_minimized'); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -483,7 +490,7 @@ function toggleChatBoxGrowth(user_id) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$.cookie('chatbox_minimized',newCookie); | 
					 | 
					 | 
					 | 
							$.cookie('chatbox_minimized',newCookie); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxcontent').css('display','none'); | 
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxcontent').css('display','none'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxinput').css('display','none'); | 
					 | 
					 | 
					 | 
							$('#chatbox_'+user_id+' .chatboxinput').css('display','none'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}	
 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					function checkChatBoxInputKey(event, chatboxtextarea, user_id) { | 
					 | 
					 | 
					 | 
					function checkChatBoxInputKey(event, chatboxtextarea, user_id) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -494,15 +501,15 @@ function checkChatBoxInputKey(event, chatboxtextarea, user_id) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$(chatboxtextarea).val(''); | 
					 | 
					 | 
					 | 
							$(chatboxtextarea).val(''); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$(chatboxtextarea).focus(); | 
					 | 
					 | 
					 | 
							$(chatboxtextarea).focus(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$(chatboxtextarea).css('height','44px'); | 
					 | 
					 | 
					 | 
							$(chatboxtextarea).css('height','44px'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							if (message != '') { | 
					 | 
					 | 
					 | 
							if (message != '') { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$.post(ajax_url + "?action=sendchat", {to: user_id, message: message} , function(data) { | 
					 | 
					 | 
					 | 
								$.post(ajax_url + "?action=sendchat", {to: user_id, message: message} , function(data) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									message = message.replace(/</g,"<").replace(/>/g,">").replace(/\"/g,"""); | 
					 | 
					 | 
					 | 
									message = message.replace(/</g,"<").replace(/>/g,">").replace(/\"/g,"""); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									$("#chatbox_"+user_id+" .chatboxcontent").append('<div class="chatboxmessage">\n\ | 
					 | 
					 | 
					 | 
									$("#chatbox_"+user_id+" .chatboxcontent").append('<div class="chatboxmessage">\n\ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									<span class="chatboxmessagefrom">'+username+':  </span>\n\ | 
					 | 
					 | 
					 | 
									<span class="chatboxmessagefrom">'+username+':  </span>\n\ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									<span class="chatboxmessagecontent">'+message+'</span></div>'); | 
					 | 
					 | 
					 | 
									<span class="chatboxmessagecontent">'+message+'</span></div>'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
									$("#chatbox_"+user_id+" .chatboxcontent").scrollTop($("#chatbox_"+user_id+" .chatboxcontent")[0].scrollHeight); | 
					 | 
					 | 
					 | 
									$("#chatbox_"+user_id+" .chatboxcontent").scrollTop($("#chatbox_"+user_id+" .chatboxcontent")[0].scrollHeight); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								}); | 
					 | 
					 | 
					 | 
								}); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -524,7 +531,7 @@ function checkChatBoxInputKey(event, chatboxtextarea, user_id) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								$(chatboxtextarea).css('height',adjustedHeight+8 +'px'); | 
					 | 
					 | 
					 | 
								$(chatboxtextarea).css('height',adjustedHeight+8 +'px'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} else { | 
					 | 
					 | 
					 | 
						} else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							$(chatboxtextarea).css('overflow','auto'); | 
					 | 
					 | 
					 | 
							$(chatboxtextarea).css('overflow','auto'); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}	 
 | 
					 | 
					 | 
					 | 
						} | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |