var isIeMac = navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Win")==-1;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
					//////////////////   Player object  //////////////////////////
function Player_rp(p_PlayerId, p_sName, p_bAutoPlay, p_iPosition) {
     // specfic methods
     this.play = play_rp;
     this.playPause = playPause_rp;
     this.pause = pause_rp;
     this.stop = stop_rp;
     this.goToPosition = goto_rp;
     this.fullScreen = fullScreen_rp;
     this.checkEvents = checkEvents_rp;
     this.getCurrentMediaName = getCurrentMediaName_rp;
     this.setMediaLoop = setMediaLoop_rp;
          
     this.init_gen = init_gen;

     position_to_seek = -1;

     // general init
     this.init_gen(p_PlayerId, p_sName, p_bAutoPlay, p_iPosition);

    // autostart for linux
	if (p_bAutoPlay)
	{
		var agt=navigator.userAgent.toLowerCase();
		var is_linux = (agt.indexOf("inux")!=-1);
		if (is_linux) 
			this.play();
	}
}
					//////////////////   Play Method (Real Player)    //////////////////////////

function play_rp(p_sFilename) {
  
	if (!isIeMac) {
	
		if (p_sFilename != null) {
			this.m_sMediaFile = p_sFilename;
			this.m_PlayerId.SetSource(p_sFilename);
		}
	
		this.m_PlayerId.DoPlay();
		this.play_gen(p_sFilename);
	}
}

					//////////////////   PlayPause Method (Real Player)    //////////////////////////
function playPause_rp() {
	if (!isIeMac) {
		this.playPause_gen();
	}
}

					//////////////////   Pause Method (Real Player)    //////////////////////////
					
function pause_rp() {
	if (!isIeMac) {
    	this.m_PlayerId.DoPlayPause();
		this.pause_gen();
	}
}


					//////////////////   Stop Method (Real Player)    //////////////////////////
				
function stop_rp() {
	if (!isIeMac) {
    	if (this.m_PlayerId.CanStop())
   		{
        	this.m_PlayerId.DoStop();  
        	this.stop_gen();
    	}
    }
}

					//////////////////   Goto Method (Real Player)    //////////////////////////
					
function goto_rp(p_iPosition) {
 	if (!isIeMac) {
	position_to_seek = p_iPosition;
	this.goto_gen(p_iPosition);

	if (this.m_PlayerId.GetPlayState() == 0 || this.m_PlayerId.GetPlayState() == 4 || this.m_PlayerId.GetPlayState() == 3)  // stopped
	{
		this.m_PlayerId.SetPosition(position_to_seek);
		position_to_seek = -1;
	}
	}
}

					//////////////////   CheckEvents Method (Real Player)    //////////////////////////

function checkEvents_rp() {
 	if (!isIeMac) {  
	if (position_to_seek != -1) {
		this.goToPosition(position_to_seek);
	}
	
	// check status events
	var currentstatus = this.m_iStatus;
	// Position event
	var currentposition =  this.m_PlayerId.GetPosition();

  	this.m_iTotalTime = this.m_PlayerId.GetLength();
		
	this.checkEvents_gen(currentstatus, currentposition); // to complete
	}
}

//////////////////   FullScreen Method (Real Player)    //////////////////////////
function fullScreen_rp(p_bDoIt)
{
	if (!isIeMac) {
	  	if (p_bDoIt == false)
			this.m_PlayerId.SetOriginalSize();
		else
			this.m_PlayerId.SetFullScreen();
    	
    }
}

function getCurrentMediaName_rp()
{
	return this.m_PlayerId.GetTitle();
}

function setMediaLoop_rp()
{
	this.m_PlayerId.SetLoop(true);
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
