var swfMp3Player = new Object();
                
/**
 * Initialisation
 */
swfMp3Player.onInit = function()
{
    console.log("Audioplayer INIT: swf edition");
    this.position = 0;
};
/**
 * Update
 */
swfMp3Player.onUpdate = function()
{
    console.log('AudioPlayer: tick'+this.position + " / " + this.isPlaying);
    
    if((this.duration - this.position < 1000 || this.position == 0 && this.isPlaying == "false"))
    {
        getFlashObject().SetVariable("method:play", "");
    }
};
// 
function getFlashObject()
{
    return document.getElementById("swfPlayer");
}
function play(file)
{
    if (swfMp3Player.position == 0) {
        console.log("Audioplayer PLAY: "+file);
        getFlashObject().SetVariable("method:setUrl", file);
    }
    getFlashObject().SetVariable("method:play", "");
    getFlashObject().SetVariable("enabled", "true");
}
function pause()
{
    getFlashObject().SetVariable("method:pause", "");
}
function stop()
{
    getFlashObject().SetVariable("method:stop", "");
}
function setPosition()
{
    var position = document.getElementById("inputPosition").value;
    getFlashObject().SetVariable("method:setPosition", position);
}
function setVolume()
{
    var volume = document.getElementById("inputVolume").value;
    getFlashObject().SetVariable("method:setVolume", volume);
}