	$(function(){
		$('.veure_tots a.coment').click(function(){
			
			var refid = $(this).attr('rel').substr(11);

			$("#comentaris-"+refid+" .coment_box").css({'height':'auto'});

			$(this).parent().fadeOut('fast');
			
			$("#comentaris-"+refid+" .coment_box").slideUp('fast');
			
			$("#comentaris-"+refid+" .coment_box").load('/vistes/llistat/coments.php?se='+$(this).attr('id'),function(){
				$("#comentaris-"+refid+" .coment_box").slideDown('slow',function(){
					$("#comentaris-"+refid+" .veure_tots_tancar").fadeIn('slow');
				});
				
			});

			return false;
		});
		
		$('.veure_tots_tancar a.coment').click(function(){
			
			var refid = $(this).attr('rel').substr(11);

			$(this).parent().fadeOut('fast');
			
			$("#comentaris-"+refid+" .coment_box").css({'overflow':'hidden'});

			height = $("#comentaris-"+refid+" .coment_box .coments .coment:first").height()+21;
			height2 = $("#comentaris-"+refid+" .coment_box .coments .coment:first").next().height()+21;
			height3 = $("#comentaris-"+refid+" .coment_box .coments .coment:first").next().next().height()+21;

			newHeight = height+height2+height3;

			$("#comentaris-"+refid+" .coment_box").animate({
				height: newHeight+'px',
			  }, 200, function() {
					$("#comentaris-"+refid+" .veure_tots").fadeIn('slow');
			  });

			return false;
		});
		
		$('a.tabt').click(function(){



			target = $(this).attr('rel');
			tabt = $(this).attr('id');
			idprev = parseInt($(this).attr('rel').lastIndexOf("-"))+1;
			id = $(this).attr('rel').substr(idprev);

			$('#tab-cont-'+id+' .tab').hide();

			$('#'+target).show();
			$(this).parent().parent().contents('h3').removeClass('sel');
			$(this).parent().addClass('sel');
			
			if($(this).attr('rel').substr(0,4)=='mapa') init();
			
			$(this).parent().parent().contents('h3').removeClass('nomarg');
			$(this).parent().prev().addClass("nomarg");

			return false;
		});
		
		$('.tracklist table tr').hover(function(){
			$(this).addClass('hover');
		},
		function(){
			$(this).removeClass('hover');
		});
	
		
	});

