function AbotPlayer()
{
	var MOVIE_NAME = "abotplayer";
	var NUM_SONGS = 5;
	var MUSIC_BUTTON = "musicbutton";
	var BASE_CLASSNAME = "song";
	var CLASSNAME = "playing";

	var current_song = null;

	this.Player = function()
	{
		if(window.document[MOVIE_NAME])
		{
			return(window.document[MOVIE_NAME]);
		}

		if(window[MOVIE_NAME])
		{
			return(window[MOVIE_NAME]);
		}

		if((navigator.appName.indexOf("Microsoft Internet")==-1) && (document.embeds) && (document.embeds[MOVIE_NAME]))
		{
			return(document.embeds[MOVIE_NAME]);
		}

		return(document.getElementById(MOVIE_NAME));
	}

	this.Play = function(num)
	{
		if((current_song != null) && (typeof num != "undefined") && (num == current_song))
		{
			this.Stop();
		} else
		{
			// Let's reset anything we previously had here.
			this.HighLight();

			var our_link = document.getElementById(MUSIC_BUTTON);
			our_link.href = "javascript:Abot.Stop();";
			our_link.innerHTML = "Stop Music";

			if(typeof num == "undefined")
			{
				current_song = 0;
			} else
			{
				current_song = num;
			}

			var player = this.Player();
			player.playSong(songs[current_song]);

			this.HighLight();
		}
	}

	this.Stop = function()
	{
		var our_link = document.getElementById(MUSIC_BUTTON);
		our_link.href = "javascript:Abot.Play();";
		our_link.innerHTML = "Play Music";

		var player = this.Player();
		player.stopMusic();

		this.HighLight();
		current_song = null;
	}

	this.HighLight = function()
	{
		if(current_song != null)
		{
			var our_class = document.getElementById(BASE_CLASSNAME + current_song);

			if(our_class.className == CLASSNAME)
			{
				our_class.className = null;
			} else
			{
				our_class.className = CLASSNAME;
			}
		}
	}

	this.NextSong = function()
	{
		if((current_song == null) || ((current_song + 1) >= NUM_SONGS))
		{
			num = 0;
		} else
		{
			num = current_song + 1;
		}

		this.Play(num);
	}
}

var Abot = new AbotPlayer();