	function unroll_single_note(link){
		var re=new RegExp("note_more_([0-9]+)","i");
		result=re.exec($(link).attr('id'));
		if(result){
			if(result[1]){
				var id=result[1];
			}
		}
		var fullidstring="note_full_content_"+id;
		var shortidstring="note_content_"+id;
		$('#'+shortidstring).hide();
		$('#'+fullidstring).show();
		$(link).text("zwiń");
		$(link).addClass('unrolled');
	}
	
	function roll_single_note(link){
			var re=new RegExp("note_more_([0-9]+)","i");
			result=re.exec($(link).attr('id'));
			if(result){
				if(result[1]){
					var id=result[1];
				}
			}
			var fullidstring="note_full_content_"+id;
			var shortidstring="note_content_"+id;
			$('#'+fullidstring).hide();
			$('#'+shortidstring).show();
			$(link).text("rozwiń »");
			$(link).removeClass('unrolled');
	}
	$(document).ready(function(){
		$('.unroll_all').click(function(){
			// wszystkie rozwiniete, zwijamy
			if($(this).hasClass('unrolled')){
				$('.note_more').each(function(){
					roll_single_note($(this));
				});
				$(this).removeClass('unrolled');
				$(this).text('Rozwiń wszystkie notatki')
				$(this).removeClass('up');
				$(this).addClass('down');
			}
			// wszystkie zwiniete, rozwijamy
			else{
				$('.note_more').each(function(){
					unroll_single_note($(this));
				});
				$(this).addClass('unrolled');
				$(this).text('Zwiń wszystkie notatki')
				$(this).removeClass('down');
				$(this).addClass('up');
				
			}
		});
		$('.note_more').click(function(){
			if($(this).hasClass('unrolled')){
				roll_single_note($(this));
			}
			else{
				unroll_single_note($(this));
			}
		});
	});

