var playlist = [
	// object {url:string url, title:string title, artist: string artist]
	// or
	// string url
	{url:'mp3s/04ladida.mp3',title:'la di da',artist:'Sydney Wayser'},
	{url:'mp3s/05wrapmeinablanket.mp3',title:'wrap me in a blanket',artist:'Sydney Wayser'},
	{url:'mp3s/07comfortablehere.mp3',title:'comfortable here',artist:'Sydney Wayser'},
	{url:'mp3s/09ohtheplacesyoullgo.mp3',title:'oh the places you\'ll go',artist:'Sydney Wayser'},
	{url:'mp3s/11drive-innotdrive-through.mp3',title:'drive-in not drive-through',artist:'Sydney Wayser'}
];

var player = new SoundPlayer({
	playlist:playlist,
	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':'#bcd9fc','height':'3px','width':'100%','margin-top':'4px','overflow':'hidden'},
	seekbarStyle: {'position':'absolute','background-color':'#000','height':'3px','width':'0%','cursor':'pointer','z-index':'10'},
	positionStyle: {'position':'absolute','left':'0%','width':'3px','height':'3px','background-color':'#fff','z-index':'15'}
});

player.addEvent('ready', function() {
	$('soundplayerspc').getElement('div.title').set('html','press play!');
	
	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','color':'#fe892a'},
			'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'));
});
