

var comment_block;
function toggleComments(obj) {

	var animationSpeed = 1000;
	obj = $(obj);
	var table = $(obj).parent().parent().parent().parent().parent().children(".com");
	
	if ($(table).children("li").length > 5) {

		if ($(table).children("li:eq(5)").css("display") == "none") {
			$(table).children("li").each(function (i) {
				if (i > 4) {
					$(this).slideDown(animationSpeed);
				}
			});
			$(obj).text("Ukryj");
		} else {
			$(table).children("li").each(function (i) {
				if (i > 4) {
					$(this).slideUp(animationSpeed);
				}
			});
			$(obj).text("Zobacz wszystkie");
		}
		
	}
	
	
	
}

function viewComments(model, id, obj) {
	comment_block = obj;
	$.post(baseUrl+"/comments/listing/"+model+"/"+id, function (data) {
		$(comment_block).html(data);
		if ((typeof window['afterComments'] == 'function')) {
			eval('afterComments()');

		}

	});
}

function viewUserComments(model, id, obj) {
	comment_block = obj;
	$.post(baseUrl+"/comments/listing/"+model+"/"+id+"/1", function (data) {
		$(comment_block).html(data);
	});
	
}

