/* 
JavaScript
@copyright  2008 
@author     Felix Pfeiffer : Neue Medien
@package    nesiumplayer 
@license    LGPL

nesium.js is a little Function to change single Instances of the Nesium-MP3-Player using swfObject 2

*/

function NesiumPlayer()
{

	this.bgcolor = '#FFFFFF';
	this.txtcolor = '#333333';
	this.barbgcolor = '#DDDDDD';
	this.loadbar = '#888888';
	this.posbar = '#660000';
	
	var flashvars = {};
	
	/**
	 * Für einen Player wird ein Objekt erzeugt, welches die Grunddaten wie PlayerID usw. definiert.
	 **/
	this.initialize = function(playerID,bgcolor,txtcolor,barbgcolor,loadbar,posbar)
	{
		if(playerID == "" || playerID == undefined) 
		{
			return false;
		}
		
		this.playerID = playerID;
		
		this.bgcolor = ( bgcolor != '' ) ? '#' + bgcolor : this.bgcolor;
		this.txtcolor = ( txtcolor != '' ) ? '#' + txtcolor : this.txtcolor;
		this.barbgcolor = ( barbgcolor != '' ) ? '#' + barbgcolor : this.barbgcolor;
		this.loadbar = ( loadbar != '' ) ? '#' + loadbar : this.loadbar;
		this.posbar = ( posbar != '' ) ? '#' + posbar : this.posbar;

	}
	
	this.playlistPlayer = function(obj,loop,autoplay)
	{
		
		var mp3file = $(obj).getProperty('href');
		var title = $(obj).getProperty('title');
		
		//flashvars = "mp3url="+mp3file+"&autoplay="+autoplay+"&loop="+loop+"&txt="+title;	
		flashvars.mp3url = mp3file;		
		flashvars.autoplay = autoplay;		
		flashvars.loop = loop;		
		flashvars.txt = title;		
		
		this.buildPlayer();
	}
	
	this.initialPlayer = function(mp3file,title,loop,autoplay)
	{
		flashvars.mp3url = mp3file;		
		flashvars.autoplay = autoplay;		
		flashvars.loop = loop;		
		flashvars.txt = title;	
		
		//flashvars = "mp3url="+mp3file+"&autoplay="+autoplay+"&loop="+loop+"&txt="+title;
		
		this.buildPlayer();
	}
	
	this.buildPlayer = function()
	{

		this.addColors();

		var params = {bgcolor:this.bgcolor}
		
		/*var F1 = { movie:"system/modules/nesiumplayer/html/flash/mp3.swf",
					width:"275",
					height:"50",
					majorversion:"7",
					build:"0",
					bgcolor:this.bgcolor,
					flashvars:flashvar
		};*/
	
		swfobject.embedSWF("system/modules/nesiumplayer/html/flash/mp3.swf",this.playerID,"275","50","7.0.0",false,flashvars,params);
	}
	
	this.addColors = function()
	{

		flashvars.bgcolor = this.bgcolor;
		flashvars.txtcolor = this.txtcolor;
		flashvars.barbgcolor = this.barbgcolor;
		flashvars.loadbar = this.loadbar;
		flashvars.posbar = this.posbar;
	}

}