var playlist = [
	// object {url:string url, title:string title, artist: string artist]
	// or
	// string url
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/01.mp3',title:'The Best Revenge',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/02.mp3',title:'We Are Electric',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/03.mp3',title:'Money Can\'t Dance',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/04.mp3',title:'In A Modern World',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/05.mp3',title:'Supply &amp; Demand',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/06.mp3',title:'Amuse Bouche',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/07.mp3',title:'Infidels Of The World Unite',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/08.mp3',title:'Door Train Home',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/09.mp3',title:'Dance en France',artist:'fischerspooner'},
	{url:'http://s3.amazonaws.com/cash_users/fischerspooner/10.mp3',title:'To The Moon',artist:'fischerspooner'}
];

var player = new SoundPlayer({
	playlist:playlist,
	autostart:true,
	swfLocation:"scripts/SoundPlayer.swf",
	controlImages:{previous:"images/previous.png",next:"images/next.png",play:"images/play.png",pause:"images/pause.png"},
	seekbarSpcStyle: {'position':'relative','background-color':'#fff','height':'3px','width':'100%','margin-top':'4px','overflow':'hidden'},
	seekbarStyle: {'position':'absolute','background-color':'#93b9ce','height':'3px','width':'0%','cursor':'pointer','z-index':'10'},
	positionStyle: {'position':'absolute','left':'0%','width':'3px','height':'3px','background-color':'#234767','z-index':'15'}
});

player.addEvent('ready', function() {
	$('soundplayerspc').getElement('div.title').set('html','&nbsp;');
	
	var mainUl = new Element('ol',{'styles':{'padding':0,'margin':0,'list-style-type':'decimal-leading-zero'}}).inject(this.controls);
	this.options.playlist.each(function(track,index) { 
		var tmpLi = new Element('li',{'styles':{'list-style-position':'inside'}}).inject(mainUl);
		var tmpSpan = new Element('span',{
			html:track.title,
			'styles':{'cursor':'pointer'},
			'events':{
				'click': function(){
					if (this.currentSound) {
						this.stopCurrentSound();
					}
		        	allSoundKeys = this.sounds.getKeys();
					sound = this.sounds.get(track.url);
					this.currentKey = allSoundKeys.indexOf(track.url);
					this.currentSound = sound;
					this.currentSound.sound.position = 0;
					this.playCurrentSound();
		        }.bind(this)
			}
		}).inject(tmpLi);
				
	},this);
	mainUl.inject($('soundplayer_playlist'));
});
