﻿
function Player()
{
	this.NowPlaying = 0;
	this.NowPlayingAlt = 0;
	this.PlayerWidth = 672;
	this.PlayerHeight = 19;
	this.PlayImagePath = "/images/btn_play_1.gif";
	this.PauseImagePath = "/images/btn_pause_1.gif";
	this.FlashFilePath = "/js/ogb/FlashPlayer/player.swf";
	this.FileLoaderPage = "/fileloader.aspx";
}

Player.prototype.PlayTrack = function(id) 
{
	$("tr.PlayerTr").hide().find("td").html("");
	$("img.PlayerBut").attr("src", this.PlayImagePath);
		
	if (this.NowPlaying == id)
	{
		this.NowPlaying = 0;
		return;
	}
	this.NowPlaying = id;
	$("#player_tr_" + id).show();
	$("#player_but_" + id).attr("src", this.PauseImagePath);
		
	var so = new SWFObject(this.FlashFilePath, 'mpl', this.PlayerWidth, this.PlayerHeight, '9');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','false');
	so.addParam('flashvars','file=' + this.FileLoaderPage + '%3ftrid%3d' + id + '%26type.mp3&autostart=true');
	so.write('player_td_' + id);
}

Player.prototype.PlayTrackAlt = function(id) 
{
	alert("Function was not implemeted");
}

$(document).ready(function() {
	$.Player = new Player();
});