function artista( titulo, discografia, texto, imagen, tipo, url ) {
	this.id="artista"+(artista.Count++);
	this.titulo = titulo;
	this.discografia = discografia;
	this.texto = texto;
	this.url = url;
	this.imagen = imagen;
	this.tipo = tipo;
	return this
}
artista.Count=0

var artistas = new Array();
var artistasPath = "../img/artistas/";
		
function crearPaneles( artistas )
{
	//TIPO: Ruin-Records
	var celdaIzq = document.getElementById("mitadIzq");
	celdaIzq.width="90%";

	var cabTabla = "<table border=\"0\" width=\"100%\" cellpadding=\"1\" cellspacing=\"2\">";
	var textoHTML = cabTabla;
	
//	textoHTML += "<tr>";
//	textoHTML += "<td width=\"100%\" height=\"5%\" class=\"tipoArtista\" >";
//	textoHTML += "&nbsp;Ruin Records&nbsp;";
//	textoHTML += "</td>";
//	textoHTML += "</tr>";

	var totalArtistas = artistas.length - 1;
	for( var i = 0; i<=totalArtistas; i++ )
	{
		if( artistas[i].tipo == "Ruin-Records" )
		{
			textoHTML += creaEncabArtista( artistas, i )
		}
	}

	textoHTML += "</table>";
	celdaIzq.innerHTML = textoHTML;

	return;
	

	//TIPO: Extraños
	var celdaDer = document.getElementById("mitadDer");
	celdaDer.width="0%";
	celdaDer.innerText = "&nbsp;a";
	
	
	textoHTML = cabTabla;
	textoHTML += "<tr>";
	textoHTML += "<td width=\"100%\" height=\"5%\" class=\"tipoArtista\" >";
	textoHTML += "&nbsp;Extraños en el paraíso&nbsp;";
	textoHTML += "</td>";
	textoHTML += "</tr>";
	for( var i = 0; i<=totalArtistas; i++ )
	{
		if( artistas[i].tipo == "Extraños" )
		{
			textoHTML += creaEncabArtista( artistas, i )
		}
	}
	textoHTML += "</table>";

	celdaDer.innerHTML = textoHTML;
}

function creaEncabArtista( artistas, i )
{
	var textoHTML = "<tr>";
	textoHTML += "<td width=\"100%\" height=\"5%\" class=\"linkArtista\" ";
	if( artistas[i].url == '' )
	{
		if( ( artistas[i].texto != '' ) || ( artistas[i].discografia != '' ))
		{
			textoHTML += "onclick='javascript: showArtista(" + i + ")'>";
		}
		else
		{
			textoHTML += "onclick='javascript: alert(\"Lo sentimos, no hay información sobre este artista.\")'>";
		}
	}
	else
	{
		textoHTML += "onclick='javascript: abreVentana( \"" + artistas[i].url + "\" , \"\"); return false;'>";
	}
	textoHTML += "<img border=\"0\" src=\"../img/puntoAm.gif\">&nbsp;&nbsp;";
	textoHTML += artistas[i].titulo;
	textoHTML += "</td>";
	textoHTML += "</tr>";
	return textoHTML;
}

function showArtista(i)
{
	//TEXTO TEXTO TEXTO TEXTO TEXTO TEXTO TEXTO 
//	var celdaDer = document.getElementById("mitadDer");
//	celdaDer.width="55%";

	var celdaIzq = document.getElementById("mitadIzq");
	var textoHTML = "<table border=\"0\" width=\"100%\" height=\"100%\" cellpadding=\"1\" cellspacing=\"0\">";
	
	//ARTISTA
	textoHTML += "<tr>";
	textoHTML += "<td width=\"55%\" height=\"10%\" valign=\"top\">";

	//IMAGEN IMAGEN IMAGEN IMAGEN IMAGEN

//	celdaIzq.width="55%";

	if ( artistas[i].imagen != "" )
	{
		textoHTML += "<img src=\"" + artistasPath + artistas[i].imagen + "\" border=\"0\" align=\"middle\" onclick=\"javascript:crearPaneles( artistas );\">";
	}
	else
	{
		textoHTML += "&nbsp;";
	}
	textoHTML += "</td>";

	textoHTML += "<td width=\"45%\" height=\"10%\">";
	textoHTML += "<table border=\"0\" width=\"100%\" height=\"100%\" cellpadding=\"1\" cellspacing=\"0\">";
	textoHTML += "<tr>";
	textoHTML += "<td width=\"90%\" height=\"10%\" class=\"linkArtista\" bgcolor=\"#FFC501\"  onclick=\"javascript:crearPaneles( artistas );\">&nbsp;";
	textoHTML += artistas[i].titulo.toUpperCase();
	textoHTML += "</td>";
	textoHTML += "</tr>";

	//TEXTO
	textoHTML += "<tr>";
	textoHTML += "<td width=\"100%\" class=\"texto\" valign=\"top\" colspan=\"2\"><br class=\"sMicro\">";
	textoHTML += artistas[i].texto;
	textoHTML += "</td>";
	textoHTML += "</tr>";

	//DISCOGRAFÍA
	textoHTML += "<tr>";
	textoHTML += "<td width=\"90%\" height=\"10%\" class=\"linkArtista\" bgcolor=\"#FFC501\"  onclick=\"javascript:crearPaneles( artistas );\">&nbsp;";
	textoHTML += "DISCOGRAFÍA";
	textoHTML += "</td>";
	textoHTML += "</tr>";

	//TEXTO
	textoHTML += "<tr>";
	textoHTML += "<td width=\"100%\" class=\"texto\" valign=\"top\" colspan=\"2\"><br class=\"sMicro\">";
	textoHTML += artistas[i].discografia;
	textoHTML += "</td>";
	textoHTML += "</tr>";

	//VOLVER
	textoHTML += "<tr>";
	textoHTML += "<td width=\"100%\" valign=\"top\" colspan=\"2\" align=\"right\">";
	textoHTML += "<a href=\"#\" onclick=\"javascript:crearPaneles( artistas );\"><img src=\"../img/volver.gif\" border=\"0\" align=\"middle\"></a>";
	textoHTML += "</td>";
	textoHTML += "</tr>";

	textoHTML += "</table>";
	textoHTML += "</td>";
	textoHTML += "</tr>";

	textoHTML += "</table>";

	celdaIzq.innerHTML = textoHTML;
	//textoHTML += "<br class=\"sMicro\">";
//	celdaDer.innerHTML = textoHTML;

	//celda.style.border = "4px dotted " + artistas[i].color;
}


var ip = null;
//alert("sale de samples");

function PreLoad( artistas )
{
	//alert("entra en PreLoad");
	var imagesStr = new Array();
	var totalArtistas = artistas.length - 1;
	for( var i = 0; i<=totalArtistas; i++ )
	{
		if( artistas[i].imagen != '' )
		{
			imagesStr.push( artistasPath + artistas[i].imagen );
		}
	}

	new ImagePreloader( imagesStr, onPreload );
	//alert("sale de PreLoad");
}


function onPreload(aImages, nImages)
{
	//alert("entra en onpreload");
	//alert("intento cargar " + aImages[0].src );
	
//	var oImg = document.getElementById("imgSample");
	if ( nImages != aImages.length )
	{
		//alert("onpreload falla");
	//	oImg.src = samplesPath + "tensevision.gif";
	}
	else
	{
		//alert("carga " + aImages[0].src );
//		images = aImages;

		//oImg.src = aImages[0].src;
		//alert("onpreload termina bien");
	}
	//setTimeout( "SelectAndLoad();", 5000 );
}
