var Info = Class.create({
	initialize: function() {
		this.divPrefijo = 	"divgrupo_";
		this.menuPrefijo = 	"grupo_";
		this.mp3Prefijo =	"mp3_";
		this.idActual = 	0;
		this.activo =		"";
		this.total =		12;		

		this.mp3excepts =	new Array();
		this.mp3excepts[0] = "9";
		this.mp3excepts[1] = "11";
		this.mp3excepts[2] = "12";
	},
	activar: function(obj,num) {		
		var id = obj.id;

		// primero desactivamos el anterior
		if(this.activo != "")
		{
			$(this.activo).src = "img/menu/grupo_"+this.activo+".gif";

			// caso especial 12 y 13
			if(id == "the")
			{
				$('cabriolets').src = "img/menu/grupo_cabriolets.gif";
				$('cabriolets').removeClassName('activo');
			}
			else if(id == "cabriolets")
			{
				$('the').src = "img/menu/grupo_the.gif";
				$('the').removeClassName('activo');
			}

			$(this.activo).removeClassName('activo');
			$(this.mp3Prefijo+this.activo).update(this.swfVacio());
		}

		// activamos
		obj.src = "img/activo/grupo_red_"+id+".gif";	
		$(id).addClassName('activo');	

		// caso especial 12 y 13
		if(id == "the")
		{
			$('cabriolets').src = "img/activo/grupo_red_cabriolets.gif";
			$('cabriolets').addClassName('activo');	
		}
		else if(id == "cabriolets")
		{
			$('the').src = "img/activo/grupo_red_the.gif";
			$('the').addClassName('activo');	
		}		

		if(id == "the")
		{
			id = "cabriolets";
		}

		// activamos mp3
		if(this.swfExiste(num))
		{
			$(this.mp3Prefijo+id).update(this.swfLoad(num));
		}
		else
		{
			$(this.mp3Prefijo+id).update(this.swfVacio());
		}

		this.activo = id;
	},
	cargar: function(obj, id) {
		if(id != "")
		{
			this.ocultar(this.idActual);
			$(this.divPrefijo+id).style.display = 'block';
			this.idActual = id;

			// activar titulo
			this.activar(obj,id);
		}
	},
	init: function(obj,id) {
		this.ocultarTodo();
		
		$(this.divPrefijo+id).style.display = 'block';
		$(obj).src = "img/activo/grupo_red_"+obj+".gif";
		this.idActual = id;
		this.activo = obj;
		$(this.activo).addClassName('activo');	
	},
	toggle: function(obj, op) {
		var id = obj.id;

		if(id != this.activo)
		{
			if(op == 'ov')
			{
				obj.src = "img/menu/grupo_red_"+id+".gif";
	
				// caso especial 12 y 13
				if(id == "the")
				{
					$('cabriolets').src = "img/menu/grupo_red_cabriolets.gif";
				}
				else if(id == "cabriolets")
				{
					$('the').src = "img/menu/grupo_red_the.gif";
				}
			}
			else
			{
				obj.src = "img/menu/grupo_"+id+".gif";
	
				// caso especial 12 y 13
				if(id == "the")
				{
					$('cabriolets').src = "img/menu/grupo_cabriolets.gif";
				}
				else if(id == "cabriolets")
				{
					$('the').src = "img/menu/grupo_the.gif";
				}
			}
		}
			
	},
	ocultar: function(id) {
		//alert(this.divPrefijo+id)
		$(this.divPrefijo+id).style.display = 'none';
	},
	ocultarTodo: function() {
		for(i=1 ; i <= this.total ; i++)
		{
			this.ocultar(i);
		}
	},

	swfExiste: function(id) {
		existe = true;
		i = 0;
		while(i < this.mp3excepts.length)
		{

			if(this.mp3excepts[i] == id) existe = false;
			i++;
		}

		return existe;
	},

	swfLoad: function(id) {
		txt = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="349" height="75">';
		txt += '<param name="movie" value="swf/mp3player.swf" />';
		txt += '<param name="quality" value="high" />';
		txt += '<param name="FlashVars" value="cancion='+ id +'" />';
		txt += '<embed name="swfMp3_1" src="swf/mp3player.swf" quality="high" FlashVars="cancion='+ id +'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="349" height="75"></embed></object>';	

		return txt;
	},

	swfVacio: function(id) {
		txt = '<span style="line-height:75px;height:75px">&nbsp;</span>';
		/*
		txt = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="349" height="75">';
		txt += '<param name="movie" value="swf/mp3vacio.swf" />';
		txt += '<param name="quality" value="high" />';
		txt += '<embed src="swf/mp3vacio.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="349" height="75"></embed></object>';	
		*/
		return txt;
	}
});

var Img = Class.create({
	initialize: function() {
		
	},
	toggle: function(obj, img) {
		var id = obj.id;
		
		obj.src = img;
	}
});