/*
function pulse(){
  $('.tabla div').animate({
    opacity: "toggle",    
  }, 1000, function() {
    // Animation complete.
    pulse();
  });
}
*/
function erase_active_conversation(elem, conversation_id){
  $.ajax({
    type: "GET",
    url: "/Modules/Ajax_functions/Active_message_erase_conversation.php",
    //cache: false,    
    data:{
      conversation_id:conversation_id
    },
    
    beforeSend: function(){},
    success: function(msg){
      $(elem).parent().parent().remove();
    },
    error: function(){ /*alert("Elkúrtuk. Nem kicsit. Nagyon.");*/ }
  });
}


function gritter(title, text, image, sticky, time, class_name){
	$.gritter.add({
		// (string | mandatory) the heading of the notification
		//title: "This is a regular notice!",
		title: title,
		
		// (string | mandatory) the text inside the notification
		//text: "This will fade out after a certain amount of time.",
		text: text,
		
		// (string | optional) the image to display on the left
		//image: "http://a0.twimg.com/profile_images/59268975/jquery_avatar_bigger.png",
		image: image,
		
		// (bool | optional) if you want it to fade out on its own or just sit there
		sticky: false, 
		
		// (int | optional) the time you want it to be alive for before fading out (milliseconds)
		time: 8000,
		
		// (string | optional) the class name you want to apply directly to the notification for custom styling
		class_name: "my-class",
    
    // (function | optional) function called before it opens
		before_open: function(){
			//alert("I am a sticky called before it opens");
		},
		
		// (function | optional) function called after it opens
		after_open: function(e){
			//alert("I am a sticky called after it opens: \nI am passed the jQuery object for the created Gritter element...\n" + e);
		},
	
		// (function | optional) function called before it closes
		before_close: function(e){
			//alert("I am a sticky called before it closes: I am passed the jQuery object for the Gritter element... \n" + e);
		},

		// (function | optional) function called after it closes
		after_close: function(){
			//alert("I am a sticky called after it closes");
		}
	});
}


function reload(){
  $(".system_message").slideUp("slow", function(){
    $(".system_message").html("");
  });

  $.ajax({
    type: "GET",
    url: "/Modules/Ajax_functions/Core.php",                 
    //cache: false,
    
    dataType: "script",
    
    beforeSend: function(){},                 
    success: function(msg){},
    error: function(){ /*alert("Elkúrtuk. Nem kicsit. Nagyon.");*/ }
  });
}

function play_sound(sound){
  var audioElement = document.createElement('audio');
  audioElement.setAttribute('src', sound);
  audioElement.setAttribute('autoplay', 'autoplay');
  //audioElement.volume=0;
  audioElement.load();
}

function remove_attached(id, element){
  $.ajax({
    type: "POST",
    url: "/Modules/Ajax_functions/Attached_files_remove.php",                 
    //cache: false,
    
    //dataType: "script",
    data:{
      id:id
    },
    
    beforeSend: function(){},                 
    success: function(msg){},
    error: function(){ 
      //alert("Elkúrtuk. Nem kicsit. Nagyon."); 
    }
  });
    
  $(element).parent().parent().remove();
}
