/*
 * Copyright (C) 1995-2011 by 4system Polska Sp. z o.o.
 * All Rights Reserved. v4
 */

componentVideo = function(name)
{
	//inherited
	this.componentAudio = componentAudio;
	this.componentAudio(name);
	
	this.nextStepWaitToEnd = false;
	this.showPlayer = true;
	this.stopTimer = null;
};

componentVideo.prototype = new componentAudio;
componentVideo.prototype.type = "componentVideo";

componentVideo.prototype.unload = function()
{
	if (is.moz) {
		var inner = this.findContentObj();
		if (inner) {
			inner.innerHTML = "";
		}
	}
}

componentVideo.prototype.findContentObj = function()
{
	return document.getElementById(this.id);
}

componentVideo.prototype.editorPaint = function()
{
	var t = "";
	t += '<img width="100%" height="100%" src="'+ lms.mediaURL() + this.iconSrc +'" />';
	return t;
};

componentVideo.prototype.hide = function()
{
	//this.doStop(); //pg2- nie moze byc, poniewaz przy ukryciu (na starcie) i tak video jest za3mane a przy akcji OnStop->Hide robi sie zapetlenie
	this.setVisible(this.isVisible(false));
}

componentVideo.prototype.prepareNextStep = function()
{
	var res = false;
	var player = document.getElementById(this.id + "MediaPlayer");
	if (player) {
		if (this.pvWMP7up) {
			res = (player.playState == 1 || player.playState == 10);
		} else if (this.pvWMP64) {
			res = (player.PlayState == 0);
		}
	} else {
		res = true;
	}
	
	if (!res) this.timer = window.setTimeout('var o=pc.' + this.id + '; if(o) {o.prepareNextStep();}', 100);
	else{ this.invokeEvent("MediaStop")}
	return res;
}

componentVideo.prototype.noDisplay = function()
{
	return;
}














