$(document).ready(function() {
$("span.add_notepad").click(function(){ add_or_dell_notepad($(this).attr('name'), $(this).attr('data')); });
	function add_or_dell_notepad(name, data){
			$.ajax({
			url: "/modules/notepad/add_dell.php",
			data: ""+data,
			beforeSend: function(){
	          // перед тем как "спросить" изменяем класс элемента - отображаем loading картинку
	          $("#notepad"+name).addClass('loading');
	     },
			success: function(response){
					$("#notepad"+name).removeClass('loading');
					$("#notepad"+name).toggleClass('dell_notepad');
					$("#notepad_counter").html(response);
					return true;
			}
		});
			
	}

$("span.dell_from_notepad").click(function(){ dell_from_notepad($(this).attr('name'), $(this).attr('data')); });
	function dell_from_notepad(name, data){
			$.ajax({
			url: "/modules/notepad/add_dell.php",
			data: ""+data,
			beforeSend: function(){
	          // перед тем как "спросить" изменяем класс элемента - отображаем loading картинку
	          $("span.id"+name).addClass('loading');
	     },
			success: function(response){
					$("tr.notepad"+name).removeClass('loading');
					$("tr.notepad"+name).animate({ backgroundColor: "#FF5050" }, "fast")
	                                    .animate({ opacity: "hide" }, "slow")
					$("#notepad_counter").html(response);
					return true;
			}
		});
			
	}

$("span.dell_all").click(function(){ dell_all(); });
	function dell_all(){
			$.ajax({
			url: "/modules/notepad/add_dell.php",
			data: "dell_all=1",
			beforeSend: function(){
	          // перед тем как "спросить" изменяем класс элемента - отображаем loading картинку
	          $("span.dell_all").addClass('loading');
	     },
			success: function(response){
					$("span.dell_all").removeClass('loading');
					$(".listing").animate({ backgroundColor: "#FF5050" }, "fast")
	                                    .animate({ opacity: "hide" }, "slow")
					$("#notepad_description").slideToggle("slow");
					$("a.print_all").css("display", "none");
					$("span.dell_all").css("display", "none");					
					
					return true;
			}
		});
			
	}





});
