	$(function(){
		var img = ['zip.png','tar.png'];
		$(img).each(function(){
			var img = new Image();
			img.src = 'style/img/' + this;
		});
		$("img").each(function(){
			var img = new Image();
			img.src = $(this).attr("rel");
		});
		$("#content ul.shop li a img").each(function(){
			$(this).css("cursor","pointer").click(function(){
				changeCover(this);
			});
		});
		$("a[href='#close_credits']").click(function(){
			$("#credits").slideToggle();
		});
	});
	function changeCover(imatge){
		var actSrc = $(imatge).attr("src");
		var newSrc = $(imatge).attr("rel");
		$(imatge).fadeOut('slow',function(){
			$(imatge).attr({src: newSrc, rel: actSrc});
			$(imatge).fadeIn('slow');
		});
	}
	/* SIMPLEMODAL FUNCTIONS */
	function download(id){
		$.get("download.php?id="+id, function(data){
			$(data).modal({
				close: true,
				position: ["15%",]
			});
		});
	}
	function play(album, song){
		$.get("player.php?album="+album+"&mp3="+song, function(data){
			$(data).modal({
				close: true,
				position: ["15%",],
				containerCss: { width: 200, height: 20 }
			});
		});
	}
	var modal = { 
		open: function(dialog){
				dialog.overlay.fadeIn(300, function(){
					dialog.container.fadeIn(300, function(){
						dialog.data.fadeIn(300);
					});
				});
			},
		close: function(dialog){
				dialog.overlay.fadeOut(300, function(){
					dialog.container.fadeOut(300, function(){
						dialog.data.fadeOut(300);
					});
				});
			} 
		};
