$(document).ready(function(){
							
	$('#disco').each(function() {
		// Total Tracks
		var totalTracks = $(this).find('.track').length;
		$(this).find('.totalTracks').append(totalTracks);
		
		// sonlist animation
		$(this).find('.toggleHandel').toggle(function () {
			if($(this).hasClass('.expand'))
			{
				expand(this);
			}
			else
			{
				collapse(this);
			}
		}, function(){
			if($(this).hasClass('.expand'))
			{
				expand(this);
			}
			else
			{
				collapse(this);
			}
		});	  
	});
	
	function expand(sender)
	{
		var trackHeight = 0;
		$(sender).parents('#disco').find('.songList .track').each(function() {
			trackHeight += parseInt($(this).css("height")) + parseInt($(this).css("paddingTop")) + parseInt($(this).css("paddingBottom")) 
						+ parseInt($(this).css("marginTop")) + parseInt($(this).css("marginBottom")) + parseInt($(this).css("borderTopWidth")) 
						+ parseInt($(this).css("borderBottomWidth"));
		});
		
		$(sender).parents('#disco').find('.tracks .header a.toggleLink').text('Track List');
		$(sender).parents('#disco').find('.songList').stop().animate({
			height:	trackHeight
		});
		$(sender).parent().find('a.toggleHandel').removeClass('expand');
		$(sender).attr('title','click to collapse');
	}
	function collapse(sender)
	{
		$(sender).parents('#disco').find('.tracks .header a.toggleLink').text('View Track List');
		$(sender).parents('#disco').find('.songList').stop().animate({
			height:	0
		});
		$(sender).parent().find('a.toggleHandel').addClass('expand');
		$(sender).attr('title','click to expand');
	}
	
	$('a.toggle').click();
	
});




/*$(document).ready(function () {
	var boxHeight = $('.songList').height();
	
	$(".toggle").toggle(function () {
		$('.songList').stop().animate({
			height:	0
		});
		$('.toggle').addClass('expand');
		$('.toggle').attr('title','click to expand');
	}, function(){
		$('.songList').stop().animate({
			height:	boxHeight
		});
		$('.toggle').removeClass('expand');
		$('.toggle').attr('title','click to collapse');
	});
	
	var totalTracks = $('.track').length;
	$('.totalTracks').append(totalTracks);
	
});*/
