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

componentActiveXAudioRecorder = function(name)
{
	this.componentElement = componentElement;
	this.componentElement(name);
	
	this.timerID = null;
};

componentActiveXAudioRecorder.prototype = new componentElement();
componentActiveXAudioRecorder.prototype.type = "componentActiveXAudioRecorder";

componentActiveXAudioRecorder.prototype.onBaseCreate = function(obj)
{
	if (this.execution) {
		this.resourcesStatus = "online";
		this.resourcesURL = resourcesURL;
		if (PageInterface.GetValue("state") != psDesigning && lms && lms.name != "lmsOffline") {
			this.resourcesStatus = lms.resourcesStatus();
			if (this.disableOnlineOfflineMix) this.resourcesURL = resourcesURL;
			else this.resourcesURL = lms.resourcesURL();
		}
		
		this.captureMouseEvents();
	}
};

componentActiveXAudioRecorder.prototype.onCreate = function(obj) 
{
	var t = '';
	
	if (PageInterface.GetValue("state") == psNormal){
		t += '<OBJECT id="'+ this.id + 'activeX"';
		t += ' classid="clsid:9E05090D-A2E3-4240-990C-2B3FF1097453"';
		t += ' codebase="'+ this.resourcesURL +'axRecorderProj1.ocx#version=1,0,0,315"';
		t += ' width='+this.w+' height='+this.h+' align=center hspace=0 vspace=0 name="'+ this.id +'activeX">';
		
		t += '<param name="WavPattern" value="' + this.resourcesURL + this.audio_src + '">';		
		t += '<param name="ResizeForm" value="">';		
		
		t += '</OBJECT>';
	}else{
		t = this.textDesign;
	};
	this.setHTML(t);
};

componentActiveXAudioRecorder.prototype.onPaint = function(obj) 
{
var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
	};
};

componentActiveXAudioRecorder.prototype.onUnLoad = function() {
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.DoUnload) != 'undefined')
			obj.DoUnload();
	};	
};

componentActiveXAudioRecorder.prototype.PlayPattern = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.PlayPattern) != 'undefined')
			obj.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PausePattern = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {	
		if (typeof(obj.PausePattern) != 'undefined')
			obj.PausePattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.StopPattern = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.StopPattern) != 'undefined')
			obj.StopPattern();
	};		
	return(true);		
};

componentActiveXAudioRecorder.prototype.RecordNew = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.RecordNew) != 'undefined')
			obj.RecordNew();
	};		
	return(true);		
};

componentActiveXAudioRecorder.prototype.PlayNew = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.PlayNew) != 'undefined')
			obj.PlayNew();
	};		
	return(true);		
};

componentActiveXAudioRecorder.prototype.PauseNew = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.PauseNew) != 'undefined')
			obj.PauseNew();
	};		
	return(true);		
};

componentActiveXAudioRecorder.prototype.StopNew = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.StopNew) != 'undefined')
			obj.StopNew();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.Compare = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj) {
		if (typeof(obj.Compare) != 'undefined')
			obj.Compare();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayFirst = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[0]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[0];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			}
		}
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlaySecond = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[1]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[1];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayThird = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[2]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[2];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};			
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayForth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[3]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[3];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayFifth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[4]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[4];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlaySixth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[5]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[5];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlaySeventh = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[6]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[6];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayEighth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[7]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[7];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayNineth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[8]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[8];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[9]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[9];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayEleventh = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[10]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[10];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwelfth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[11]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[11];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayThirteent = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[12]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[12];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayFortieth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[13]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[13];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayFifteenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[14]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[14];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlaySixteenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[15]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[15];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlaySeventeenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[16]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[16];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayEighteenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[17]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[17];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayNineteenth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[18]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[18];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentieth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[19]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[19];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentiethOne = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[20]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[20];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentiethTwo = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[21]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[21];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentiethTree = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[22]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[22];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentiethForth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[23]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[23];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.PlayTwentiethFifth = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	var name = this.filesNames.split('||');
	if (obj && typeof(name[24]) != 'undefined') {
		obj.WavPattern = this.resourcesURL + name[24];
		if (typeof(obj.ResizeForm) != 'undefined'){
			if (this.showButtons){
				obj.ResizeForm(this.w, this.h, 1);
			}else{
				obj.ResizeForm(this.w, this.h, 0);		
			};
		};					
			
		this.PlayPattern();
	};		
	return(true);	
};

componentActiveXAudioRecorder.prototype.isReady = function()
{
	var obj = document.getElementById(this.id + 'activeX');
	if (obj){
		if (is.moz) return true;
		return (typeof(obj.WavPattern) != 'undefined');
	}else{
		return true;
	};
}

componentActiveXAudioRecorder.prototype.onFree = function() {
	if (this.timerID != null) 
		window.clearTimeout(this.timerID);
}
