var MiniPlayer = new Class({
	
	initialize: function(element, player)
	{
		//alert('hi');
		this.e = element;
		this.player = player;
		this.c = player.c;
		
		this.title = $('mpTitle');
		
		this.index = false;
		
		this.muteButtons = [];
		$$('.muteButton').each
		(
			function(e)
			{
				this.muteButtons.include(new ImageBasedSwitchButton(e, this.c));
			}.bind(this)
		);
		
		this.playButtons = [];
		$$('.playButton').each
		(
			function(e)
			{
				this.playButtons.include(new ImageBasedSwitchButton(e, this.c));
			}.bind(this)
		);
		
		this.nextButtons = [];
		$$('.nextButton').each
		(
			function(e)
			{
				this.nextButtons.include(new ImageBasedButton(e, this.c));
			}.bind(this)
		);
		
		this.previousButtons = [];
		$$('.previousButton').each
		(
			function(e)
			{
				this.previousButtons.include(new ImageBasedButton(e, this.c));
			}.bind(this)
		);
		
		
	},
	
	setTitle: function(index)
	{
		this.index = index;
		var nowPlaying = this.player.playlistObj[this.index].title;
		this.title.set('html','<small><b>' + nowPlaying + '</b></small>');
	},
	
	setMute: function()
	{
		this.muteButtons.each
		(
			function(b)
			{
				b.toggle();
			}
		
		)
	},
	
	setPlay: function()
	{
		this.playButtons.each
		(
			function(b)
			{
				b.toggle();
			}
		
		)
	},
	
	setPlayCheck: function()
	{
		this.playButtons.each
		(
			function(b)
			{
				if(!b.active)
				{
					b.toggle();
				}
			}
		
		)
	},
	
	setPlayFromFlash: function(state)
	{
		
		this.playButtons.each
		(
			function(b)
			{
				state ? b.switchOn() : b.switchOff();
			}.bind(this)
		
		)
	}
	
	
});



//helper class for hMenu
var playlistButton = new Class({	
	
	Extends: Button,
	
	initialize: function(element, controller, number)
	{
		this.setElement(element);
		this.setController(controller,'playlistButtonClicked');
		this.number = number;
	}
});
