			var player = null;
			var curItemIndx = null;
			var curType = "sound";
			var resetType = "sound";
			
			function playerReady(thePlayer)
			{
				//alert("playerReady");
				player = window.document[thePlayer.id];
				player.addControllerListener('ITEM','onPlaylistItemChange');
				player.addControllerListener('PLAY','onTogglePlayback');
				player.addControllerListener('STOP','onStopPlayback');
			}
			
			function onPlaylistItemChange(obj)
			{
				//alert("onPlaylistItemChange, index:"+obj.index+", playedOnce:"+playedOnce);
				
				var index = obj.index;
				var type = player.getPlaylist()[obj.index].type;
				
				updatePlayPauseGraphics(index);
				playItem(index, false);
			}
			
			
			function closeVideo()
			{
				if (curType == "video")
				{ 
					createPlayer(0, resetType, false);
					updatePlayPauseGraphics(-1);
				}
			}
			
			function onTogglePlayback(obj)
			{
				if (obj.state == true)
				{
					// item is playing so update playlist link to pause button
					updatePlayPauseGraphics(curItemIndx);
				}
				else
				{
					// item isn't playing so update all playlist links to play button
					updatePlayPauseGraphics(-1);
				}
			}
			
			function onStopPlayback()
			{
				updatePlayPauseGraphics(-1);
			}
			
			function playItem(index, fromLink)
			{
				var type = player.getPlaylist()[index].type;
				var state = player.getConfig().state;

				highlightActiveTrack(index);	// highlight the active track in the playlist
				
				if (fromLink == false)
				{
					// clicking on control bar
					if (type != curType)
					{
						createPlayer(index, type, true);
					}
				}
				else
				{
					// clicking on playlist link
					if(curItemIndx == index)
					{
						// clicking on playlist link for already selected song
						if (state == "PLAYING")
						{
							// clicked on pause button on playlist link for playing song
							player.sendEvent('PLAY', false);	
						}
						else
						{
							// clicked on play button on playlist link for paused song
							player.sendEvent('PLAY', true);
						}
					}
					else
					{
						// clicking on playlist link for NOT already selected song
						if (type == curType)
						{
							// clicking on  playlist link for media of same type, so don't re-embed player
							player.sendEvent('ITEM', index);
						}
						else
						{
							// clicking on  playlist link for media of different type, so re-embed player
							createPlayer(index, type, true);
						}
					}
				}
				
				curItemIndx = index
				//curType = stype;
				
			}
			
			function updatePlayPauseGraphics(index)
			{
				var count = 0;
				while(document["item"+count] != null)
				{
					if (count == index)
					{
						// is playing item so set playlist link to pause button
						document["item"+count].src = "/images/pause.png";
					}
					else
					{
						// is NOT playing item so set playlist link to play button
						document["item"+count].src = "/images/play.png";
					}
					count++;
				}
			}
			
			function createPlayer(itemIndex, type, bautostart, playlist)
			{
				embed = 
				{
					swf: "/js/player.swf",
					container: "jwplayer",
					width: 328,
					height: 20,
					version: "9.0.115",
					expressInstall: "/js/expressInstall.swf"
				};
				
				if (type == "video"){ embed.height = 200;}
				
				var flashvars = 
				{
					//file: "http://100000fansdev.wrvrywhr.com/flashdev/rev01/playlists/jonnybomb.xml",
					file: playlist,
					repeat: "list",
					playlist: "none",					
					item: itemIndex,
					icons: false,
					autostart: bautostart
					//type: stype
					//usefullscreen: "false",
					//displayheight: 225,
					//overstretch: "fit"
				};
				
				var params = 
				{
					allowFullScreen: "true",
					scale:"noScale", 
					salign:"lt",
					menu: "false"
				};
				
				var attributes = 
				{
					id: "jwplayer",
					name: "jwplayer"
				};
				
				swfobject.embedSWF(embed.swf, embed.container, embed.width, embed.height, embed.version, embed.expressInstall, flashvars, params, attributes);
				
				if (bautostart == true){ updatePlayPauseGraphics(itemIndex); }
				curType = type;
			}

