	
			$(document).ready( function() {
			$(".addfriend").click( function() 
			{
			      var ID = $(this).attr("id");
                  var dataString = 'friendid='+ ID;
			
					jConfirm('Are you sure you want to add this user to friends?', 'Confirmation Dialog', 
				
				    function(r) {
					if(r==true)
					{
					//add some ajac 
					  $.ajax({
		                          type: "POST",
                                  url: "addfriends.php",
                                 data: dataString,
								 dataType: "json",
                                 cache: false,
                                success: function(msg){
                                           if(parseInt(msg.status)==1)
			                                  {
				                                 var jibu=msg.txt;
												
												  var t=1;//success
                                                }
			                                        else if(parseInt(msg.status)==0)
		                                       	{
				                                   var jibu =msg.txt;
												  var  t=0;
													
			                                  }
			  
								         jAlert(jibu, 'Confirmation dialog', 
										  function(r){
										     if(t==1){ 
											 $('#box'+ID).fadeOut(300);//fade out the user after 
											 $('li#list'+ID).fadeOut('slow', function() {$(this).remove();});
                                              $('#friendadded').fadeOut(300);//fade out the user after friendadded	
											  $('#friendaddeded').fadeOut(300);//fade out the user after friendadded
											  $('#showreq').show();
											  $('#showreq').fadeIn(400).html("<div id='showrequest'>Friend  Request sent</div>");////fadeIN to show the request sent
											  }else if(t==0){
											$('li#list'+ID).fadeOut('slow', function() {$(this).remove();});
										  }
                                           });
                                        }
                                         });
					          
				
						}
						
						
						
					});
				});

				
				
				
				
				
				
				
			});
			
