function classReader(opt)
{
var root = this;
this.req    = null;
this.reader = null;
this.opt    = {};
this.func   = {};

this.func.decode = function(ArrayBuffer)
	{
	return new TextDecoder('windows-1250').decode(ArrayBuffer);
//	return new TextDecoder('iso-8859-2').decode(ArrayBuffer);
	}

this.func.cbReader = function(event)
	{
	root.opt.log('classReader.func.cbReader: File reading end.');
	var str;
	str = isExist(event.target.result) ? event.target.result : (root.reader.result ? root.reader.result : '');
	root.opt.cbEnd(str);
	}

this.func.cbRequest = function()
	{
	root.opt.log('classReader.func.cbRequest: Request reading...');
	var file = root.req.response;
	if (!file)
		{
		root.opt.log('classReader.func.cbRequest: Chyba, neni soubor.');
		return;
		}
	root.reader = new FileReader();
	root.reader.onload = root.opt.cbReader;
	root.reader.readAsText(file,'windows-1250');
	}

this.func.fileFromUrl = function(path)
	{
	root.opt.log('classReader.func.fileFromUrl: File reading...');
	root.req = new XMLHttpRequest();
	root.req.responseType = 'blob';	// pro FileReader
	root.req.onload = root.opt.cbRequest;
	root.req.open('GET', path, true);
	root.req.send();
	}

this.func.fileFromInput = function(elInput)
	{
	root.opt.log('classReader.func.fileFromInput: File reading...');
	var file = elInput.files[0];
	if (!file)
		{
		root.opt.log('classReader.func.fileFromInput: Chyba, neni soubor.');
		return;
		}
	root.reader = new FileReader();
	root.reader.onload = root.opt.cbReader;
	root.reader.readAsText(file,'windows-1250');
	}

this.func.init = function(opt)
	{
	var bool;
	bool = isObject(opt);
	root.opt.log       = bool && isFunction(opt.log)       ? opt.log       : null;
	root.opt.cbRequest = bool && isFunction(opt.cbRequest) ? opt.cbRequest : root.func.cbRequest;
	root.opt.cbReader  = bool && isFunction(opt.cbReader)  ? opt.cbReader  : root.func.cbReader;
	root.opt.cbEnd     = bool && isFunction(opt.cbEnd)     ? opt.cbEnd     : null;
	}

this.func.init(opt);

}

READER = new classReader({log:SCREEN.log, cbEnd:SCREEN.log});
