$(document).ready( function() {
	if($('#sidebar #albumList')) {
		$("#sidebar #albumList li").mouseover(function() { 
			var id = $(this).html();
			var num = $("#sidebar #albumList li").size();
			$("#sidebar #albumList li").removeClass('on');
			$(this).addClass('on'); 

			for(var i=0;i<=num;i++){
				if(i!=id) {
					$('#sidebar #artAlb'+i).hide();
					$('#sidebar #albImg'+i).hide();
				}
			}
			// move the arrow
			var arrLeft = (id * 22) + 630;
			$('#sidebar #uparrow').css({'left' : arrLeft+'px'});


			$('#sidebar #artAlb'+id).show();			
			$('#sidebar #albImg'+id).show();
		}); 
	}
	
	$('#nav img').mouseover( function () { $(this).addClass('on'); });
	$('#nav img').mouseout( function () { $(this).removeClass('on'); });
	
	$('#artistSelectList').click(function() { $('#artistList').show(); });
	$('#artistList').mouseleave(function() { $(this).hide();});
	
	$('.backtotop').click(function(){
		$('html, body').animate({scrollTop:0});
	});
	
	if($('.slider')){
		$('.slider').each( function() { $(this).easySlider({
			continuous: true,
			controlsShow: false,
            nextId: 'nextBtn'+$(this).attr('rel'),
            prevId: 'prevBtn'+$(this).attr('rel')			
			})
		});
	}
});

function playTrack(track_id){
	$.ajax({
		type: 'get', url: 'getmusic.php', data: 'track_id='+track_id, dataType: 'json',
		success: function(d){
			top.header.myPlayList = d;
			top.header.playListChange(0);
		}
	});
	
	

}