var seekbarSpcStyle = {'position':'relative','background-color':'#E0C8B0','height':'12px','width':'100%','margin-top':'4px','overflow':'hidden','border':'1px solid black'};
var seekbarStyle = {'position':'absolute','background-color':'#AD9A88','height':'12px','width':'0%','cursor':'pointer','z-index':'10'};
var positionStyle = {'position':'absolute','left':'0%','width':'6px','height':'12px','background-color':'#285C70','z-index':'15'};
var controlsStyle = {'text-align':'left'};

var playlistStyle = {'padding':0,'margin':'5px','list-style-type':'square'};

var playlist = [
	// object {url:string url, title:string title, artist: string artist]
	// or
	// string url
	{url:'media/wims/01%20The%20Longing%20in%20My%20Heart.mp3',title:'The Longing in My Heart',artist:'Wing and a Prayer'},
	{url:'media/wims/05%20On%20You%20I%20Stand.mp3',title:'On You I Stand',artist:'Wing and a Prayer'},
	{url:'media/wims/08%20Walkin\'%20in%20My%20Shoes.mp3',title:'Walkin\' in My Shoes',artist:'Wing and a Prayer'},
	{url:'media/wims/12%20Laus%20Deo.mp3',title:'Laus Deo',artist:'Wing and a Prayer'}
];

var player = new SoundPlayer({
	autostart:false,
	playlist:playlist,
	seekbarSpcStyle: seekbarSpcStyle,
	seekbarStyle: seekbarStyle,
	positionStyle: positionStyle,
	controlsStyle: controlsStyle
});

player.addEvent('ready', function() {
	var mainUl = new Element('ul',{'styles':playlistStyle}).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',{
			text:track.title,
			'styles':{'cursor':'pointer'},
			'events':{
				'click': function(){
		        	allSoundKeys = this.sounds.getKeys();
					sound = this.sounds.get(track.url);
					this.currentKey = allSoundKeys.indexOf(track.url);
					this.currentSound = sound;
					this.playCurrentSound();
		        }.bind(this)
			}
		}).inject(tmpLi);;
	},this);
	mainUl.inject($('soundplayer_playlist'));
});

var playlist_bog = [
	// object {url:string url, title:string title, artist: string artist]
	// or
	// string url
	{url:'media/bog/yourenotalone.mp3',title:'You\'re Not Alone'},
	{url:'media/bog/armsofourfather.mp3',title:'Arms of Our Father'},
	{url:'media/bog/sevenwondersoftheworld.mp3',title:'Seven Wonders of the World'},
	{url:'media/bog/liftupyourvoices.mp3',title:'Lift Up Your Voices'}
];

var player_bog = new SoundPlayer({
	autostart:false,
	playlist:playlist_bog,
	injectInto:'soundplayerspc_bog',
	seekbarSpcStyle: seekbarSpcStyle,
	seekbarStyle: seekbarStyle,
	positionStyle: positionStyle,
	controlsStyle: controlsStyle
});

player_bog.addEvent('ready', function() {
	var mainUl = new Element('ul',{'styles':playlistStyle}).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',{
			text:track.title,
			'styles':{'cursor':'pointer'},
			'events':{
				'click': function(){
		        	allSoundKeys = this.sounds.getKeys();
					sound = this.sounds.get(track.url);
					this.currentKey = allSoundKeys.indexOf(track.url);
					this.currentSound = sound;
					this.playCurrentSound();
		        }.bind(this)
			}
		}).inject(tmpLi);;
	},this);
	mainUl.inject($('soundplayer_playlist_bog'));
});

var playlist_potp = [
	// object {url:string url, title:string title, artist: string artist]
	// or
	// string url
	{url:'media/potp/look_in_the_book.mp3',title:'Look in the Book'},
	{url:'media/potp/gentle_healer.mp3',title:'The Gentle Healer'},
	{url:'media/potp/you_are_the_only_one.mp3',title:'You Are the Only One'},
	{url:'media/potp/open_hearts.mp3',title:'Open Hearts'}
];


var player_potp = new SoundPlayer({
	autostart:false,
	playlist:playlist_potp,
	injectInto:'soundplayerspc_potp',
	seekbarSpcStyle: seekbarSpcStyle,
	seekbarStyle: seekbarStyle,
	positionStyle: positionStyle,
	controlsStyle: controlsStyle
});

player_potp.addEvent('ready', function() {
	var mainUl = new Element('ul',{'styles':playlistStyle}).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',{
			text:track.title,
			'styles':{'cursor':'pointer'},
			'events':{
				'click': function(){
		        	allSoundKeys = this.sounds.getKeys();
					sound = this.sounds.get(track.url);
					this.currentKey = allSoundKeys.indexOf(track.url);
					this.currentSound = sound;
					this.playCurrentSound();
		        }.bind(this)
			}
		}).inject(tmpLi);;
	},this);
	mainUl.inject($('soundplayer_playlist_potp'));
});
