
function JarisFLVPlayer(id){

	this.playerId = id; //Stores the id of the player
	this.player = document.getElementById(id); //Object that points to the player
}

//Event constants
JarisFLVPlayer.event = {
	MOUSE_HIDE: "onMouseHide",
	MOUSE_SHOW: "onMouseShow",
	MEDIA_INITIALIZED: "onDataInitialized",
	BUFFERING: "onBuffering",
	NOT_BUFFERING: "onNotBuffering",
	RESIZE: "onResize",
	PLAY_PAUSE: "onPlayPause",
	PLAYBACK_FINISHED: "onPlaybackFinished",
	CONNECTION_FAILED: "onConnectionFailed",
	ASPECT_RATIO: "onAspectRatio",
	VOLUME_UP: "onVolumeUp",
	VOLUME_DOWN: "onVolumeDown",
	VOLUME_CHANGE: "onVolumeChange",
	MUTE: "onMute",
	TIME: "onTimeUpdate",
	PROGRESS: "onProgress",
	SEEK: "onSeek",
	ON_ALL: "on*"
};

JarisFLVPlayer.prototype.isBuffering = function(){
	return this.player.api_get("isBuffering");
}

JarisFLVPlayer.prototype.isPlaying = function(){
	return this.player.api_get("isPlaying");
}

JarisFLVPlayer.prototype.getCurrentTime = function(){
	return this.player.api_get("time");
}

JarisFLVPlayer.prototype.getBytesLoaded = function(){
	return this.player.api_get("loaded");
}

JarisFLVPlayer.prototype.getVolume = function(){
	return this.player.api_get("volume");
}

JarisFLVPlayer.prototype.addListener = function(event, listener){
	this.player.api_addlistener(event, listener);
}

JarisFLVPlayer.prototype.removeListener = function(event){
	this.player.api_removelistener(event);
}

JarisFLVPlayer.prototype.play = function(){
	this.player.api_play();
}

JarisFLVPlayer.prototype.pause = function(){
	this.player.api_pause();
}

JarisFLVPlayer.prototype.seek = function(seconds){
	this.player.api_seek(seconds);
}

JarisFLVPlayer.prototype.volume = function(value){
	this.player.api_volume(value);
}

var flashvarsVideo = {
//        source: "/images/layout/sangabriel2.7.flv",
        source: "http://dalpontcorporation.com/sangabriel/sangabriel2.7.flv",
        type: "video",
        streamtype: "file",
        poster: "/images/layout/video_logo.jpg",
        autostart: "false",
        controls: 'false',
        jsapi: '1'
};
var flash_video_params = {
        menu: "false",
        scale: "noScale",
        allowFullscreen: "false",
        allowScriptAccess: "always",
        bgcolor: "#000000",
        quality: "high",
        wmode: "opaque"
};
var flash_video_attributes = {
        id:"JarisFLVPlayer"
};



var myplayer = swfobject.embedSWF("/js/lib/jarisflv/JarisFLVPlayer.swf", "jarisplayer", "582px", "303px", "10.0.0", "/js/lib/jarisflv/expressInstall.swf", flashvarsVideo, flash_video_params, flash_video_attributes, clickevent);
// var myplayer = new JarisFLVPlayer("JarisFLVPlayer");

function onPlaybackFinished(data)
{
    $('player_button').setStyle('display', 'block');
}
function clickevent(e)
{
    var player_ref = new JarisFLVPlayer('JarisFLVPlayer');
    $('player_button').addEvent('click', function(){
        this.setStyle('display', 'none');
        player_ref.addListener(JarisFLVPlayer.event.PLAYBACK_FINISHED, "onPlaybackFinished");
        player_ref.play()
    });
}
