
/*
 *@author elboletaire at underave dot net
 */

/* Precarrega les imatges de la botiga i el netlabel */
function coverImages(){
	$(function(){
		$("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);
			});
		});
	});
}

/* Swap entre car�tules dels �lbums */
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');
	});
}
/* Mostra un modal box amb un reproductor */
function play(album, song){
	$.get("player.php?album="+album+"&mp3="+song, function(data){
		$(data).modal({
			close: true,
			position: ["15%",],
			containerCss: { width: 200, height: 20 }
		});
	});
}
/* Funcions per obrir i tancar els modal box amb efectes d'entrada i sortida */
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);
					});
				});
			}, 
		};
/* Precarrega les imatges de desc�rrega de fitxers zip i gzip */
function preloadDownloadImages(){
	$(function(){
		var img = ['zip.png','tar.png'];
		$(img).each(function(){
			var img = new Image();
			img.src = 'style/img/' + this;
		});
	});
}
